LLVM 21.0.0git
ExecutorProcessControl.h
Go to the documentation of this file.
1//===- ExecutorProcessControl.h - Executor process control APIs -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Utilities for interacting with the executor processes.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
14#define LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
15
16#include "llvm/ADT/StringRef.h"
28
29#include <future>
30#include <mutex>
31#include <vector>
32
33namespace llvm {
34namespace orc {
35
36class ExecutionSession;
37
38/// ExecutorProcessControl supports interaction with a JIT target process.
40 friend class ExecutionSession;
41public:
42
43 /// A handler or incoming WrapperFunctionResults -- either return values from
44 /// callWrapper* calls, or incoming JIT-dispatch requests.
45 ///
46 /// IncomingWFRHandlers are constructible from
47 /// unique_function<void(shared::WrapperFunctionResult)>s using the
48 /// runInPlace function or a RunWithDispatch object.
51 public:
52 IncomingWFRHandler() = default;
53 explicit operator bool() const { return !!H; }
54 void operator()(shared::WrapperFunctionResult WFR) { H(std::move(WFR)); }
55 private:
56 template <typename FnT> IncomingWFRHandler(FnT &&Fn)
57 : H(std::forward<FnT>(Fn)) {}
58
60 };
61
62 /// Constructs an IncomingWFRHandler from a function object that is callable
63 /// as void(shared::WrapperFunctionResult). The function object will be called
64 /// directly. This should be used with care as it may block listener threads
65 /// in remote EPCs. It is only suitable for simple tasks (e.g. setting a
66 /// future), or for performing some quick analysis before dispatching "real"
67 /// work as a Task.
68 class RunInPlace {
69 public:
70 template <typename FnT>
72 return IncomingWFRHandler(std::forward<FnT>(Fn));
73 }
74 };
75
76 /// Constructs an IncomingWFRHandler from a function object by creating a new
77 /// function object that dispatches the original using a TaskDispatcher,
78 /// wrapping the original as a GenericNamedTask.
79 ///
80 /// This is the default approach for running WFR handlers.
81 class RunAsTask {
82 public:
84
85 template <typename FnT>
87 return IncomingWFRHandler(
88 [&D = this->D, Fn = std::move(Fn)]
89 (shared::WrapperFunctionResult WFR) mutable {
90 D.dispatch(
92 [Fn = std::move(Fn), WFR = std::move(WFR)]() mutable {
93 Fn(std::move(WFR));
94 }, "WFR handler task"));
95 });
96 }
97 private:
99 };
100
101 /// APIs for manipulating memory in the target process.
103 public:
104 /// Callback function for asynchronous writes.
106
107 virtual ~MemoryAccess();
108
110 WriteResultFn OnWriteComplete) = 0;
111
113 WriteResultFn OnWriteComplete) = 0;
114
116 WriteResultFn OnWriteComplete) = 0;
117
119 WriteResultFn OnWriteComplete) = 0;
120
122 WriteResultFn OnWriteComplete) = 0;
123
125 WriteResultFn OnWriteComplete) = 0;
126
128 std::promise<MSVCPError> ResultP;
129 auto ResultF = ResultP.get_future();
131 [&](Error Err) { ResultP.set_value(std::move(Err)); });
132 return ResultF.get();
133 }
134
136 std::promise<MSVCPError> ResultP;
137 auto ResultF = ResultP.get_future();
139 [&](Error Err) { ResultP.set_value(std::move(Err)); });
140 return ResultF.get();
141 }
142
144 std::promise<MSVCPError> ResultP;
145 auto ResultF = ResultP.get_future();
147 [&](Error Err) { ResultP.set_value(std::move(Err)); });
148 return ResultF.get();
149 }
150
152 std::promise<MSVCPError> ResultP;
153 auto ResultF = ResultP.get_future();
155 [&](Error Err) { ResultP.set_value(std::move(Err)); });
156 return ResultF.get();
157 }
158
160 std::promise<MSVCPError> ResultP;
161 auto ResultF = ResultP.get_future();
163 [&](Error Err) { ResultP.set_value(std::move(Err)); });
164 return ResultF.get();
165 }
166
168 std::promise<MSVCPError> ResultP;
169 auto ResultF = ResultP.get_future();
171 [&](Error Err) { ResultP.set_value(std::move(Err)); });
172 return ResultF.get();
173 }
174 };
175
176 /// Contains the address of the dispatch function and context that the ORC
177 /// runtime can use to call functions in the JIT.
181 };
182
183 ExecutorProcessControl(std::shared_ptr<SymbolStringPool> SSP,
184 std::unique_ptr<TaskDispatcher> D)
185 : SSP(std::move(SSP)), D(std::move(D)) {}
186
188
189 /// Return the ExecutionSession associated with this instance.
190 /// Not callable until the ExecutionSession has been associated.
192 assert(ES && "No ExecutionSession associated yet");
193 return *ES;
194 }
195
196 /// Intern a symbol name in the SymbolStringPool.
197 SymbolStringPtr intern(StringRef SymName) { return SSP->intern(SymName); }
198
199 /// Return a shared pointer to the SymbolStringPool for this instance.
200 std::shared_ptr<SymbolStringPool> getSymbolStringPool() const { return SSP; }
201
203
204 /// Return the Triple for the target process.
205 const Triple &getTargetTriple() const { return TargetTriple; }
206
207 /// Get the page size for the target process.
208 unsigned getPageSize() const { return PageSize; }
209
210 /// Get the JIT dispatch function and context address for the executor.
211 const JITDispatchInfo &getJITDispatchInfo() const { return JDI; }
212
213 /// Return a MemoryAccess object for the target process.
215 assert(MemAccess && "No MemAccess object set.");
216 return *MemAccess;
217 }
218
219 /// Return a JITLinkMemoryManager for the target process.
221 assert(MemMgr && "No MemMgr object set");
222 return *MemMgr;
223 }
224
225 /// Return the DylibManager for the target process.
227 assert(DylibMgr && "No DylibMgr object set");
228 return *DylibMgr;
229 }
230
231 /// Returns the bootstrap map.
233 return BootstrapMap;
234 }
235
236 /// Look up and SPS-deserialize a bootstrap map value.
237 template <typename T, typename SPSTagT>
238 Error getBootstrapMapValue(StringRef Key, std::optional<T> &Val) const {
239 Val = std::nullopt;
240
241 auto I = BootstrapMap.find(Key);
242 if (I == BootstrapMap.end())
243 return Error::success();
244
245 T Tmp;
246 shared::SPSInputBuffer IB(I->second.data(), I->second.size());
248 return make_error<StringError>("Could not deserialize value for key " +
249 Key,
251
252 Val = std::move(Tmp);
253 return Error::success();
254 }
255
256 /// Returns the bootstrap symbol map.
258 return BootstrapSymbols;
259 }
260
261 /// For each (ExecutorAddr&, StringRef) pair, looks up the string in the
262 /// bootstrap symbols map and writes its address to the ExecutorAddr if
263 /// found. If any symbol is not found then the function returns an error.
265 ArrayRef<std::pair<ExecutorAddr &, StringRef>> Pairs) const {
266 for (const auto &KV : Pairs) {
267 auto I = BootstrapSymbols.find(KV.second);
268 if (I == BootstrapSymbols.end())
269 return make_error<StringError>("Symbol \"" + KV.second +
270 "\" not found "
271 "in bootstrap symbols map",
273
274 KV.first = I->second;
275 }
276 return Error::success();
277 }
278
279 /// Run function with a main-like signature.
281 ArrayRef<std::string> Args) = 0;
282
283 // TODO: move this to ORC runtime.
284 /// Run function with a int (*)(void) signature.
286
287 // TODO: move this to ORC runtime.
288 /// Run function with a int (*)(int) signature.
290 int Arg) = 0;
291
292 /// Run a wrapper function in the executor. The given WFRHandler will be
293 /// called on the result when it is returned.
294 ///
295 /// The wrapper function should be callable as:
296 ///
297 /// \code{.cpp}
298 /// CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
299 /// \endcode{.cpp}
300 virtual void callWrapperAsync(ExecutorAddr WrapperFnAddr,
301 IncomingWFRHandler OnComplete,
302 ArrayRef<char> ArgBuffer) = 0;
303
304 /// Run a wrapper function in the executor using the given Runner to dispatch
305 /// OnComplete when the result is ready.
306 template <typename RunPolicyT, typename FnT>
307 void callWrapperAsync(RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr,
308 FnT &&OnComplete, ArrayRef<char> ArgBuffer) {
310 WrapperFnAddr, Runner(std::forward<FnT>(OnComplete)), ArgBuffer);
311 }
312
313 /// Run a wrapper function in the executor. OnComplete will be dispatched
314 /// as a GenericNamedTask using this instance's TaskDispatch object.
315 template <typename FnT>
316 void callWrapperAsync(ExecutorAddr WrapperFnAddr, FnT &&OnComplete,
317 ArrayRef<char> ArgBuffer) {
318 callWrapperAsync(RunAsTask(*D), WrapperFnAddr,
319 std::forward<FnT>(OnComplete), ArgBuffer);
320 }
321
322 /// Run a wrapper function in the executor. The wrapper function should be
323 /// callable as:
324 ///
325 /// \code{.cpp}
326 /// CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
327 /// \endcode{.cpp}
329 ArrayRef<char> ArgBuffer) {
330 std::promise<shared::WrapperFunctionResult> RP;
331 auto RF = RP.get_future();
333 RunInPlace(), WrapperFnAddr,
335 RP.set_value(std::move(R));
336 }, ArgBuffer);
337 return RF.get();
338 }
339
340 /// Run a wrapper function using SPS to serialize the arguments and
341 /// deserialize the results.
342 template <typename SPSSignature, typename RunPolicyT, typename SendResultT,
343 typename... ArgTs>
344 void callSPSWrapperAsync(RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr,
345 SendResultT &&SendResult, const ArgTs &...Args) {
347 [this, WrapperFnAddr, Runner = std::move(Runner)]
348 (auto &&SendResult, const char *ArgData, size_t ArgSize) mutable {
349 this->callWrapperAsync(std::move(Runner), WrapperFnAddr,
350 std::move(SendResult),
351 ArrayRef<char>(ArgData, ArgSize));
352 },
353 std::forward<SendResultT>(SendResult), Args...);
354 }
355
356 /// Run a wrapper function using SPS to serialize the arguments and
357 /// deserialize the results.
358 template <typename SPSSignature, typename SendResultT, typename... ArgTs>
359 void callSPSWrapperAsync(ExecutorAddr WrapperFnAddr, SendResultT &&SendResult,
360 const ArgTs &...Args) {
361 callSPSWrapperAsync<SPSSignature>(RunAsTask(*D), WrapperFnAddr,
362 std::forward<SendResultT>(SendResult),
363 Args...);
364 }
365
366 /// Run a wrapper function using SPS to serialize the arguments and
367 /// deserialize the results.
368 ///
369 /// If SPSSignature is a non-void function signature then the second argument
370 /// (the first in the Args list) should be a reference to a return value.
371 template <typename SPSSignature, typename... WrapperCallArgTs>
373 WrapperCallArgTs &&...WrapperCallArgs) {
375 [this, WrapperFnAddr](const char *ArgData, size_t ArgSize) {
376 return callWrapper(WrapperFnAddr, ArrayRef<char>(ArgData, ArgSize));
377 },
378 std::forward<WrapperCallArgTs>(WrapperCallArgs)...);
379 }
380
381 /// Disconnect from the target process.
382 ///
383 /// This should be called after the JIT session is shut down.
384 virtual Error disconnect() = 0;
385
386protected:
387
388 std::shared_ptr<SymbolStringPool> SSP;
389 std::unique_ptr<TaskDispatcher> D;
392 unsigned PageSize = 0;
399};
400
402public:
403 InProcessMemoryAccess(bool IsArch64Bit) : IsArch64Bit(IsArch64Bit) {}
405 WriteResultFn OnWriteComplete) override;
406
408 WriteResultFn OnWriteComplete) override;
409
411 WriteResultFn OnWriteComplete) override;
412
414 WriteResultFn OnWriteComplete) override;
415
417 WriteResultFn OnWriteComplete) override;
418
420 WriteResultFn OnWriteComplete) override;
421
422private:
423 bool IsArch64Bit;
424};
425
426/// A ExecutorProcessControl instance that asserts if any of its methods are
427/// used. Suitable for use is unit tests, and by ORC clients who haven't moved
428/// to ExecutorProcessControl-based APIs yet.
430 private InProcessMemoryAccess {
431public:
433 std::shared_ptr<SymbolStringPool> SSP = nullptr,
434 std::unique_ptr<TaskDispatcher> D = nullptr, const std::string &TT = "",
435 unsigned PageSize = 0)
437 SSP ? std::move(SSP) : std::make_shared<SymbolStringPool>(),
438 D ? std::move(D) : std::make_unique<InPlaceTaskDispatcher>()),
439 InProcessMemoryAccess(Triple(TT).isArch64Bit()) {
440 this->TargetTriple = Triple(TT);
441 this->PageSize = PageSize;
442 this->MemAccess = this;
443 }
444
446 ArrayRef<std::string> Args) override {
447 llvm_unreachable("Unsupported");
448 }
449
451 llvm_unreachable("Unsupported");
452 }
453
454 Expected<int32_t> runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override {
455 llvm_unreachable("Unsupported");
456 }
457
458 void callWrapperAsync(ExecutorAddr WrapperFnAddr,
459 IncomingWFRHandler OnComplete,
460 ArrayRef<char> ArgBuffer) override {
461 llvm_unreachable("Unsupported");
462 }
463
464 Error disconnect() override { return Error::success(); }
465};
466
467/// A ExecutorProcessControl implementation targeting the current process.
469 private InProcessMemoryAccess,
470 private DylibManager {
471public:
473 std::shared_ptr<SymbolStringPool> SSP, std::unique_ptr<TaskDispatcher> D,
474 Triple TargetTriple, unsigned PageSize,
475 std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr);
476
477 /// Create a SelfExecutorProcessControl with the given symbol string pool and
478 /// memory manager.
479 /// If no symbol string pool is given then one will be created.
480 /// If no memory manager is given a jitlink::InProcessMemoryManager will
481 /// be created and used by default.
483 Create(std::shared_ptr<SymbolStringPool> SSP = nullptr,
484 std::unique_ptr<TaskDispatcher> D = nullptr,
485 std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr = nullptr);
486
488 ArrayRef<std::string> Args) override;
489
491
492 Expected<int32_t> runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override;
493
494 void callWrapperAsync(ExecutorAddr WrapperFnAddr,
495 IncomingWFRHandler OnComplete,
496 ArrayRef<char> ArgBuffer) override;
497
498 Error disconnect() override;
499
500private:
502 jitDispatchViaWrapperFunctionManager(void *Ctx, const void *FnTag,
503 const char *Data, size_t Size);
504
505 Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) override;
506
507 void lookupSymbolsAsync(ArrayRef<LookupRequest> Request,
508 SymbolLookupCompleteFn F) override;
509
510 std::unique_ptr<jitlink::JITLinkMemoryManager> OwnedMemMgr;
511#ifdef __APPLE__
512 std::unique_ptr<UnwindInfoManager> UnwindInfoMgr;
513#endif // __APPLE__
514 char GlobalManglingPrefix = 0;
515};
516
517} // end namespace orc
518} // end namespace llvm
519
520#endif // LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define H(x, y, z)
Definition: MD5.cpp:57
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Tagged union holding either a T or a Error.
Definition: Error.h:481
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
iterator end()
Definition: StringMap.h:220
iterator find(StringRef Key)
Definition: StringMap.h:233
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
An ExecutionSession represents a running JIT program.
Definition: Core.h:1345
Represents an address in the executor process.
A handler or incoming WrapperFunctionResults – either return values from callWrapper* calls,...
void operator()(shared::WrapperFunctionResult WFR)
APIs for manipulating memory in the target process.
virtual void writePointersAsync(ArrayRef< tpctypes::PointerWrite > Ws, WriteResultFn OnWriteComplete)=0
Error writeUInt64s(ArrayRef< tpctypes::UInt64Write > Ws)
Error writeBuffers(ArrayRef< tpctypes::BufferWrite > Ws)
Error writeUInt32s(ArrayRef< tpctypes::UInt32Write > Ws)
Error writePointers(ArrayRef< tpctypes::PointerWrite > Ws)
Error writeUInt8s(ArrayRef< tpctypes::UInt8Write > Ws)
virtual void writeUInt8sAsync(ArrayRef< tpctypes::UInt8Write > Ws, WriteResultFn OnWriteComplete)=0
Error writeUInt16s(ArrayRef< tpctypes::UInt16Write > Ws)
virtual void writeUInt32sAsync(ArrayRef< tpctypes::UInt32Write > Ws, WriteResultFn OnWriteComplete)=0
unique_function< void(Error)> WriteResultFn
Callback function for asynchronous writes.
virtual void writeBuffersAsync(ArrayRef< tpctypes::BufferWrite > Ws, WriteResultFn OnWriteComplete)=0
virtual void writeUInt16sAsync(ArrayRef< tpctypes::UInt16Write > Ws, WriteResultFn OnWriteComplete)=0
virtual void writeUInt64sAsync(ArrayRef< tpctypes::UInt64Write > Ws, WriteResultFn OnWriteComplete)=0
Constructs an IncomingWFRHandler from a function object by creating a new function object that dispat...
Constructs an IncomingWFRHandler from a function object that is callable as void(shared::WrapperFunct...
ExecutorProcessControl supports interaction with a JIT target process.
jitlink::JITLinkMemoryManager & getMemMgr() const
Return a JITLinkMemoryManager for the target process.
shared::WrapperFunctionResult callWrapper(ExecutorAddr WrapperFnAddr, ArrayRef< char > ArgBuffer)
Run a wrapper function in the executor.
void callWrapperAsync(ExecutorAddr WrapperFnAddr, FnT &&OnComplete, ArrayRef< char > ArgBuffer)
Run a wrapper function in the executor.
virtual Expected< int32_t > runAsIntFunction(ExecutorAddr IntFnAddr, int Arg)=0
Run function with a int (*)(int) signature.
void callSPSWrapperAsync(RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr, SendResultT &&SendResult, const ArgTs &...Args)
Run a wrapper function using SPS to serialize the arguments and deserialize the results.
virtual Expected< int32_t > runAsMain(ExecutorAddr MainFnAddr, ArrayRef< std::string > Args)=0
Run function with a main-like signature.
Error getBootstrapMapValue(StringRef Key, std::optional< T > &Val) const
Look up and SPS-deserialize a bootstrap map value.
std::unique_ptr< TaskDispatcher > D
void callSPSWrapperAsync(ExecutorAddr WrapperFnAddr, SendResultT &&SendResult, const ArgTs &...Args)
Run a wrapper function using SPS to serialize the arguments and deserialize the results.
virtual void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer)=0
Run a wrapper function in the executor.
const StringMap< std::vector< char > > & getBootstrapMap() const
Returns the bootstrap map.
std::shared_ptr< SymbolStringPool > SSP
const Triple & getTargetTriple() const
Return the Triple for the target process.
StringMap< ExecutorAddr > BootstrapSymbols
SymbolStringPtr intern(StringRef SymName)
Intern a symbol name in the SymbolStringPool.
virtual Error disconnect()=0
Disconnect from the target process.
StringMap< std::vector< char > > BootstrapMap
std::shared_ptr< SymbolStringPool > getSymbolStringPool() const
Return a shared pointer to the SymbolStringPool for this instance.
const StringMap< ExecutorAddr > & getBootstrapSymbolsMap() const
Returns the bootstrap symbol map.
virtual Expected< int32_t > runAsVoidFunction(ExecutorAddr VoidFnAddr)=0
Run function with a int (*)(void) signature.
jitlink::JITLinkMemoryManager * MemMgr
unsigned getPageSize() const
Get the page size for the target process.
const JITDispatchInfo & getJITDispatchInfo() const
Get the JIT dispatch function and context address for the executor.
Error callSPSWrapper(ExecutorAddr WrapperFnAddr, WrapperCallArgTs &&...WrapperCallArgs)
Run a wrapper function using SPS to serialize the arguments and deserialize the results.
void callWrapperAsync(RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr, FnT &&OnComplete, ArrayRef< char > ArgBuffer)
Run a wrapper function in the executor using the given Runner to dispatch OnComplete when the result ...
Error getBootstrapSymbols(ArrayRef< std::pair< ExecutorAddr &, StringRef > > Pairs) const
For each (ExecutorAddr&, StringRef) pair, looks up the string in the bootstrap symbols map and writes...
ExecutionSession & getExecutionSession()
Return the ExecutionSession associated with this instance.
DylibManager & getDylibMgr() const
Return the DylibManager for the target process.
ExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP, std::unique_ptr< TaskDispatcher > D)
MemoryAccess & getMemoryAccess() const
Return a MemoryAccess object for the target process.
Runs all tasks on the current thread.
Definition: TaskDispatch.h:118
void writePointersAsync(ArrayRef< tpctypes::PointerWrite > Ws, WriteResultFn OnWriteComplete) override
void writeUInt32sAsync(ArrayRef< tpctypes::UInt32Write > Ws, WriteResultFn OnWriteComplete) override
void writeUInt8sAsync(ArrayRef< tpctypes::UInt8Write > Ws, WriteResultFn OnWriteComplete) override
void writeUInt16sAsync(ArrayRef< tpctypes::UInt16Write > Ws, WriteResultFn OnWriteComplete) override
void writeBuffersAsync(ArrayRef< tpctypes::BufferWrite > Ws, WriteResultFn OnWriteComplete) override
void writeUInt64sAsync(ArrayRef< tpctypes::UInt64Write > Ws, WriteResultFn OnWriteComplete) override
A ExecutorProcessControl implementation targeting the current process.
Error disconnect() override
Disconnect from the target process.
Expected< int32_t > runAsVoidFunction(ExecutorAddr VoidFnAddr) override
Run function with a int (*)(void) signature.
Expected< int32_t > runAsMain(ExecutorAddr MainFnAddr, ArrayRef< std::string > Args) override
Run function with a main-like signature.
void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer) override
Run a wrapper function in the executor.
static Expected< std::unique_ptr< SelfExecutorProcessControl > > Create(std::shared_ptr< SymbolStringPool > SSP=nullptr, std::unique_ptr< TaskDispatcher > D=nullptr, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr=nullptr)
Create a SelfExecutorProcessControl with the given symbol string pool and memory manager.
Expected< int32_t > runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override
Run function with a int (*)(int) signature.
String pool for symbol names used by the JIT.
Pointer to a pooled string representing a symbol name.
Abstract base for classes that dispatch ORC Tasks.
Definition: TaskDispatch.h:106
virtual void dispatch(std::unique_ptr< Task > T)=0
Run the given task.
A ExecutorProcessControl instance that asserts if any of its methods are used.
Expected< int32_t > runAsMain(ExecutorAddr MainFnAddr, ArrayRef< std::string > Args) override
Run function with a main-like signature.
UnsupportedExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP=nullptr, std::unique_ptr< TaskDispatcher > D=nullptr, const std::string &TT="", unsigned PageSize=0)
void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer) override
Run a wrapper function in the executor.
Error disconnect() override
Disconnect from the target process.
Expected< int32_t > runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override
Run function with a int (*)(int) signature.
Expected< int32_t > runAsVoidFunction(ExecutorAddr VoidFnAddr) override
Run function with a int (*)(void) signature.
A utility class for serializing to a blob from a variadic list.
Input char buffer with underflow check.
C++ wrapper function result: Same as CWrapperFunctionResult but auto-releases memory.
unique_function is a type-erasing functor similar to std::function.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::unique_ptr< GenericNamedTask > makeGenericNamedTask(FnT &&Fn, std::string Desc)
Create a generic named task from a std::string description.
Definition: TaskDispatch.h:79
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:98
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1873
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
Contains the address of the dispatch function and context that the ORC runtime can use to call functi...