mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206267 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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<sys::MemoryBlock> CodeSlabs;
|
||||
BumpPtrAllocatorImpl<JITSlabAllocator, DefaultSlabSize,
|
||||
BumpPtrAllocatorImpl<JITAllocator, DefaultSlabSize,
|
||||
DefaultSizeThreshold> StubAllocator;
|
||||
BumpPtrAllocatorImpl<JITSlabAllocator, DefaultSlabSize,
|
||||
BumpPtrAllocatorImpl<JITAllocator, DefaultSlabSize,
|
||||
DefaultSizeThreshold> 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user