GC.malloc is pure - wat
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 24 09:34:08 PDT 2015
On Friday, 24 April 2015 at 15:29:59 UTC, Marc Schütz wrote:
> auto a = sin(x) * sin(x); // sin() is called only once
Could you give a complete example of when this is done?
Two calls here (ldc2 -c -O):
real grepme(real x) pure
{
import std.math;
auto a = sin(x) * sin(x);
return a;
}
0000000000000000 <_D4test6grepmeFNaeZe>:
0: 48 83 ec 28 sub rsp,0x28
4: db 6c 24 30 fld TBYTE PTR [rsp+0x30]
8: d9 c0 fld st(0)
a: db 7c 24 10 fstp TBYTE PTR [rsp+0x10]
e: db 3c 24 fstp TBYTE PTR [rsp]
11: e8 00 00 00 00 call 16
<_D4test6grepmeFNaeZe+0x16>
16: db 7c 24 1c fstp TBYTE PTR [rsp+0x1c]
1a: db 6c 24 10 fld TBYTE PTR [rsp+0x10]
1e: db 3c 24 fstp TBYTE PTR [rsp]
21: e8 00 00 00 00 call 26
<_D4test6grepmeFNaeZe+0x26>
26: db 6c 24 1c fld TBYTE PTR [rsp+0x1c]
2a: de c9 fmulp st(1),st
2c: 48 83 c4 28 add rsp,0x28
30: c3 ret
More information about the Digitalmars-d
mailing list