www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - run.dlang.io can now display ASM + AST + IR

reply Seb <seb wilzba.ch> writes:
It was bad weather in Munich on Saturday, so run.dlang.io got a 
couple of new cool features:

1) Assembly output

https://run.dlang.io/is/qtk8Wq

However, if you are seriously interested in looking at the ASM 
output, I recommend https://d.godbolt.org for LDC and GDC.

2) AST of DMD frontend (after semantic analysis)

https://run.dlang.io/is/TAHzMZ

Permanent: `-vcg-ast`

3) IR (LDC only)

https://run.dlang.io/is/BOTNDf

Might come to DMD, see https://github.com/dlang/dmd/pull/4972

4) Permanent flags

In case you want to share a link to someone and they should 
immediately see this, simply add the respective flag:

ASM: -asm (DMD) | -output-s (LDC)
AST: -vcg-ast
IR: -output-ll (LDC)

run.dlang.io is smart enough to display the resulting file.

5) Stores the latest source file in the persistent localStorage 
of your browser
6) Small UI updates

Any ideas?
-> https://github.com/dlang-tour/core/issues/new

Don't like the UI?
-> https://github.com/dlang-tour/core/blob/master/views/editor.dt
Jan 13
next sibling parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 It was bad weather in Munich on Saturday, so run.dlang.io got a 
 couple of new cool features:
Very cool, thanks!
Jan 14
prev sibling next sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 It was bad weather in Munich on Saturday, so run.dlang.io got a 
 couple of new cool features:

 1) Assembly output
...
 2) AST of DMD frontend (after semantic analysis)
...
 3) IR (LDC only)
...
 4) Permanent flags
 5) Stores the latest source file in the persistent localStorage 
 of your browser
 6) Small UI updates
Yes! Very cool!
Jan 15
prev sibling next sibling parent reply kinke <noone nowhere.com> writes:
On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 3) IR (LDC only)

 https://run.dlang.io/is/BOTNDf
Thanks Seb. I particularly like this feature. After a quick glance, the debuginfos (-g) seem to be needlessly enforced, bloating the IR. A colored output would be a nice improvement; there's a plugin for the google-code-prettify JS library [1], which wouldn't increase the server load. Maybe there's one for asm too. [1] https://gist.github.com/ndabas/2850418
Jan 15
parent reply Seb <seb wilzba.ch> writes:
On Monday, 15 January 2018 at 22:50:55 UTC, kinke wrote:
 On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 3) IR (LDC only)

 https://run.dlang.io/is/BOTNDf
Thanks Seb. I particularly like this feature. After a quick glance, the debuginfos (-g) seem to be needlessly enforced, bloating the IR. A colored output would be a nice improvement; there's a plugin for the google-code-prettify JS library [1], which wouldn't increase the server load. Maybe there's one for asm too. [1] https://gist.github.com/ndabas/2850418
Easy enough: https://github.com/dlang-tour/core-exec/pull/18 I also added syntax coloring for LLVM IR, Assembly and D's AST dump: https://github.com/dlang-tour/core/pull/643 Anything else that would help you?
Jan 25
parent reply ikod <geller.garry gmail.com> writes:
On Thursday, 25 January 2018 at 19:22:19 UTC, Seb wrote:
 On Monday, 15 January 2018 at 22:50:55 UTC, kinke wrote:
 On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 3) IR (LDC only)

 https://run.dlang.io/is/BOTNDf
Thanks Seb. I particularly like this feature. After a quick glance, the debuginfos (-g) seem to be needlessly enforced, bloating the IR. A colored output would be a nice improvement; there's a plugin for the google-code-prettify JS library [1], which wouldn't increase the server load. Maybe there's one for asm too. [1] https://gist.github.com/ndabas/2850418
Easy enough: https://github.com/dlang-tour/core-exec/pull/18 I also added syntax coloring for LLVM IR, Assembly and D's AST dump: https://github.com/dlang-tour/core/pull/643 Anything else that would help you?
Is it possible to show demangled names in asm output (or this option already available)?
Jan 25
parent reply Seb <seb wilzba.ch> writes:
On Thursday, 25 January 2018 at 19:44:13 UTC, ikod wrote:
 Is it possible to show demangled names in asm output (or this 
 option already available)?
