diff options
| author | Lang Hames <lhames@gmail.com> | 2016-04-18 19:55:43 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2016-04-18 19:55:43 +0000 |
| commit | 3fde652e1864f0e4273352c185cd14f80afbe064 (patch) | |
| tree | 3f0ce44c1a201a1c3a11649f146e8f1d258f7e60 /llvm/tools/lli | |
| parent | 647e9f80aff2894bb42d67a481275107af64ea5d (diff) | |
| download | bcm5719-llvm-3fde652e1864f0e4273352c185cd14f80afbe064.tar.gz bcm5719-llvm-3fde652e1864f0e4273352c185cd14f80afbe064.zip | |
[Orc] Re-commit r266581 with fixes for MSVC, and format cleanups.
Fixes:
(1) Removes constexpr (unsupported in MSVC)
(2) Move constructors (remove explicitly defaulted ones)
(3) <future> - Add warning suppression for MSVC.
llvm-svn: 266663
Diffstat (limited to 'llvm/tools/lli')
| -rw-r--r-- | llvm/tools/lli/ChildTarget/ChildTarget.cpp | 8 | ||||
| -rw-r--r-- | llvm/tools/lli/RemoteJITUtils.h | 1 | ||||
| -rw-r--r-- | llvm/tools/lli/lli.cpp | 21 |
3 files changed, 18 insertions, 12 deletions
diff --git a/llvm/tools/lli/ChildTarget/ChildTarget.cpp b/llvm/tools/lli/ChildTarget/ChildTarget.cpp index 93925d6aa87..b7dcaaa3ea9 100644 --- a/llvm/tools/lli/ChildTarget/ChildTarget.cpp +++ b/llvm/tools/lli/ChildTarget/ChildTarget.cpp @@ -54,16 +54,18 @@ int main(int argc, char *argv[]) { JITServer Server(Channel, SymbolLookup, RegisterEHFrames, DeregisterEHFrames); while (1) { - JITServer::JITProcId Id = JITServer::InvalidId; - if (auto EC = Server.getNextProcId(Id)) { + uint32_t RawId; + if (auto EC = Server.startReceivingFunction(Channel, RawId)) { errs() << "Error: " << EC.message() << "\n"; return 1; } + auto Id = static_cast<JITServer::JITFuncId>(RawId); switch (Id) { case JITServer::TerminateSessionId: + Server.handleTerminateSession(); return 0; default: - if (auto EC = Server.handleKnownProcedure(Id)) { + if (auto EC = Server.handleKnownFunction(Id)) { errs() << "Error: " << EC.message() << "\n"; return 1; } diff --git a/llvm/tools/lli/RemoteJITUtils.h b/llvm/tools/lli/RemoteJITUtils.h index d5488ad555c..63915d13dde 100644 --- a/llvm/tools/lli/RemoteJITUtils.h +++ b/llvm/tools/lli/RemoteJITUtils.h @@ -16,6 +16,7 @@ #include "llvm/ExecutionEngine/Orc/RPCChannel.h" #include "llvm/ExecutionEngine/RTDyldMemoryManager.h" +#include <mutex> #if !defined(_MSC_VER) && !defined(__MINGW32__) #include <unistd.h> diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index ec0e85e8d0b..f2e210d28dd 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -570,7 +570,7 @@ int main(int argc, char **argv, char * const *envp) { // Reset errno to zero on entry to main. errno = 0; - int Result; + int Result = -1; // Sanity check use of remote-jit: LLI currently only supports use of the // remote JIT on Unix platforms. @@ -669,12 +669,13 @@ int main(int argc, char **argv, char * const *envp) { static_cast<ForwardingMemoryManager*>(RTDyldMM)->setResolver( orc::createLambdaResolver( [&](const std::string &Name) { - orc::TargetAddress Addr = 0; - if (auto EC = R->getSymbolAddress(Addr, Name)) { - errs() << "Failure during symbol lookup: " << EC.message() << "\n"; - exit(1); - } - return RuntimeDyld::SymbolInfo(Addr, JITSymbolFlags::Exported); + if (auto AddrOrErr = R->getSymbolAddress(Name)) + return RuntimeDyld::SymbolInfo(*AddrOrErr, JITSymbolFlags::Exported); + else { + errs() << "Failure during symbol lookup: " + << AddrOrErr.getError().message() << "\n"; + exit(1); + } }, [](const std::string &Name) { return nullptr; } )); @@ -686,8 +687,10 @@ int main(int argc, char **argv, char * const *envp) { EE->finalizeObject(); DEBUG(dbgs() << "Executing '" << EntryFn->getName() << "' at 0x" << format("%llx", Entry) << "\n"); - if (auto EC = R->callIntVoid(Result, Entry)) - errs() << "ERROR: " << EC.message() << "\n"; + if (auto ResultOrErr = R->callIntVoid(Entry)) + Result = *ResultOrErr; + else + errs() << "ERROR: " << ResultOrErr.getError().message() << "\n"; // Like static constructors, the remote target MCJIT support doesn't handle // this yet. It could. FIXME. |

