Core: Use ilist_full_embedded_sentinel_traits for SimpleReference
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 12 Aug 2016 16:19:34 +0000 (16:19 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 12 Aug 2016 16:19:34 +0000 (16:19 +0000)
commit4a1e87d9c6c62a3c08982193ccec0540487b0156
tree4ae657b0ca995b668236eed12683084afe454992
parent87e4038a9154cb4b79a3dc19fe096bd8bdc8801e
Core: Use ilist_full_embedded_sentinel_traits for SimpleReference

Avoid custom code for sentinel traits in SimpleReference (the ilist node
for references to a SimpleDefinedAtom), since they'll soon/eventually
disappear from ilist entirely.

Rather than using a BumpPtrAllocator, this drops the lazy sentinel
characteristics and stores the sentinel directly in the ilist.  This
unconditionally allocates the sentinel.

At first glance, this looks like it might increase memory usage
slightly, since an unreferenced SimpleDefinedAtom pays for a
6-pointer-sized sentinel even when its list of references is empty.  In
practice, the sentinel was being lazily allocated at the first call to
DefinedAtom::begin/end anyway.  I don't expect any real memory effects
here.

Moreover, this is an intermediate state.  The ilist_*sentinel_traits are
being phased out.

As a preview of the final state: in lieu of a NodeTy sentinel, the ilist
will have a single, untemplated list_node_base that has next/prev
pointers.  This base node will serve both as a sentinel and as a pointer
to the head of the list (the same memory layout as
ilist_half_embedded_sentinel_traits, but without the UB).

llvm-svn: 278521
lld/include/lld/Core/Simple.h