diff options
author | Jeff Cohen <jeffc@jolt-lang.org> | 2006-02-07 05:11:57 +0000 |
---|---|---|
committer | Jeff Cohen <jeffc@jolt-lang.org> | 2006-02-07 05:11:57 +0000 |
commit | 68835dd5119150383938c701fc223077d2bc1e25 (patch) | |
tree | 2f9531f4027b4aef8f35c1b57b0a91d9078de013 /lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | aa02c1df1d5add73013568f3e6193fba2fa777c6 (diff) |
Teach the interpreter to handle global variables that are added to a module after
interpretation has begun. The JIT already handles this situation correctly, and
the interpreter can already handle new functions being added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 53587bff5a..95610e65b6 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -171,7 +171,16 @@ void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) { return getPointerToFunction(F); MutexGuard locked(lock); - assert(state.getGlobalAddressMap(locked)[GV] && "Global hasn't had an address allocated yet?"); + void *p = state.getGlobalAddressMap(locked)[GV]; + if (p) + return p; + + // Global variable might have been added since interpreter started. + if (GlobalVariable *GVar = + const_cast<GlobalVariable *>(dyn_cast<GlobalVariable>(GV))) + EmitGlobalVariable(GVar); + else + assert("Global hasn't had an address allocated yet!"); return state.getGlobalAddressMap(locked)[GV]; } |