13#ifndef LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
14#define LLVM_EXECUTIONENGINE_ORC_EXECUTORPROCESSCONTROL_H
57 explicit operator bool()
const {
return !!H; }
74 template <
typename FnT>
89 template <
typename FnT>
92 [&D = this->D, Fn = std::move(Fn)]
96 [Fn = std::move(Fn), WFR = std::move(WFR)]()
mutable {
98 },
"WFR handler task"));
106 std::unique_ptr<TaskDispatcher>
D)
114 assert(
ES &&
"No ExecutionSession associated yet");
149 template <
typename T,
typename SPSTagT>
164 Val = std::move(Tmp);
177 ArrayRef<std::pair<ExecutorAddr &, StringRef>> Pairs)
const {
178 for (
const auto &KV : Pairs) {
183 "in bootstrap symbols map",
186 KV.first =
I->second;
209 template <
typename RunPolicyT,
typename FnT>
213 WrapperFnAddr, Runner(std::forward<FnT>(OnComplete)), ArgBuffer);
218 template <
typename FnT>
222 std::forward<FnT>(OnComplete), ArgBuffer);
232 std::shared_ptr<SymbolStringPool>
SSP;
233 std::unique_ptr<TaskDispatcher>
D;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
Manages allocations of JIT memory.
An ExecutionSession represents a running JIT program.
Represents an address in the executor process.
A handler or incoming WrapperFunctionBuffers – either return values from callWrapper* calls,...
void operator()(shared::WrapperFunctionBuffer WFR)
IncomingWFRHandler()=default
friend class ExecutorProcessControl
Constructs an IncomingWFRHandler from a function object by creating a new function object that dispat...
IncomingWFRHandler operator()(FnT &&Fn)
RunAsTask(TaskDispatcher &D)
Constructs an IncomingWFRHandler from a function object that is callable as void(shared::WrapperFunct...
IncomingWFRHandler operator()(FnT &&Fn)
void callWrapperAsync(ExecutorAddr WrapperFnAddr, FnT &&OnComplete, ArrayRef< char > ArgBuffer)
Run a wrapper function in the executor.
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
virtual void callWrapperAsync(ExecutorAddr WrapperFnAddr, IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer)=0
Run a wrapper function in the executor.
virtual Expected< std::unique_ptr< MemoryAccess > > createDefaultMemoryAccess()=0
Create a default MemoryAccess for the target process.
const StringMap< std::vector< char > > & getBootstrapMap() const
Returns the bootstrap map.
virtual Expected< std::unique_ptr< DylibManager > > createDefaultDylibMgr()=0
Create a default DylibManager for the target process.
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.
unsigned getPageSize() const
Get the page size for the target process.
virtual Expected< std::unique_ptr< jitlink::JITLinkMemoryManager > > createDefaultMemoryManager()=0
Create a default JITLinkMemoryManager for the target process.
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.
ExecutorProcessControl(std::shared_ptr< SymbolStringPool > SSP, std::unique_ptr< TaskDispatcher > D)
friend class ExecutionSession
TaskDispatcher & getDispatcher()
virtual ~ExecutorProcessControl()
APIs for manipulating memory in the target process.
Pointer to a pooled string representing a symbol name.
Abstract base for classes that dispatch ORC Tasks.
A utility class for serializing to a blob from a variadic list.
C++ wrapper function buffer: Same as CWrapperFunctionBuffer but auto-releases memory.
unique_function is a type-erasing functor similar to std::function.
std::unique_ptr< GenericNamedTask > makeGenericNamedTask(FnT &&Fn, std::string Desc)
Create a generic named task from a std::string description.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
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.