[llvm] r215613 - [MCJIT] Support DisableSymbolSearching and InstallLazyFunctionCreator in MCJIT.
Lang Hames
lhames at gmail.com
Wed Aug 13 19:38:20 PDT 2014
Author: lhames
Date: Wed Aug 13 21:38:20 2014
New Revision: 215613
URL: http://llvm.org/viewvc/llvm-project?rev=215613&view=rev
Log:
[MCJIT] Support DisableSymbolSearching and InstallLazyFunctionCreator in MCJIT.
Patch by Anthony Pesch. Thanks Anthony!
Modified:
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=215613&r1=215612&r2=215613&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed Aug 13 21:38:20 2014
@@ -316,13 +316,19 @@ uint64_t MCJIT::getSymbolAddress(const s
// If it hasn't already been generated, see if it's in one of our modules.
Module *M = findModuleForSymbol(Name, CheckFunctionsOnly);
- if (!M)
- return 0;
+ if (M) {
+ generateCodeForModule(M);
+
+ // Check the RuntimeDyld table again, it should be there now.
+ return getExistingSymbolAddress(Name);
+ }
- generateCodeForModule(M);
+ // If a LazyFunctionCreator is installed, use it to get/create the function.
+ // FIXME: Should we instead have a LazySymbolCreator callback?
+ if (LazyFunctionCreator)
+ Addr = (uint64_t)LazyFunctionCreator(Name);
- // Check the RuntimeDyld table again, it should be there now.
- return getExistingSymbolAddress(Name);
+ return Addr;
}
uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) {
@@ -578,5 +584,7 @@ uint64_t LinkingMemoryManager::getSymbol
Result = ParentEngine->getSymbolAddress(Name.substr(1), false);
if (Result)
return Result;
+ if (ParentEngine->isSymbolSearchingDisabled())
+ return 0;
return ClientMM->getSymbolAddress(Name);
}
More information about the llvm-commits
mailing list