diff options
author | Andres Freund <andres@anarazel.de> | 2018-05-24 18:44:34 +0000 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-05-24 18:44:34 +0000 |
commit | 54ddd7426eee9c818a783ac6d8bf3fabcd57660a (patch) | |
tree | f6c1af5814e15e1f76630019697aa5c4d65f8021 /llvm/unittests/ExecutionEngine | |
parent | 98150e3a625f41d8ac0e5b36b9a7131df4551902 (diff) | |
download | bcm5719-llvm-54ddd7426eee9c818a783ac6d8bf3fabcd57660a.tar.gz bcm5719-llvm-54ddd7426eee9c818a783ac6d8bf3fabcd57660a.zip |
[ORC] Add findSymbolIn() wrapper to C bindings, take #2.
Re-appply r333147, reverted in r333152 due to a pre-existing bug. As
D47308 has been merged in r333206, the OSX issue should now be
resolved.
In many cases JIT users will know in which module a symbol
resides. Avoiding to search other modules can be more efficient. It
also allows to handle duplicate symbol names between modules.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D44889
llvm-svn: 333215
Diffstat (limited to 'llvm/unittests/ExecutionEngine')
-rw-r--r-- | llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp index fe3f694f560..b288b6bab2c 100644 --- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp @@ -98,12 +98,26 @@ TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) { LLVMOrcModuleHandle H; LLVMOrcAddEagerlyCompiledIR(JIT, &H, wrap(M.release()), myResolver, nullptr); - LLVMOrcTargetAddress MainAddr; - LLVMOrcGetSymbolAddress(JIT, &MainAddr, "main"); - MainFnTy MainFn = (MainFnTy)MainAddr; - int Result = MainFn(); - EXPECT_EQ(Result, 42) - << "Eagerly JIT'd code did not return expected result"; + + // get symbol address searching the entire stack + { + LLVMOrcTargetAddress MainAddr; + LLVMOrcGetSymbolAddress(JIT, &MainAddr, "main"); + MainFnTy MainFn = (MainFnTy)MainAddr; + int Result = MainFn(); + EXPECT_EQ(Result, 42) + << "Eagerly JIT'd code did not return expected result"; + } + + // and then just searching a single handle + { + LLVMOrcTargetAddress MainAddr; + LLVMOrcGetSymbolAddressIn(JIT, &MainAddr, H, "main"); + MainFnTy MainFn = (MainFnTy)MainAddr; + int Result = MainFn(); + EXPECT_EQ(Result, 42) + << "Eagerly JIT'd code did not return expected result"; + } LLVMOrcRemoveModule(JIT, H); |