22#ifndef LLVM_EXECUTIONENGINE_ORC_PROXY_H
23#define LLVM_EXECUTIONENGINE_ORC_PROXY_H
45 explicit operator bool()
const {
return !!CalleeAddr; }
51template <
typename FnT>
class Proxy;
79 using type = std::promise<MSVCPError>;
82 using type = std::promise<MSVCPExpected<T>>;
96template <
typename RetT,
typename... ArgTs>
112 const ArgTs &...Args);
116 :
ProxyBase(CalleeAddr), Dispatch(Dispatch) {}
122 assert(Dispatch &&
"Proxy's Dispatch member is not set");
130 auto F =
P.get_future();
132 [
P = std::move(
P)](
ErrorRetT R)
mutable {
P.set_value(std::move(R)); },
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
An ExecutionSession represents a running JIT program.
Represents an address in the executor process.
const ExecutorAddr & calleeAddr() const
Returns the address of the callee in the executor.
ProxyBase(ExecutorAddr CalleeAddr)
void(*)(unique_function< void(ErrorRetT)> OnComplete, ExecutionSession &ES, ExecutorAddr Callee, const ArgTs &...Args) DispatchFn
ErrorRetT operator()(ExecutionSession &ES, const ArgTs &...Args) const
Invoke the operation with the given Args, blocking until its result (or an error) is available.
Proxy(DispatchFn Dispatch, ExecutorAddr CalleeAddr)
void operator()(unique_function< void(ErrorRetT)> OnComplete, ExecutionSession &ES, const ArgTs &...Args) const
Asynchronously invoke the operation with the given Args, delivering its result (or an error) to OnCom...
RetT CalleeRetT
The result type produced by the executor-side function itself.
typename detail::ProxyErrorRet< RetT >::type ErrorRetT
The result type delivered to the client: Error when the callee returns void or Error,...
unique_function is a type-erasing functor similar to std::function.
Maps a proxy's callee return type to the type delivered to the client, so a dispatch failure can alwa...
std::promise< MSVCPError > type
std::promise< MSVCPExpected< T > > type
Maps a proxy's client-facing return type to the std::promise value type used by the blocking call ope...