Remaining Travis merge-2.064 failure

Christian Kamm via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon Jun 9 09:28:11 PDT 2014


On 09.06.2014 13:09, David Nadlinger via digitalmars-d-ldc wrote:
> On 9 Jun 2014, at 10:44, Christian Kamm via digitalmars-d-ldc wrote:
>> I think the comment in there (functions.cpp:922) is wrong. The frontend
>> seems to try hard to make sure instantiatingModule is a non-root module
>> if possible. That should mean LDC is not emitting templates that have a
>> non-root module instantiating them somewhere.
> 
> This logic was adapted from what I gathered from discussions when 2.064
> (I think) came out. If you look at FuncDeclaration::toObjFile in DMD
> 2.064.2, you'll see that it uses the same logic to determine whether to
> emit a certain symbol.

Yes, I saw. I just think the comment is misleading: it says
"Skip generating code if this part of a TemplateInstance that is
instantiated only by non-root modules"
but actually it seems to skip instances that have any non-root module
instantiating them. I'll make a pull request to fix it.


>> The idea probably is that you shouldn't need to emit functions again if
>> they were already emitted into a library you import and link. (if that's
>> desired, the correct fix is probably to require -lcurl when linking
>> phobos...)
> 
> The idea is instead that functions that are already part of an *object
> file* you need to link anyway should not be emitted again. This is a
> sound design, as long as you only omit template instances that you know
> are already required by somebody else in your dependency graph (ignoring
> cycles for the moment).

Okay. Aside: how does it deal with cycles? Wouldn't no instance be
emitted if two modules both instantiate the same function and include
each other? (in practice both were emitted for me)


> Thinking about this a bit, it seems very plausible that the compiler
> actually works as intended here.

Agreed.

In dmd's libphobos2, array_10f_5e7.o and array_187_86f.o use the symbol
while only object_5_50d.o defines it. Why doesn't dmd's stdio use it?


Regards,
Christian


More information about the digitalmars-d-ldc mailing list