mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
[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. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user