]> granicus.if.org Git - clang/commit
[ptr-traits] Switch from a really wasteful SmallDenseMap of
authorChandler Carruth <chandlerc@gmail.com>
Wed, 30 Dec 2015 03:00:23 +0000 (03:00 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 30 Dec 2015 03:00:23 +0000 (03:00 +0000)
commit7758708fb87e065dc1851bfa8906e5611daca238
tree454df0c56bba2a052a2f889c60c1751354c11525
parent430fa3f40afecf03bc5af967139d4eb476770ed8
[ptr-traits] Switch from a really wasteful SmallDenseMap of
SmallVector<.., 16> (16!!!!) objects to a simple SmallVector of pairs.

This no longer de-duplicates the common function pointers used during
deallocation, but this doesn't really seem worth the complexity and
overhead of managing the map-of-vectors. Notably, there is no reason to
assume that functions have the 4-byte alignment that DenseMap relies on,
and indeed this prevents checking the alignment of the DenseMap keys
because we can't even meaningfully query the alignment of functions
using our existing alignment tools.

Generally, function pointers don't seem like a great idea for keys in
a DenseMap. =]

I chatted with Richard Smith about this a bit as well and have written
down a FIXME because this *does* waste some memory and in general seems
a very clumsy memory management strategy. He would like to see a more
fundamental fix eventually here that tries to build a better pattern.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256610 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp