summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-11-11 19:42:44 +0000
committerLang Hames <lhames@gmail.com>2016-11-11 19:42:44 +0000
commitae1fdddbc4da0cffb219bc6f19b42a9e89f0c3b1 (patch)
tree33a93248b3e54f91119ad33f7663bc6b1fda76ee /llvm/lib/ExecutionEngine
parentda0149dd74980bbe9175009b74f3a37cddec71cd (diff)
downloadbcm5719-llvm-ae1fdddbc4da0cffb219bc6f19b42a9e89f0c3b1.tar.gz
bcm5719-llvm-ae1fdddbc4da0cffb219bc6f19b42a9e89f0c3b1.zip
[ORC] Refactor the ORC RPC utilities to add some new features.
(1) Add support for function key negotiation. The previous version of the RPC required both sides to maintain the same enumeration for functions in the API. This means that any version skew between the client and server would result in communication failure. With this version of the patch functions (and serializable types) are defined with string names, and the derived function signature strings are used to negotiate the actual function keys (which are used for efficient call serialization). This allows clients to connect to any server that supports a superset of the API (based on the function signatures it supports). (2) Add a callAsync primitive. The callAsync primitive can be used to install a return value handler that will run as soon as the RPC function's return value is sent back from the remote. (3) Launch policies for RPC function handlers. The new addHandler method, which installs handlers for RPC functions, takes two arguments: (1) the handler itself, and (2) an optional "launch policy". When the RPC function is called, the launch policy (if present) is invoked to actually launch the handler. This allows the handler to be spawned on a background thread, or added to a work list. If no launch policy is used, the handler is run on the server thread itself. This should only be used for short-running handlers, or entirely synchronous RPC APIs. (4) Zero cost cross type serialization. You can now define serialization from any type to a different "wire" type. For example, this allows you to call an RPC function that's defined to take a std::string while passing a StringRef argument. If a serializer from StringRef to std::string has been defined for the channel type this will be used to serialize the argument without having to construct a std::string instance. This allows buffer reference types to be used as arguments to RPC calls without requiring a copy of the buffer to be made. llvm-svn: 286620
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/CMakeLists.txt1
-rw-r--r--llvm/lib/ExecutionEngine/Orc/OrcError.cpp2
-rw-r--r--llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp53
3 files changed, 2 insertions, 54 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
index 76720a7c52e..685e882e4a8 100644
--- a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
@@ -6,7 +6,6 @@ add_llvm_library(LLVMOrcJIT
OrcCBindings.cpp
OrcError.cpp
OrcMCJITReplacement.cpp
- OrcRemoteTargetRPCAPI.cpp
ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp
index 64472f9ba37..48dcd442266 100644
--- a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp
@@ -43,6 +43,8 @@ public:
return "Unexpected RPC call";
case OrcErrorCode::UnexpectedRPCResponse:
return "Unexpected RPC response";
+ case OrcErrorCode::UnknownRPCFunction:
+ return "Unknown RPC function";
}
llvm_unreachable("Unhandled error code");
}
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp b/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
deleted file mode 100644
index d1a021aee3a..00000000000
--- a/llvm/lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===------- OrcRemoteTargetRPCAPI.cpp - ORC Remote API utilities ---------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h"
-
-namespace llvm {
-namespace orc {
-namespace remote {
-
-#define FUNCNAME(X) \
- case X ## Id: \
- return #X
-
-const char *OrcRemoteTargetRPCAPI::getJITFuncIdName(JITFuncId Id) {
- switch (Id) {
- case InvalidId:
- return "*** Invalid JITFuncId ***";
- FUNCNAME(CallIntVoid);
- FUNCNAME(CallMain);
- FUNCNAME(CallVoidVoid);
- FUNCNAME(CreateRemoteAllocator);
- FUNCNAME(CreateIndirectStubsOwner);
- FUNCNAME(DeregisterEHFrames);
- FUNCNAME(DestroyRemoteAllocator);
- FUNCNAME(DestroyIndirectStubsOwner);
- FUNCNAME(EmitIndirectStubs);
- FUNCNAME(EmitResolverBlock);
- FUNCNAME(EmitTrampolineBlock);
- FUNCNAME(GetSymbolAddress);
- FUNCNAME(GetRemoteInfo);
- FUNCNAME(ReadMem);
- FUNCNAME(RegisterEHFrames);
- FUNCNAME(ReserveMem);
- FUNCNAME(RequestCompile);
- FUNCNAME(SetProtections);
- FUNCNAME(TerminateSession);
- FUNCNAME(WriteMem);
- FUNCNAME(WritePtr);
- };
- return nullptr;
-}
-
-#undef FUNCNAME
-
-} // end namespace remote
-} // end namespace orc
-} // end namespace llvm
OpenPOWER on IntegriCloud