mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-07 11:26:02 +03:00
Revert templates to old behavior.
While emitting a template instantiation only once is good for compile times and binary sizes, it doesn't work with linkonce linkage as inlined function bodies could be discarded. Since we don't want to inhibit inlining, templates are reverted to the previous behavior, where an instantiation is emitted for each module using it. In the future, a custom inlining pass may allow us to switch back to common/weak linkage and reenable smart template instance emission.
This commit is contained in:
parent
789eefd943
commit
a4ca550874
2 changed files with 7 additions and 2 deletions
|
@ -1557,13 +1557,14 @@ void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, s
|
|||
|
||||
bool mustDefineSymbol(Dsymbol* s)
|
||||
{
|
||||
#if 0
|
||||
#if 1
|
||||
return s->getModule() == gIR->dmodule || DtoIsTemplateInstance(s) != NULL;
|
||||
#else
|
||||
Module* M = DtoIsTemplateInstance(s);
|
||||
// if it's a template instance, check the instantiating module
|
||||
// not the module that defines the template
|
||||
if (M) {
|
||||
//Logger::println("TINST %s from %s cur %s", s->toPrettyChars(), M->toChars(), gIR->dmodule->toChars());
|
||||
return M == gIR->dmodule;
|
||||
}
|
||||
return s->getCompilationModule() == gIR->dmodule;
|
||||
|
@ -1574,7 +1575,7 @@ bool mustDefineSymbol(Dsymbol* s)
|
|||
|
||||
bool needsTemplateLinkage(Dsymbol* s)
|
||||
{
|
||||
#if 0
|
||||
#if 1
|
||||
return DtoIsTemplateInstance(s) != NULL;
|
||||
#else
|
||||
Module* M = DtoIsTemplateInstance(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue