LLVM: include/llvm/ExecutionEngine/Orc/SimpleRemoteEPC.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEEPC_H
14#define LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEEPC_H
15
26
27#include
28
29namespace llvm {
30namespace orc {
31
35public:
36
37
38
49
50
51 template <typename TransportT, typename... TransportTCtorArgTs>
54 TransportTCtorArgTs &&...TransportTCtorArgs) {
55 std::unique_ptr SREPC(
57 std::move(D)));
58 auto T = TransportT::Create(
59 *SREPC, std::forward(TransportTCtorArgs)...);
60 if (!T)
61 return T.takeError();
62 SREPC->T = std::move(*T);
63 if (auto Err = SREPC->setup(std::move(S)))
64 return joinErrors(std::move(Err), SREPC->disconnect());
65 return std::move(SREPC);
66 }
67
73
76
78
80
84
86
90
92
93private:
95 std::unique_ptr D)
98 }
99
104
107
111
117
118 uint64_t getNextSeqNo() { return NextSeqNo++; }
119 void releaseSeqNo(uint64_t SeqNo) {}
120
121 Expectedtpctypes::DylibHandle loadDylib(const char *DylibPath) override;
122
123 void lookupSymbolsAsync(ArrayRef Request,
124 SymbolLookupCompleteFn F) override;
125
126 using PendingCallWrapperResultsMap =
127 DenseMap<uint64_t, IncomingWFRHandler>;
128
129 std::mutex SimpleRemoteEPCMutex;
130 std::condition_variable DisconnectCV;
131 bool Disconnected = false;
132 Error DisconnectErr = Error::success();
133
134 std::unique_ptr T;
135 std::unique_ptrjitlink::JITLinkMemoryManager OwnedMemMgr;
136 std::unique_ptr OwnedMemAccess;
137
138 std::unique_ptr EPCDylibMgr;
139 ExecutorAddr RunAsMainAddr;
140 ExecutorAddr RunAsVoidFunctionAddr;
141 ExecutorAddr RunAsIntFunctionAddr;
142
144 PendingCallWrapperResultsMap PendingCallWrapperResults;
145};
146
147}
148}
149
150#endif
This file defines the DenseMap class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Represents an address in the executor process.
A handler or incoming WrapperFunctionResults – either return values from callWrapper* calls,...
std::unique_ptr< TaskDispatcher > D
std::shared_ptr< SymbolStringPool > SSP
ExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP, std::unique_ptr< TaskDispatcher > D)
Definition SimpleRemoteEPC.h:34
void handleDisconnect(Error Err) override
Handle a disconnection from the underlying transport.
SimpleRemoteEPC & operator=(const SimpleRemoteEPC &)=delete
Expected< int32_t > runAsMain(ExecutorAddr MainFnAddr, ArrayRef< std::string > Args) override
Run function with a main-like signature.
static Expected< std::unique_ptr< SimpleRemoteEPC > > Create(std::unique_ptr< TaskDispatcher > D, Setup S, TransportTCtorArgTs &&...TransportTCtorArgs)
Create a SimpleRemoteEPC using the given transport type and args.
Definition SimpleRemoteEPC.h:53
Expected< HandleMessageAction > handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr, SimpleRemoteEPCArgBytesVector ArgBytes) override
Handle receipt of a message.
SimpleRemoteEPC(const SimpleRemoteEPC &)=delete
Error disconnect() override
Disconnect from the target process.
Expected< int32_t > runAsVoidFunction(ExecutorAddr VoidFnAddr) override
Run function with a int (*)(void) signature.
SimpleRemoteEPC(SimpleRemoteEPC &&)=delete
SimpleRemoteEPC & operator=(SimpleRemoteEPC &&)=delete
void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer) override
Run a wrapper function in the executor.
Expected< int32_t > runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override
Run function with a int (*)(int) signature.
unique_function is a type-erasing functor similar to std::function.
SmallVector< char, 128 > SimpleRemoteEPCArgBytesVector
This is an optimization pass for GlobalISel generic memory operations.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
A setup object containing callbacks to construct a memory manager and memory access object.
Definition SimpleRemoteEPC.h:39
Expected< std::unique_ptr< MemoryAccess > >(SimpleRemoteEPC &) CreateMemoryAccessFn
Definition SimpleRemoteEPC.h:43
Expected< std::unique_ptr< jitlink::JITLinkMemoryManager > >( SimpleRemoteEPC &) CreateMemoryManagerFn
Definition SimpleRemoteEPC.h:40
unique_function< CreateMemoryManagerFn > CreateMemoryManager
Definition SimpleRemoteEPC.h:46
unique_function< CreateMemoryAccessFn > CreateMemoryAccess
Definition SimpleRemoteEPC.h:47