22#ifndef LLVM_EXECUTIONENGINE_ORC_SPSPROXYSPEC_H
23#define LLVM_EXECUTIONENGINE_ORC_SPSPROXYSPEC_H
37template <
typename CI,
typename SPSSigT =
typename CI::SPSSig>
class ProxySpec;
39template <
typename CI,
typename SPSRetTagT,
typename... SPSArgTagTs>
42 using SPSSigT = SPSRetTagT(SPSArgTagTs...);
44 template <
typename X>
struct IsSPSExpected : std::false_type {};
46 struct IsSPSExpected<
shared::SPSExpected<X>> : std::true_type {};
57 template <
typename ErrorRetT>
struct CalleeRet {
58 static_assert(std::is_same_v<ErrorRetT, Error>,
59 "ErrorRetT must be Error or Expected<T>");
60 using type = std::conditional_t<std::is_void_v<SPSRetTagT>, void,
Error>;
62 template <
typename T>
struct CalleeRet<
Expected<
T>> {
64 std::conditional_t<IsSPSExpected<SPSRetTagT>::value,
Expected<T>,
T>;
69 template <
typename T>
static void consumeResult(
T &
V) {}
71 template <
typename T>
static void consumeResult(
Expected<T> &
E) {
81 template <
typename ErrorRetT,
typename... ArgTs>
84 const ArgTs &...Args) {
85 using CalleeRetT =
typename CalleeRet<ErrorRetT>::type;
87 std::is_same_v<typename orc::detail::ProxyErrorRet<CalleeRetT>::type,
89 "CalleeRet must invert ProxyErrorRet");
91 auto Caller = [&ES, CalleeAddr](
auto &&SendResult,
const char *ArgData,
94 std::forward<
decltype(SendResult)>(SendResult),
98 if constexpr (std::is_void_v<CalleeRetT>) {
106 [OnComplete = std::move(OnComplete)](
Error SerErr,
107 CalleeRetT
Result)
mutable {
110 return OnComplete(std::move(SerErr));
114 return OnComplete(std::move(
Result));
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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.
An ExecutionSession represents a running JIT program.
void callWrapperAsync(ExecutorAddr WrapperFnAddr, ExecutorProcessControl::IncomingWFRHandler OnComplete, ArrayRef< char > ArgBuffer)
Run a wrapper function in the executor.
Represents an address in the executor process.
A symbol name together with the naming level (SymbolNameKind) it is expressed in, so that a Mangler /...
static constexpr SymbolNameSpec Name
static void dispatch(unique_function< void(ErrorRetT)> OnComplete, ExecutionSession &ES, ExecutorAddr CalleeAddr, const ArgTs &...Args)
Dispatch function for any Proxy whose arguments and result are serializable with CI::SPSSig.
Dispatches proxies for the call described by CI, which must provide:
unique_function is a type-erasing functor similar to std::function.
void consumeError(Error Err)
Consume a Error without doing anything.