How do I choose the correct primative?

Jake Thomas jake at fake.com
Mon Jan 6 12:08:26 PST 2014


On Sunday, 5 January 2014 at 08:23:45 UTC, TheFlyingFiddle wrote:
> On Sunday, 5 January 2014 at 06:31:38 UTC, Jake Thomas wrote:
>> And got 86,421 lines of assembly!! I expected a load 
>> instruction to load whatever was at loadMe's location into r0 
>> (the return register) and not much else. Maybe 10 lines - tops 
>> - due to compiler fluffiness. I got about 8,641 times that - 
>> over 3 more orders of magnatude. What is going on here?
>
> Well the compiler pulls in at minimum the entire D runtime if 
> i'm not mistaken which make the standard .exe about 350kb.
>
   Ah. Thank you for the explaination.

> Things like Object.factory also pulls in it's fair share due to 
> not being able to remove classes. So we get alot of fluff in 
> small programs.
>
   What do you mean by not being able to remove classes?

   Isn't the whole point of offering a language that has both 
structs, which
   can have functions, and classes to do away with classes when 
inheritence
   isn't needed?

> The module layout of the standard library is also a problem, 
> there is a lot of interconnections between the different 
> modules in Phobos. (will hopefully be better when the modules 
> are broken down into submodules)
>
   I'm a big fan of 99% of D's specification, perhaps less a fan 
of its current implementation.
   But implementations hopefully change over time for the better. 
The hope is to one day simply re-compile the same source with a 
better compiler.
>
> I tested your test program on windows x64 and got the following 
> result:
>
> mov         ebp,esp
> sub         rsp,10h
> mov         eax,dword ptr [rbp-8]
> lea         rsp,[rbp]
> pop         rbp
> ret
>
> //This does a 32 bit load into the eax register (return 
> //register) from the stack.
> mov         eax,dword ptr [rbp-8]
>


What tools and parameters did you use to obtain that dissassembly?

I did not find "dword" anywhere in the dissassembly of my test 
program.

The last place I found eax used was this line:

   27:	2e 33 00             	xor    %cs:(%rax),%eax

Jake


More information about the Digitalmars-d-learn mailing list