Executable size affected by module count?

Sean Kelly sean at f4.ca
Wed Jan 24 17:48:29 PST 2007


Frits van Bommel wrote:
> Sean Kelly wrote:
>> Thomas Kuehne wrote:
>>> Every non-trivial module contains (numbers are for Linux)
>>> _D5module7__arrayZ
>>> 23 bytes code, 19 bytes stringtab, 18 bytes symtab
>>>
>>> _D5module8__assertFiZv
>>> 24 bytes code, 23 bytes stringtab, 18 bytes symtab
>>
>> These are the outstanding problem for exposing templates from library 
>> code.  And I don't understand why they are generated, since it seems 
>> like the code will be identical for each instance generated.  Couldn't 
>> they just have a static definition in the runtime?
> 
> In their current form they're not identical for each module, for the 
> simple reason that the code (after linking) has the reference to the 
> module name string hardcoded.
> For two extra instructions per call that could be avoided, though at 
> that point you might as well just call _d_assert/_d_arraybounds directly 
> instead of using an intermediary function...

Exactly my point.  Why not define _d_assert and _d_arraybounds somewhere 
and simply call those?  Since, as far as I can tell, the function bodies 
never vary.


Sean



More information about the Digitalmars-d mailing list