Need clarification on dmd symbol generation

Dicebot m.strashun at gmail.com
Fri Apr 5 13:35:10 PDT 2013


On Thursday, 4 April 2013 at 19:34:06 UTC, Dicebot wrote:
> I am currently investigating 
> http://d.puremagic.com/issues/show_bug.cgi?id=9571 and after 
> brief exploration of symbols emitted to object file as well as 
> code that emits them I can't rid of an idea that I am missing 
> something about module system.
>
> Why does dmd emits horde of symbols from imported modules into 
> object files, most of whose are not actually used in this one? 
> No "-inline" used and I kind of expected to see there only 
> directly called function and symbols from their signatures.
>
> What does actually happen here?

Okay, after some digging on the topic I am quite sure that DMD 
does add instantiated template symbols from imported modules to 
root module symbol list (template.c:5023). It does not care if 
root module was actually one to start template instantiation 
chain (and thus uses this symbol) and just bloats the symbol 
table.

Repeating initial question - was there rationale for this other 
than being reluctant to store additional context information 
about initial template chain instantiation scope?

I'd like to make a pull request for this and make one step closer 
to making separate compilation reality but don't want to waste 
time on dmd source code (argh) without real need, thus 
preliminary question.


More information about the Digitalmars-d mailing list