diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-14 05:11:27 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-14 05:11:27 +0000 |
commit | eed3466a42bc949be5cffe9431c53176e8615994 (patch) | |
tree | 173bd3c67a0964b0fd44ed8ba505ac35cb03b4f6 /llvm/lib/ExecutionEngine/JIT | |
parent | 6751e2586de3bbaf717891ed8b1f2e4f9392faa5 (diff) | |
download | bcm5719-llvm-eed3466a42bc949be5cffe9431c53176e8615994.tar.gz bcm5719-llvm-eed3466a42bc949be5cffe9431c53176e8615994.zip |
[Allocator] Make the underlying allocator a template instead of an
abstract interface. The only user of this functionality is the JIT
memory manager and it is quite happy to have a custom type here. This
removes a virtual function call and a lot of unnecessary abstraction
from the common case where this is just a *very* thin vaneer around
a call to malloc.
Hopefully still no functionality changed here. =]
llvm-svn: 206149
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT')
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index e5a41eb0536..1aadcce2664 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -269,13 +269,12 @@ namespace { class DefaultJITMemoryManager; - class JITSlabAllocator : public SlabAllocator { + class JITSlabAllocator { DefaultJITMemoryManager &JMM; public: JITSlabAllocator(DefaultJITMemoryManager &jmm) : JMM(jmm) { } - virtual ~JITSlabAllocator() { } - void *Allocate(size_t Size) override; - void Deallocate(void *Slab, size_t Size) override; + void *Allocate(size_t Size); + void Deallocate(void *Slab, size_t Size); }; /// DefaultJITMemoryManager - Manage memory for the JIT code generation. @@ -313,9 +312,10 @@ namespace { // Memory slabs allocated by the JIT. We refer to them as slabs so we don't // confuse them with the blocks of memory described above. std::vector<sys::MemoryBlock> CodeSlabs; - JITSlabAllocator BumpSlabAllocator; - BumpPtrAllocatorImpl<DefaultSlabSize, DefaultSizeThreshold> StubAllocator; - BumpPtrAllocatorImpl<DefaultSlabSize, DefaultSizeThreshold> DataAllocator; + BumpPtrAllocatorImpl<JITSlabAllocator, DefaultSlabSize, + DefaultSizeThreshold> StubAllocator; + BumpPtrAllocatorImpl<JITSlabAllocator, DefaultSlabSize, + DefaultSizeThreshold> DataAllocator; // Circular list of free blocks. FreeRangeHeader *FreeMemoryList; @@ -579,16 +579,13 @@ void JITSlabAllocator::Deallocate(void *Slab, size_t Size) { } DefaultJITMemoryManager::DefaultJITMemoryManager() - : + : #ifdef NDEBUG - PoisonMemory(false), + PoisonMemory(false), #else - PoisonMemory(true), + PoisonMemory(true), #endif - LastSlab(0, 0), - BumpSlabAllocator(*this), - StubAllocator(BumpSlabAllocator), - DataAllocator(BumpSlabAllocator) { + LastSlab(0, 0), StubAllocator(*this), DataAllocator(*this) { // Allocate space for code. sys::MemoryBlock MemBlock = allocateNewSlab(DefaultCodeSlabSize); |