From 785a9228b678e3a4817fb9832c6b4060fbac3f46 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 15 Apr 2014 09:44:09 +0000 Subject: [Allocator] Finally, finish nuking the redundant code that led me here by removing the MallocSlabAllocator entirely and just using MallocAllocator directly. This makes all off these allocators expose and utilize the same core interface. The only ugly part of this is that it exposes the fact that the JIT allocator has no real handling of alignment, any more than the malloc allocator does. =/ It would be nice to fix both of these to support alignments, and then to leverage that in the BumpPtrAllocator to do less over allocation in order to manually align pointers. But, that's another patch for another day. This patch has no functional impact, it just removes the somewhat meaningless wrapper around MallocAllocator. llvm-svn: 206267 --- llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp') diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index 1aadcce2664..acd034b83e6 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -269,11 +269,11 @@ namespace { class DefaultJITMemoryManager; - class JITSlabAllocator { + class JITAllocator { DefaultJITMemoryManager &JMM; public: - JITSlabAllocator(DefaultJITMemoryManager &jmm) : JMM(jmm) { } - void *Allocate(size_t Size); + JITAllocator(DefaultJITMemoryManager &jmm) : JMM(jmm) { } + void *Allocate(size_t Size, size_t /*Alignment*/); void Deallocate(void *Slab, size_t Size); }; @@ -312,9 +312,9 @@ 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 CodeSlabs; - BumpPtrAllocatorImpl StubAllocator; - BumpPtrAllocatorImpl DataAllocator; // Circular list of free blocks. @@ -568,12 +568,12 @@ namespace { }; } -void *JITSlabAllocator::Allocate(size_t Size) { +void *JITAllocator::Allocate(size_t Size, size_t /*Alignment*/) { sys::MemoryBlock B = JMM.allocateNewSlab(Size); return B.base(); } -void JITSlabAllocator::Deallocate(void *Slab, size_t Size) { +void JITAllocator::Deallocate(void *Slab, size_t Size) { sys::MemoryBlock B(Slab, Size); sys::Memory::ReleaseRWX(B); } -- cgit v1.2.3