OSDN Git Service

[ORC] Refactor the ORC RPC utilities to add some new features.
authorLang Hames <lhames@gmail.com>
Fri, 11 Nov 2016 19:42:44 +0000 (19:42 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 11 Nov 2016 19:42:44 +0000 (19:42 +0000)
commitd8314f03b12580b2b644ac7ca8ada80ba7f1e1bc
treef8f8b1abd4274ff4ea0706d2e2e50d558800d5a7
parenta27bda70c23be42807c93d331d11c72a84f26c0b
[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
17 files changed:
examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp
include/llvm/ExecutionEngine/Orc/OrcError.h
include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
include/llvm/ExecutionEngine/Orc/RPCByteChannel.h [deleted file]
include/llvm/ExecutionEngine/Orc/RPCSerialization.h
include/llvm/ExecutionEngine/Orc/RPCUtils.h
include/llvm/ExecutionEngine/Orc/RawByteChannel.h [new file with mode: 0644]
lib/ExecutionEngine/Orc/CMakeLists.txt
lib/ExecutionEngine/Orc/OrcError.cpp
lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp [deleted file]
tools/lli/ChildTarget/ChildTarget.cpp
tools/lli/RemoteJITUtils.h
tools/lli/lli.cpp
unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp