Mercurial > projects > ldc
comparison dmd/template.c @ 948:780530d1cad3
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.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 08 Feb 2009 21:44:46 +0100 |
parents | 1714836f2c0b |
children | 7ce8355fbcc6 |
comparison
equal
deleted
inserted
replaced
947:9a10fa839dc5 | 948:780530d1cad3 |
---|---|
2871 this->withsym = NULL; | 2871 this->withsym = NULL; |
2872 this->nest = 0; | 2872 this->nest = 0; |
2873 this->havetempdecl = 0; | 2873 this->havetempdecl = 0; |
2874 this->isnested = NULL; | 2874 this->isnested = NULL; |
2875 this->errors = 0; | 2875 this->errors = 0; |
2876 | |
2877 // LDC | |
2876 this->tinst = NULL; | 2878 this->tinst = NULL; |
2879 this->tmodule = NULL; | |
2877 } | 2880 } |
2878 | 2881 |
2879 /***************** | 2882 /***************** |
2880 * This constructor is only called when we figured out which function | 2883 * This constructor is only called when we figured out which function |
2881 * template to instantiate. | 2884 * template to instantiate. |
2986 // get the module of the outermost enclosing instantiation | 2989 // get the module of the outermost enclosing instantiation |
2987 if (tinst) | 2990 if (tinst) |
2988 tmodule = tinst->tmodule; | 2991 tmodule = tinst->tmodule; |
2989 else | 2992 else |
2990 tmodule = sc->module; | 2993 tmodule = sc->module; |
2994 //printf("%s in %s\n", toChars(), tmodule->toChars()); | |
2991 | 2995 |
2992 #if LOG | 2996 #if LOG |
2993 printf("\tdo semantic\n"); | 2997 printf("\tdo semantic\n"); |
2994 #endif | 2998 #endif |
2995 if (havetempdecl) | 2999 if (havetempdecl) |