Changes in directory llvm/lib/ExecutionEngine:
ExecutionEngine.cpp updated: 1.73 -> 1.74 --- Log message: 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. --- Diffs of the changes: (+10 -1) ExecutionEngine.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.73 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.74 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.73 Fri Jan 20 12:18:40 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Mon Feb 6 23:11:57 2006 @@ -171,7 +171,16 @@ 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]; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits