Move the Function*->allocated blocks map from the JITMemoryManager to the

JITEmitter.

I'm gradually making Functions auto-remove themselves from the JIT when they're
destroyed. In this case, the Function needs to be removed from the JITEmitter,
but the map recording which Functions need to be removed lived behind the
JITMemoryManager interface, which made things difficult.

This patch replaces the deallocateMemForFunction(Function*) method with a pair
of methods deallocateFunctionBody(void *) and deallocateExceptionTable(void *)
corresponding to the two startFoo/endFoo pairs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeffrey Yasskin
2009-10-20 18:13:21 +00:00
parent f7a0c0de6d
commit 1e86132122
4 changed files with 90 additions and 85 deletions
@@ -132,9 +132,11 @@ public:
///
virtual uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) = 0;
/// deallocateMemForFunction - Free JIT memory for the specified function.
/// This is never called when the JIT is currently emitting a function.
virtual void deallocateMemForFunction(const Function *F) = 0;
/// deallocateFunctionBody - Free the specified function body. The argument
/// must be the return value from a call to startFunctionBody() that hasn't
/// been deallocated yet. This is never called when the JIT is currently
/// emitting a function.
virtual void deallocateFunctionBody(void *Body) = 0;
/// startExceptionTable - When we finished JITing the function, if exception
/// handling is set, we emit the exception table.
@@ -146,6 +148,12 @@ public:
virtual void endExceptionTable(const Function *F, uint8_t *TableStart,
uint8_t *TableEnd, uint8_t* FrameRegister) = 0;
/// deallocateExceptionTable - Free the specified exception table's memory.
/// The argument must be the return value from a call to startExceptionTable()
/// that hasn't been deallocated yet. This is never called when the JIT is
/// currently emitting an exception table.
virtual void deallocateExceptionTable(void *ET) = 0;
/// CheckInvariants - For testing only. Return true if all internal
/// invariants are preserved, or return false and set ErrorStr to a helpful
/// error message.