[Issue 9922] Improve symbol emitting for templates for better separate compilation support

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 19 17:50:20 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9922



--- Comment #4 from Dicebot <public at dicebot.lv> 2013-07-19 17:50:18 PDT ---
(In reply to comment #3)
> There I mentioned that the correct compiler behavior would be to emit a weak
> template instance to each object file that references that instance.
> This has some performance issues but it only affects separate compilation with
> multiple object files.

Yes, that is my understanding too. However, implementing this may be much
trickier than it sounds because currently DMD front-end does not really track
object files that need to reference instance in any convenient fashion. At
least I could not find a straightforward way.

Another issue is that template instances are re-used and only context of first
usage gets fully saved (again, that is what trial-and-error have shown to me).
We have discussed that briefly in matching (failed) pull request by eskimor.

However, I expect in the end performance to actually improve because those few
extra weak symbols per module object file are minority comparing to all
templates that get used only by constraints and CTFE and can be completely
ignored during symbol emitting. If compiler becomes more aware of actual
template usage (from ABI point of view), some useful optimizations can be done
here.

Are you referring to this "won't fix" issue
http://d.puremagic.com/issues/show_bug.cgi?id=3274 ?

Anyway, I am trying to hack together some proper solution here, to address both
separate compilation and template bloat issues, but it is likely to take hell
of a long time, dmd code in this part is far from obvious.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list