summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-03-04 23:37:39 +0000
committerEric Christopher <echristo@apple.com>2011-03-04 23:37:39 +0000
commit515c67ee77f8d9c417efc0fe04615d269bfb70e4 (patch)
treed726d694ca4f98a852095be1e4af9fcef0bdff67 /include
parentb1939d5db6f95f18c9898861c58d2eac6456f06b (diff)
downloadllvm-515c67ee77f8d9c417efc0fe04615d269bfb70e4.tar.gz
llvm-515c67ee77f8d9c417efc0fe04615d269bfb70e4.tar.bz2
llvm-515c67ee77f8d9c417efc0fe04615d269bfb70e4.tar.xz
Support unregistering exception frames of functions when they are removed.
Patch by Johannes Schaub! Fixes PR8548 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 71698fa008..dcc9743d69 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -21,6 +21,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/ValueMap.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Target/TargetMachine.h"
@@ -161,7 +162,9 @@ protected:
typedef void (*EERegisterFn)(void*);
EERegisterFn ExceptionTableRegister;
EERegisterFn ExceptionTableDeregister;
- std::vector<void*> AllExceptionTables;
+ /// This maps functions to their exception tables frames.
+ DenseMap<const Function*, void*> AllExceptionTables;
+
public:
/// lock - This lock protects the ExecutionEngine, JIT, JITResolver and
@@ -410,10 +413,21 @@ public:
/// RegisterTable - Registers the given pointer as an exception table. It
/// uses the ExceptionTableRegister function.
- void RegisterTable(void* res) {
+ void RegisterTable(const Function *fn, void* res) {
if (ExceptionTableRegister) {
ExceptionTableRegister(res);
- AllExceptionTables.push_back(res);
+ AllExceptionTables[fn] = res;
+ }
+ }
+
+ /// DeregisterTable - Deregisters the exception frame previously registered for the given function.
+ void DeregisterTable(const Function *Fn) {
+ if (ExceptionTableDeregister) {
+ DenseMap<const Function*, void*>::iterator frame = AllExceptionTables.find(Fn);
+ if(frame != AllExceptionTables.end()) {
+ ExceptionTableDeregister(frame->second);
+ AllExceptionTables.erase(frame);
+ }
}
}