Sure: https://github.com/dlang-tour/core-exec/pull/19 Preview e.g. here: https://run.dlang.io/is/Vehrcv Note that core.demangle isn't perfect, e.g: "_D23TypeInfo_E3foo8a_symbol6__initZ".demangle.writeln; // TypeInfo_E3foo8a_symbol.__init https://run.dlang.io/is/SLBQy7 Anything else? ---- While I was at it, I also did the following: 1) I also added support for previewing dmd's Ddoc output. Just add -D and the HTML will be displayed, e.g. https://run.dlang.io/is/o16YDm https://github.com/dlang-tour/core/pull/645 2) And lastly I fixed the regression tester which allows running a sample against all compilers since 2.060, e.g. https://run.dlang.io/is/SqON2p It now also accepts arguments. This is important because adding `-c` will make it run a lot faster if you don't need to compare the output of a program over multiple versions.
Jan 26
parent reply Justin Whear <mrjnewt gmail.com> writes:
Very cool features!  Due to template expansion, even very simple 
D programs won't display their AST, e.g. 
https://run.dlang.io/is/yVsPsH gives me a "Compilation or running 
program took longer than 25 seconds. Aborted!"  Not sure what can 
be done about this, but it certainly limits the usefulness for 
now.
Jan 26
parent reply Seb <seb wilzba.ch> writes:
On Friday, 26 January 2018 at 18:29:28 UTC, Justin Whear wrote:
 Very cool features!  Due to template expansion, even very 
 simple D programs won't display their AST, e.g. 
 https://run.dlang.io/is/yVsPsH gives me a "Compilation or 
 running program took longer than 25 seconds. Aborted!"  Not 
 sure what can be done about this, but it certainly limits the 
 usefulness for now.
That actually wasn't due to template expansion (to be fair it's a huge file, but , but a problem of the tour / run.dlang.io code. The pipe buffer went full and thus the program (aka docker container) never continued its execution. https://github.com/dlang-tour/core/pull/649 It's fixed now. I have also increased the maximal output limit to 500.000 bytes - I hope that's enough for everyone :O
Jan 26
parent reply Mike Franklin <slavo5150 yahoo.com> writes:
On Saturday, 27 January 2018 at 01:31:45 UTC, Seb wrote:

 https://github.com/dlang-tour/core/pull/649

 It's fixed now. I have also increased the maximal output limit 
 to 500.000 bytes - I hope that's enough for everyone :O
Seb, you're awesome! Thanks for all these great features. Mike
Jan 26
parent reply Seb <seb wilzba.ch> writes:
On Saturday, 27 January 2018 at 02:33:19 UTC, Mike Franklin wrote:
 On Saturday, 27 January 2018 at 01:31:45 UTC, Seb wrote:

 https://github.com/dlang-tour/core/pull/649

 It's fixed now. I have also increased the maximal output limit 
 to 500.000 bytes - I hope that's enough for everyone :O
