[PATCH] BumpPtr allocate SimpleReferences

kledzik at apple.com kledzik at apple.com
Wed Dec 3 19:08:15 PST 2014


Even if you add a std::vector<std::unique_ptr<Reference>> to lld::File (so the SimpleReferences are deleted when the File is deleted), you still need a std::vector<SimpleReference*> in each SimpleDefineAtom to track which references are used by that atom.  And the allocations for that vector would be leaked if the Atom is BumpPtr allocated.

References are not that big and are never removed.  The current std::vector<SimpleReference> in SimpleDefinedAtom does a lot of copying as references are added.  This is a good use case for BumpPtr allocation.  

The only other sane thing to do is never BumpPtr allocate Simple Atoms.  But that is sad because BumpPtr allocation is an efficient way to create atoms while parsing a file.

http://reviews.llvm.org/D6518






More information about the llvm-commits mailing list