From a258b01b12d429e7009c6f0fcd5ae3a8038be0c5 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 21 Mar 2016 16:56:25 +0000 Subject: [PATCH] [Orc] Switch RPC Procedure to take a function type, rather than an arg list. No functional change, just a little more readable. llvm-svn: 263951 --- .../Orc/OrcRemoteTargetRPCAPI.h | 95 ++++++++++--------- .../llvm/ExecutionEngine/Orc/RPCUtils.h | 11 ++- .../ExecutionEngine/Orc/RPCUtilsTest.cpp | 16 +--- 3 files changed, 58 insertions(+), 64 deletions(-) diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h index 9de22eaa3ad7..94327d0e3207 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h @@ -82,108 +82,109 @@ public: static const char *getJITProcIdName(JITProcId Id); - typedef Procedure CallIntVoid; + typedef Procedure CallIntVoid; - typedef Procedure - CallIntVoidResponse; + typedef Procedure + CallIntVoidResponse; - typedef Procedure /* Args */> + typedef Procedure Args)> CallMain; - typedef Procedure CallMainResponse; + typedef Procedure CallMainResponse; - typedef Procedure CallVoidVoid; + typedef Procedure CallVoidVoid; - typedef Procedure CallVoidVoidResponse; + typedef Procedure CallVoidVoidResponse; typedef Procedure + void(ResourceIdMgr::ResourceId AllocatorID)> CreateRemoteAllocator; typedef Procedure - CreateIndirectStubsOwner; + void(ResourceIdMgr::ResourceId StubOwnerID)> + CreateIndirectStubsOwner; - typedef Procedure + typedef Procedure DeregisterEHFrames; typedef Procedure + void(ResourceIdMgr::ResourceId AllocatorID)> DestroyRemoteAllocator; typedef Procedure + void(ResourceIdMgr::ResourceId StubsOwnerID)> DestroyIndirectStubsOwner; typedef Procedure + void(ResourceIdMgr::ResourceId StubsOwnerID, + uint32_t NumStubsRequired)> EmitIndirectStubs; - typedef Procedure< - EmitIndirectStubsResponseId, TargetAddress /* StubsBaseAddr */, - TargetAddress /* PtrsBaseAddr */, uint32_t /* NumStubsEmitted */> + typedef Procedure EmitIndirectStubsResponse; - typedef Procedure EmitResolverBlock; + typedef Procedure EmitResolverBlock; - typedef Procedure EmitTrampolineBlock; + typedef Procedure EmitTrampolineBlock; typedef Procedure + void(TargetAddress BlockAddr, uint32_t NumTrampolines)> EmitTrampolineBlockResponse; - typedef Procedure + typedef Procedure GetSymbolAddress; - typedef Procedure + typedef Procedure GetSymbolAddressResponse; - typedef Procedure GetRemoteInfo; + typedef Procedure GetRemoteInfo; - typedef Procedure + typedef Procedure GetRemoteInfoResponse; - typedef Procedure + typedef Procedure ReadMem; - typedef Procedure ReadMemResponse; + typedef Procedure ReadMemResponse; - typedef Procedure + typedef Procedure RegisterEHFrames; - typedef Procedure + typedef Procedure ReserveMem; - typedef Procedure + typedef Procedure ReserveMemResponse; - typedef Procedure + typedef Procedure RequestCompile; - typedef Procedure + typedef Procedure RequestCompileResponse; - typedef Procedure + typedef Procedure SetProtections; - typedef Procedure TerminateSession; + typedef Procedure TerminateSession; - typedef Procedure + typedef Procedure WriteMem; - typedef Procedure + typedef Procedure WritePtr; }; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h index 44dccccce0d3..d1b8546268fc 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h @@ -26,7 +26,7 @@ namespace remote { // partially specialized. class RPCBase { protected: - template + template class ProcedureHelper { public: static const ProcedureIdT Id = ProcId; @@ -36,7 +36,8 @@ protected: template - class CallHelper> { + class CallHelper> { public: static std::error_code call(ChannelT &C, const ArgTs &... Args) { if (auto EC = serialize(C, ProcId)) @@ -52,7 +53,7 @@ protected: template class HandlerHelper> { + ProcedureHelper> { public: template static std::error_code handle(ChannelT &C, HandlerT Handler) { @@ -179,8 +180,8 @@ public: /// }) /// /* handle EC */; /// - template - using Procedure = ProcedureHelper; + template + using Procedure = ProcedureHelper; /// Serialize Args... to channel C, but do not call C.send(). /// diff --git a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp index 8215144a514d..3b01c3828b6e 100644 --- a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp @@ -44,18 +44,10 @@ private: class DummyRPC : public testing::Test, public RPC { public: - typedef Procedure<1, bool> Proc1; - typedef Procedure<2, int8_t, - uint8_t, - int16_t, - uint16_t, - int32_t, - uint32_t, - int64_t, - uint64_t, - bool, - std::string, - std::vector> AllTheTypes; + typedef Procedure<1, void(bool)> Proc1; + typedef Procedure<2, void(int8_t, uint8_t, int16_t, uint16_t, + int32_t, uint32_t, int64_t, uint64_t, + bool, std::string, std::vector)> AllTheTypes; };