[PATCH] BumpPtr allocate SimpleReferences

kledzik at apple.com kledzik at apple.com
Thu Dec 4 14:02:24 PST 2014


Colin's calculation is based on the bumpvector containing only the *pointer* to the Reference. The current implementation has a vector< SimpleReference>, so the wasted space is not just a pointer size (repeatedly doubled).  A SimpleReference is 64 bytes in size, so that value keeps getting doubled (and wasted).

Even if we switched to using a bumpvector for a pointer to reference, we still need to allocate the SimpleReference body somewhere.  

For Atoms and References, the best allocator is a BumpPtr allocator.  Because, 1) Atoms (and References) are owned by their File and ownership never changes, 2) they are never destructed (until the File is destructed).  If either of those was false, then we could not use  BumpPtr.

The reason for this patch is because the current SimpleDefinedAtom has an embedded vector which means SimpleDefinedAtom (and subclasses) cannot be BumpPtr allocated (without leaking).  If we don't want to change SimpleDefinedAtom, I can change MachODefinedATom to not subclass SimpleDefinedAtom.

http://reviews.llvm.org/D6518






More information about the llvm-commits mailing list