[PATCH] D41416: [modules] [pch] Do not deserialize all lazy template specializations when looking for one.
Vassil Vassilev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 19 14:55:05 PST 2017
v.g.vassilev created this revision.
v.g.vassilev added reviewers: rsmith, bruno.
Currently, we load all lazy template specializations when we search whether there is a suitable template specialization for a template. This is especially suboptimal with modules. If module `B` specializes a template from module `A` the ASTReader would only read the specialization DeclID. This is observed to be especially pathological when module `B` is stl. However, the template instantiator (almost immediately after) will call `findSpecialization`. In turn, findSpecialization will load all lazy specializations to give an answer.
This patch teaches `findSpecialization` to work with lazy specializations without having to deserialize their full content. It provides along with the DeclID an cross-TU stable ODRHash of the template arguments which is enough to decide if we have already specialization and which are the exact ones (we load all decls with the same hash to avoid potential collisions) to deserialize.
While we make finding a template specialization more memory-efficient we are far from being done. There are still a few places which trigger eager deserialization of template specializations: the places where we require completion of the redeclaration chain.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 18363 bytes
Desc: not available
More information about the cfe-commits