| Thread overview | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 07, 2022 DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Compile with -vasm to see it! Enjoy!
For the file test.d:
int demo(int x)
{
return x * x;
}
Compiling with:
dmd test.d -c -vasm
prints:
_D4test4demoFiZi:
0000: 89 F8 mov EAX,EDI
0002: 0F AF C0 imul EAX,EAX
0005: C3 ret
https://github.com/dlang/dmd/pull/13447
| ||||
January 07, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
Oh very nice! I need to finish my debugger/disassembler project.
| |||
January 07, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
>
> For the file test.d:
>
> int demo(int x)
> {
> return x * x;
> }
>
> Compiling with:
>
> dmd test.d -c -vasm
>
> prints:
>
> _D4test4demoFiZi:
> 0000: 89 F8 mov EAX,EDI
> 0002: 0F AF C0 imul EAX,EAX
> 0005: C3 ret
>
>
> https://github.com/dlang/dmd/pull/13447
Wow, very useful! This feature surely lowers the bar to check the disassembly when optimising. Thanks!
I'm slightly disappointed it does not output the asm inlined to D code but that's just my daydreaming with no practical reasons to back it up.
| |||
January 08, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> 0000: 89 F8 mov EAX,EDI
Feature request: octal.
| |||
January 08, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
>
> For the file test.d:
>
> int demo(int x)
> {
> return x * x;
> }
>
> Compiling with:
>
> dmd test.d -c -vasm
>
> prints:
>
> _D4test4demoFiZi:
> 0000: 89 F8 mov EAX,EDI
> 0002: 0F AF C0 imul EAX,EAX
> 0005: C3 ret
>
>
> https://github.com/dlang/dmd/pull/13447
Thanks Walter. This is quite useful. Will put it through its paces. Already spotted some print formatting weirdness; will send as bug reports.
~Brian
| |||
January 08, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 07.01.22 22:41, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
With feature creep in full swing now, when can I expect to read my email with DMD?
| |||
January 07, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Sat, Jan 08, 2022 at 07:39:54AM +0100, ag0aep6g via Digitalmars-d-announce wrote: > On 07.01.22 22:41, Walter Bright wrote: > > Compile with -vasm to see it! Enjoy! > > With feature creep in full swing now, when can I expect to read my email with DMD? You already can: echo 'import std;void main(){execute("/usr/bin/mail");}' | dmd -run - :-P T -- "Real programmers can write assembly code in any language. :-)" -- Larry Wall | |||
January 08, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
>
> For the file test.d:
>
> int demo(int x)
> {
> return x * x;
> }
>
> Compiling with:
>
> dmd test.d -c -vasm
>
> prints:
>
> _D4test4demoFiZi:
> 0000: 89 F8 mov EAX,EDI
> 0002: 0F AF C0 imul EAX,EAX
> 0005: C3 ret
>
>
> https://github.com/dlang/dmd/pull/13447
Nice!
| |||
January 08, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
>
> For the file test.d:
>
> int demo(int x)
> {
> return x * x;
> }
>
> Compiling with:
>
> dmd test.d -c -vasm
>
> prints:
>
> _D4test4demoFiZi:
> 0000: 89 F8 mov EAX,EDI
> 0002: 0F AF C0 imul EAX,EAX
> 0005: C3 ret
>
>
> https://github.com/dlang/dmd/pull/13447
Great news, this worth a hn / reddit post!
Kind regards
Andre
| |||
January 08, 2022 Re: DMD now incorporates a disassembler | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 7 January 2022 at 21:41:55 UTC, Walter Bright wrote:
> Compile with -vasm to see it! Enjoy!
>
> [snip]
Would make a nice project for someone to integrate this into run.dlang.org
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply