Another compile-time perversion. Or not?

Walter Bright newshound at digitalmars.com
Thu Aug 31 09:53:06 PDT 2006


Don Clugston wrote:
> Walter Bright wrote:
>> Ivan Senji wrote:
>>> Actually dmd produces one more line:
>>> Internal error: ..\ztc\cgobj.c 395
>>> but that isn't a part of the fractal.
>>
>> That is caused by the compiler writing all the const values out to the 
>> object file, and overflowing the counters in the object module format 
>> because there are so many. Unfortunately, it isn't fixable, it's an 
>> artifact of the format.
>>
>> The slowness is also caused by the generation of stupendous object files.
> 
> Why do all of the const values need to be written to object file? I 
> would expect that once a template has been constant folded, it should be 
> possible to discard that reference to it. If it is not used elsewhere, 
> it shouldn't need to be included at all.

There's a bit of chicken and egg problem with it - can't tell if it's 
referenced or not until code generation, which is intimately wrapped up 
with object file generation.

> As I understand it, the use of modules makes the situation fundamentally 
> different to C++, where an entirely different file could define a 
> specialisation of the template -- in C++, the linker has a lot of work 
> to do.
> Have I missed something?



More information about the Digitalmars-d-announce mailing list