mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
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. llvm-svn: 26030
This commit is contained in:
parent
e2ef48c356
commit
909ee648c7
@ -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];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user