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
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];
}