MCJIT knows where to find things, do not rely on the module (which one?)

This commit is contained in:
Axel Naumann 2015-01-12 09:23:03 +01:00 committed by sftnight
parent 9c383fcef3
commit 46673943f8
2 changed files with 8 additions and 15 deletions

View File

@ -423,17 +423,14 @@ void* IncrementalExecutor::getAddressOfGlobal(llvm::Module* m,
// Return a symbol's address, and whether it was jitted.
void* address
= llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(symbolName);
if (address) {
if (fromJIT) *fromJIT = false;
} else {
if (fromJIT) *fromJIT = true;
llvm::GlobalVariable* gvar = m->getGlobalVariable(symbolName, true);
if (!gvar)
return 0;
remapSymbols();
address = m_engine->getPointerToGlobal(gvar);
}
// It's not from the JIT if it's in a dylib.
if (fromJIT)
*fromJIT = !address;
if (!address)
return (void*)m_engine->getGlobalValueAddress(symbolName);
return address;
}

View File

@ -254,11 +254,7 @@ namespace cling {
// utils::TypeName::GetFullyQualifiedName which is expensive
// (memory-wise). See ROOT-6909.
std::string code;
const llvm::GlobalValue* GV = 0;
if (const Transaction* T = m_Interpreter->getLastTransaction())
if (const llvm::Module* M = T->getModule())
GV = M->getNamedValue(funcname);
if (!GV) {
if (!m_Interpreter->getAddressOfGlobal(funcname)) {
code = "extern \"C\" void ";
clang::QualType RDQT(RD->getTypeForDecl(), 0);
std::string typeName