diff options
| author | Duncan Sands <baldrick@free.fr> | 2010-10-21 08:57:29 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2010-10-21 08:57:29 +0000 |
| commit | abc7901e4e74e5561d4a7a31fc8af05d0c73b6a3 (patch) | |
| tree | a149bdbd8456661abc280e79ed88753ed55e7dd0 /llvm/lib/ExecutionEngine | |
| parent | 54bf3c3cfb1f5d73dd91055f377b10404789a408 (diff) | |
| download | bcm5719-llvm-abc7901e4e74e5561d4a7a31fc8af05d0c73b6a3.tar.gz bcm5719-llvm-abc7901e4e74e5561d4a7a31fc8af05d0c73b6a3.zip | |
Fix the cleanup process of exception information in JIT. Now JIT
deregisters registered by it FDE structures allowing consecutive
JIT runs to succeed. Patch by Yuri. Fixes PR8285.
llvm-svn: 117004
Diffstat (limited to 'llvm/lib/ExecutionEngine')
| -rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 16 | ||||
| -rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.cpp | 6 |
2 files changed, 19 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index be7f1f56a95..77082c4d041 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -47,12 +47,12 @@ ExecutionEngine *(*ExecutionEngine::JITCtor)( const SmallVectorImpl<std::string>& MAttrs) = 0; ExecutionEngine *(*ExecutionEngine::InterpCtor)(Module *M, std::string *ErrorStr) = 0; -ExecutionEngine::EERegisterFn ExecutionEngine::ExceptionTableRegister = 0; - ExecutionEngine::ExecutionEngine(Module *M) : EEState(*this), - LazyFunctionCreator(0) { + LazyFunctionCreator(0), + ExceptionTableRegister(0), + ExceptionTableDeregister(0) { CompilingLazily = false; GVCompilationDisabled = false; SymbolSearchingDisabled = false; @@ -66,6 +66,16 @@ ExecutionEngine::~ExecutionEngine() { delete Modules[i]; } +void ExecutionEngine::DeregisterAllTables() { + if (ExceptionTableDeregister) { + std::vector<void*>::iterator it = AllExceptionTables.begin(); + std::vector<void*>::iterator ite = AllExceptionTables.end(); + for (; it != ite; ++it) + ExceptionTableDeregister(*it); + AllExceptionTables.clear(); + } +} + namespace { // This class automatically deletes the memory block when the GlobalVariable is // destroyed. diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index 63125b79c8e..8104ab995a4 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp @@ -87,6 +87,7 @@ extern "C" void LLVMLinkInJIT() { // values of an opaque key, used by libgcc to find dwarf tables. extern "C" void __register_frame(void*); +extern "C" void __deregister_frame(void*); #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 # define USE_KEYMGR 1 @@ -318,8 +319,10 @@ JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji, LOI = (LibgccObjectInfo*)calloc(sizeof(struct LibgccObjectInfo), 1); _keymgr_set_and_unlock_processwide_ptr(KEYMGR_GCC3_DW2_OBJ_LIST, LOI); InstallExceptionTableRegister(DarwinRegisterFrame); + // Not sure about how to deregister on Darwin. #else InstallExceptionTableRegister(__register_frame); + InstallExceptionTableDeregister(__deregister_frame); #endif // __APPLE__ #endif // __GNUC__ @@ -328,6 +331,9 @@ JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji, } JIT::~JIT() { + // Unregister all exception tables registered by this JIT. + DeregisterAllTables(); + // Cleanup. AllJits->Remove(this); delete jitstate; delete JCE; |

