[Allocator] Switch the BumpPtrAllocator to use a vector of pointers to
authorChandler Carruth <chandlerc@gmail.com>
Mon, 14 Apr 2014 03:55:11 +0000 (03:55 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 14 Apr 2014 03:55:11 +0000 (03:55 +0000)
commitcb7ead25c29b8897435e466d785ec766adc7afe5
treec0528c73a738197625b0d581c0081f303e474975
parent1b1e4e27e146ff4969767d32184ebb28b0bb3514
[Allocator] Switch the BumpPtrAllocator to use a vector of pointers to
slabs rather than embedding a singly linked list in the slabs
themselves. This has a few advantages:

- Better utilization of the slab's memory by not wasting 16-bytes at the
  front.
- Simpler allocation strategy by not having a struct packed at the
  front.
- Avoids paging every allocated slab in just to traverse them for
  deallocating or dumping stats.

The latter is the really nice part. Folks have complained from time to
time bitterly that tearing down a BumpPtrAllocator, even if it doesn't
run any destructors, pages in all of the memory allocated. Now it won't.
=]

Also resolves a FIXME with the scaling of the slab sizes. The scaling
now disregards specially sized slabs for allocations larger than the
threshold.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206147 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Allocator.h
lib/ExecutionEngine/JIT/JITMemoryManager.cpp
lib/Support/Allocator.cpp
unittests/Support/AllocatorTest.cpp