Thread overview
NEW asm.dlang.org site
Jan 26, 2015
Iain Buclaw
Jan 26, 2015
Rikki Cattermole
Jan 27, 2015
Vladimir Panteleev
Jan 27, 2015
ZombineDev
Jan 27, 2015
Iain Buclaw
Jan 28, 2015
ZombineDev
Feb 02, 2015
Jakob Ovrum
January 26, 2015
Hi,

It is my pleasure to release a new site onto the community.  An Interactive DMD compiler.

http://asm.dlang.org/

Inspired by Matt Godbolt's GCC Explorer[1], and my own hosted version that uses GDC[2].  I was asked by Andrei to fork and make a working protoype that uses DMD.

All work is hosted on Github[3], and we are planning on moving it to part of the D-Programming-Language repositories.

Please share, contribute, and destroy!

Regards
Iain.

[1]: http://gcc.godbolt.org/
[2]: http://explore.dgnu.org/
[3]: https://github.com/ibuclaw/gcc-explorer/
January 26, 2015
On 27/01/2015 12:46 p.m., Iain Buclaw wrote:
> Hi,
>
> It is my pleasure to release a new site onto the community.  An
> Interactive DMD compiler.
>
> http://asm.dlang.org/
>
> Inspired by Matt Godbolt's GCC Explorer[1], and my own hosted version
> that uses GDC[2].  I was asked by Andrei to fork and make a working
> protoype that uses DMD.
>
> All work is hosted on Github[3], and we are planning on moving it to
> part of the D-Programming-Language repositories.
>
> Please share, contribute, and destroy!
>
> Regards
> Iain.
>
> [1]: http://gcc.godbolt.org/
> [2]: http://explore.dgnu.org/
> [3]: https://github.com/ibuclaw/gcc-explorer/

1) can we get e.g. ldc ext. on there as well?
2) can it be renamed e.g. paste/pastebin?
3) login ext. integrated with code.dlang.org would be nice for full pastebin features
January 27, 2015
On Monday, 26 January 2015 at 23:46:24 UTC, Iain Buclaw wrote:
> Hi,
>
> It is my pleasure to release a new site onto the community.  An Interactive DMD compiler.

Cool, but I think we ought to improve Dpaste instead, as right now we have two services with overlapping roles. nazriel seems to have been busy with other things lately. I host dpaste currently, so let me know if you want to contribute improvements.
January 27, 2015
Thanks for the good work! It would be really nice if in the future we could compare  DMD, GDC and LDC (and SDC when it becomes more usable) at asm.dlang.org. (Btw a nice choice of name :) )

I have a couple of questions about the output when looking at a C++[1] program and the same in GDC[2] and DMD[3](I am not very familiar with assembly):

1) Syntax:
AFAIU, (_D)main pushes 3 and 4 to the stack and calls (example.)add. Then (example.)add loads them from the stack in two registers and adds them.
IIRC, dmd passes parameters in reverse order (of the normal C way) and that's why pushing and loading 3 and 4 from the stack is in reverse order.

However why does DMD use hex instead of decimal notation?
[I was also a little confused about positive vs negative indexing of bp and the order of src and dst in the arguments to movl, but then I noticed that I am comparing x86 and x86_64, so I managed to answer those questions myself :D ]

2) _Dmain:
I also noticed that the output of gdc-4.4 and gdc-4.6 does not include a label for _Dmain (nor the regular C main). Is this a problem of the disassembly, or just how older version of GDC produced code?


[1]: http://goo.gl/mUQKiX (permalink at http://gcc.godbolt.org/)
[2]: http://goo.gl/CmYbrZ (permalink at http://explore.dgnu.org/)
[3]: http://goo.gl/ZHHVuZ (permalink at http://asm.dlang.org/)

On Monday, 26 January 2015 at 23:46:24 UTC, Iain Buclaw wrote:
> Hi,
>
> It is my pleasure to release a new site onto the community.  An Interactive DMD compiler.
>
> http://asm.dlang.org/
>
> Inspired by Matt Godbolt's GCC Explorer[1], and my own hosted version that uses GDC[2].  I was asked by Andrei to fork and make a working protoype that uses DMD.
>
> All work is hosted on Github[3], and we are planning on moving it to part of the D-Programming-Language repositories.
>
> Please share, contribute, and destroy!
>
> Regards
> Iain.
>
> [1]: http://gcc.godbolt.org/
> [2]: http://explore.dgnu.org/
> [3]: https://github.com/ibuclaw/gcc-explorer/

January 27, 2015
On 27 January 2015 at 12:53, ZombineDev via Digitalmars-d-announce <digitalmars-d-announce@puremagic.com> wrote:
> Thanks for the good work! It would be really nice if in the future we could
> compare  DMD, GDC and LDC (and SDC when it becomes more usable) at
> asm.dlang.org. (Btw a nice choice of name :) )
>
> I have a couple of questions about the output when looking at a C++[1] program and the same in GDC[2] and DMD[3](I am not very familiar with assembly):
>
> 1) Syntax:
> AFAIU, (_D)main pushes 3 and 4 to the stack and calls (example.)add. Then
> (example.)add loads them from the stack in two registers and adds them.
> IIRC, dmd passes parameters in reverse order (of the normal C way) and
> that's why pushing and loading 3 and 4 from the stack is in reverse order.
>

That is correct

> However why does DMD use hex instead of decimal notation?
> [I was also a little confused about positive vs negative indexing of bp and
> the order of src and dst in the arguments to movl, but then I noticed that I
> am comparing x86 and x86_64, so I managed to answer those questions myself
> :D ]

Because GCC and GDC dumps are raw assembly.  Whereas with DMD I had to disassemble from object code (using obbjdump).  This is an implementation detail really of how DMD works vs GCC backend.


>
> 2) _Dmain:
> I also noticed that the output of gdc-4.4 and gdc-4.6 does not include a
> label for _Dmain (nor the regular C main). Is this a problem of the
> disassembly, or just how older version of GDC produced code?
>

GCC-Explorer thinks _Dmain is a label, and sees that it is unused (not called from anywhere).  So it removes it.  In later versions of GDC, a C main function is included in the compilation, and so now references _Dmain.

I guess this is a bug in GCC Explorer itself that will need to be addressed somehow.


Iain.
January 27, 2015
On 1/26/15 3:46 PM, Iain Buclaw wrote:
> Hi,
>
> It is my pleasure to release a new site onto the community.  An
> Interactive DMD compiler.
>
> http://asm.dlang.org/

Someone found it: https://www.reddit.com/r/programming/comments/2tukc6/online_disassembler_for_d_paste_code_see/

Andrei

January 28, 2015
On Tuesday, 27 January 2015 at 13:05:08 UTC, Iain Buclaw wrote:
> ...

Thank you for the informative reply.
February 02, 2015
On Monday, 26 January 2015 at 23:46:24 UTC, Iain Buclaw wrote:
> All work is hosted on Github[3], and we are planning on moving it to part of the D-Programming-Language repositories.

I really wish we would eat our own dog food and use D for these projects. Nazriel's dpaste is in friggin PHP and this one is in JavaScript... we've been emphasizing D on the web yet we don't have many real examples of it in practice.

Oh well, I guess at least this project has the excuse that it's mostly client-side... but I still think it's a lost opportunity.