Seb, you're awesome! Thanks for all these great features. Mike
You are very welcome. I have an additional bonus feature for all the power users out there: CTRL+Enter -> run CTRL+R -> reset CTRL+S -> shorten (+uses dirty JS workaround to copy the URL to your clipboard) ALT+F -> format (I didn't want to overload the CTRL+F shortcut as it might be useful to people) I hope that covers it for everyone. Otherwise please open an issue (https://github.com/dlang-tour/core/issues/new) or PR.
Jan 28
parent reply Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Sunday, 28 January 2018 at 17:06:36 UTC, Seb wrote:
 CTRL+Enter -> run
Thanks for reading my mind! You people are awesome.
Jan 28
parent reply Seb <seb wilzba.ch> writes:
On Sunday, 28 January 2018 at 22:49:35 UTC, Bastiaan Veelo wrote:
 On Sunday, 28 January 2018 at 17:06:36 UTC, Seb wrote:
 CTRL+Enter -> run
Thanks for reading my mind! You people are awesome.
Anything else on your mind? It's getting harder to read. For large display, I added two more buttons: -X (JSON) and -D (Ddoc output) As usual, you can you also add the flags directly in the toolbar: https://run.dlang.io/is/8nLYZS (JSON) https://run.dlang.io/is/H15Ynh (Ddoc) I also updated the supported libraries, e.g. emsi_containers or mir-random are new additions: https://run.dlang.io/is/vSUTf6 The DUB libraries are now also updated automatically every day. Oh and it's now integrated with e.g. the mir documentation too: http://docs.algorithm.dlang.io/latest/mir_ndslice_algorithm.html
Feb 06
next sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Wednesday, 7 February 2018 at 01:15:14 UTC, Seb wrote:
 [snip]
 https://run.dlang.io/is/vSUTf6

 The DUB libraries are now also updated automatically every day.
 Oh and it's now integrated with e.g. the mir documentation too:

 http://docs.algorithm.dlang.io/latest/mir_ndslice_algorithm.html
I was pretty excited to see those PRs, but I hadn't had a chance to play with it.
Feb 06
prev sibling parent reply Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Wednesday, 7 February 2018 at 01:15:14 UTC, Seb wrote:
 https://run.dlang.io/is/vSUTf6
Press [Run] and it shows "42". OK Press [-X] and it shows "42". ?? Press [-D] and it shows "42". ??
Feb 07
next sibling parent Petar Kirov [ZombineDev] <petar.p.kirov gmail.com> writes:
On Wednesday, 7 February 2018 at 12:17:11 UTC, Bastiaan Veelo 
wrote:
 On Wednesday, 7 February 2018 at 01:15:14 UTC, Seb wrote:
 https://run.dlang.io/is/vSUTf6
Press [Run] and it shows "42". OK Press [-X] and it shows "42". ?? Press [-D] and it shows "42". ??
I think I recently bumped into the same issue: https://github.com/dlang-tour/core/issues/668. Should be relatively simple to fix.
Feb 07
prev sibling parent Seb <seb wilzba.ch> writes:
On Wednesday, 7 February 2018 at 12:17:11 UTC, Bastiaan Veelo 
wrote:
 On Wednesday, 7 February 2018 at 01:15:14 UTC, Seb wrote:
 https://run.dlang.io/is/vSUTf6
Press [Run] and it shows "42". OK Press [-X] and it shows "42". ?? Press [-D] and it shows "42". ??
These options aren't supported for DUB packages (yet). I will hide them from the UI for now if a DUB package has been selected.
Feb 07
prev sibling parent reply Kirr <kkryukov gmail.com> writes:
On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 1) Assembly output
This is great, thanks for this tool! Does it support using DMD's optimizer (-O)? I'd like to check ASM output of Bug 16189 with different compilers.
Feb 06
parent Seb <seb wilzba.ch> writes:
On Wednesday, 7 February 2018 at 02:20:37 UTC, Kirr wrote:
 On Sunday, 14 January 2018 at 04:18:41 UTC, Seb wrote:
 1) Assembly output
This is great, thanks for this tool! Does it support using DMD's optimizer (-O)? I'd like to check ASM output of Bug 16189 with different compilers.
Yes, all CLI flags are supported. -asm for DMD is the only virtual one because DMD doesn't support it out of the box (LDC supports -output-s), though to be fair DMD ships with obj2asm and ddemangle, so -asm is a trivial mapping to something like: dmd -c "${args}[ ]}" obj2asm onlineapp.o | ddemangle Also I recommend using -betterC when looking at the assembly as it won't generate a ModuleInfo and thus will lead to a shorter output. Examples: https://run.dlang.io/is/dawnVy (add -inline here) https://run.dlang.io/is/hDWDlI (add -O here)
Feb 07