summaryrefslogtreecommitdiff
path: root/examples
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
commitd8314f03b12580b2b644ac7ca8ada80ba7f1e1bc (patch)
treef8f8b1abd4274ff4ea0706d2e2e50d558800d5a7 /examples
parenta27bda70c23be42807c93d331d11c72a84f26c0b (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h4
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h b/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
index c95532e8db3..718b99e4b24 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
@@ -14,7 +14,7 @@
#ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
#define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
-#include "llvm/ExecutionEngine/Orc/RPCByteChannel.h"
+#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
#include <mutex>
@@ -25,7 +25,7 @@
#endif
/// RPC channel that reads from and writes from file descriptors.
-class FDRPCChannel final : public llvm::orc::remote::RPCByteChannel {
+class FDRPCChannel final : public llvm::orc::rpc::RawByteChannel {
public:
FDRPCChannel(int InFD, int OutFD) : InFD(InFD), OutFD(OutFD) {}
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp b/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
index 9c21098971a..f5a06cf2bf4 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
@@ -1265,8 +1265,8 @@ int main(int argc, char *argv[]) {
BinopPrecedence['*'] = 40; // highest.
auto TCPChannel = connect();
- MyRemote Remote = ExitOnErr(MyRemote::Create(*TCPChannel));
- TheJIT = llvm::make_unique<KaleidoscopeJIT>(Remote);
+ auto Remote = ExitOnErr(MyRemote::Create(*TCPChannel));
+ TheJIT = llvm::make_unique<KaleidoscopeJIT>(*Remote);
// Automatically inject a definition for 'printExprResult'.
FunctionProtos["printExprResult"] =
@@ -1288,7 +1288,7 @@ int main(int argc, char *argv[]) {
TheJIT = nullptr;
// Send a terminate message to the remote to tell it to exit cleanly.
- ExitOnErr(Remote.terminateSession());
+ ExitOnErr(Remote->terminateSession());
return 0;
}