13#ifndef LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEEPC_H
14#define LLVM_EXECUTIONENGINE_ORC_SIMPLEREMOTEEPC_H
51 template <
typename TransportT,
typename... TransportTCtorArgTs>
54 TransportTCtorArgTs &&...TransportTCtorArgs) {
55 std::unique_ptr<SimpleRemoteEPC> SREPC(
58 auto T = TransportT::Create(
59 *SREPC, std::forward<TransportTCtorArgTs>(TransportTCtorArgs)...);
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);
85 Error disconnect()
override;
91 void handleDisconnect(
Error Err)
override;
95 std::unique_ptr<TaskDispatcher>
D)
97 this->DylibMgr =
this;
110 Error setup(Setup S);
118 uint64_t getNextSeqNo() {
return NextSeqNo++; }
119 void releaseSeqNo(
uint64_t SeqNo) {}
121 Expected<tpctypes::DylibHandle> loadDylib(
const char *DylibPath)
override;
123 void lookupSymbolsAsync(ArrayRef<LookupRequest> Request,
124 SymbolLookupCompleteFn
F)
override;
126 using PendingCallWrapperResultsMap =
127 DenseMap<uint64_t, IncomingWFRHandler>;
129 std::mutex SimpleRemoteEPCMutex;
130 std::condition_variable DisconnectCV;
131 bool Disconnected =
false;
132 Error DisconnectErr = Error::success();
134 std::unique_ptr<SimpleRemoteEPCTransport>
T;
135 std::unique_ptr<jitlink::JITLinkMemoryManager> OwnedMemMgr;
136 std::unique_ptr<MemoryAccess> OwnedMemAccess;
138 std::unique_ptr<EPCGenericDylibManager> EPCDylibMgr;
139 ExecutorAddr RunAsMainAddr;
140 ExecutorAddr RunAsVoidFunctionAddr;
141 ExecutorAddr RunAsIntFunctionAddr;
144 PendingCallWrapperResultsMap PendingCallWrapperResults;
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
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.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represents an address in the executor process.
A handler or incoming WrapperFunctionResults – either return values from callWrapper* calls,...
ExecutorProcessControl supports interaction with a JIT target process.
SimpleRemoteEPC & operator=(const SimpleRemoteEPC &)=delete
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.
SimpleRemoteEPC(const SimpleRemoteEPC &)=delete
SimpleRemoteEPC(SimpleRemoteEPC &&)=delete
SimpleRemoteEPC & operator=(SimpleRemoteEPC &&)=delete
unique_function is a type-erasing functor similar to std::function.
LLVM_ABI int runAsVoidFunction(int(*Func)(void))
LLVM_ABI int runAsIntFunction(int(*Func)(int), int Arg)
LLVM_ABI int runAsMain(int(*Main)(int, char *[]), ArrayRef< std::string > Args, std::optional< StringRef > ProgramName=std::nullopt)
Run a main function, returning the result.
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.
Expected< std::unique_ptr< jitlink::JITLinkMemoryManager > >(SimpleRemoteEPC &) CreateMemoryManagerFn
unique_function< CreateMemoryManagerFn > CreateMemoryManager
unique_function< CreateMemoryAccessFn > CreateMemoryAccess