/// \endcode{.cpp}
///
/// The given OnComplete function will be called to return the result.
- void callWrapperAsync(ExecutorProcessControl::SendResultFunction OnComplete,
- ExecutorAddr WrapperFnAddr, ArrayRef<char> ArgBuffer) {
- EPC->callWrapperAsync(std::move(OnComplete), WrapperFnAddr, ArgBuffer);
+ void callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ ExecutorProcessControl::SendResultFunction OnComplete,
+ ArrayRef<char> ArgBuffer) {
+ EPC->callWrapperAsync(WrapperFnAddr, std::move(OnComplete), ArgBuffer);
}
/// Run a wrapper function in the executor. The wrapper function should be
/// Run a wrapper function using SPS to serialize the arguments and
/// deserialize the results.
template <typename SPSSignature, typename SendResultT, typename... ArgTs>
- void callSPSWrapperAsync(SendResultT &&SendResult, ExecutorAddr WrapperFnAddr,
+ void callSPSWrapperAsync(ExecutorAddr WrapperFnAddr, SendResultT &&SendResult,
const ArgTs &...Args) {
EPC->callSPSWrapperAsync<SPSSignature, SendResultT, ArgTs...>(
- std::forward<SendResultT>(SendResult), WrapperFnAddr, Args...);
+ WrapperFnAddr, std::forward<SendResultT>(SendResult), Args...);
}
/// Run a wrapper function using SPS to serialize the arguments and
WriteResultFn OnWriteComplete) override {
using namespace shared;
EPC.callSPSWrapperAsync<void(SPSSequence<SPSMemoryAccessUInt8Write>)>(
- std::move(OnWriteComplete), FAs.WriteUInt8s, Ws);
+ FAs.WriteUInt8s, std::move(OnWriteComplete), Ws);
}
void writeUInt16sAsync(ArrayRef<tpctypes::UInt16Write> Ws,
WriteResultFn OnWriteComplete) override {
using namespace shared;
EPC.callSPSWrapperAsync<void(SPSSequence<SPSMemoryAccessUInt16Write>)>(
- std::move(OnWriteComplete), FAs.WriteUInt16s, Ws);
+ FAs.WriteUInt16s, std::move(OnWriteComplete), Ws);
}
void writeUInt32sAsync(ArrayRef<tpctypes::UInt32Write> Ws,
WriteResultFn OnWriteComplete) override {
using namespace shared;
EPC.callSPSWrapperAsync<void(SPSSequence<SPSMemoryAccessUInt32Write>)>(
- std::move(OnWriteComplete), FAs.WriteUInt32s, Ws);
+ FAs.WriteUInt32s, std::move(OnWriteComplete), Ws);
}
void writeUInt64sAsync(ArrayRef<tpctypes::UInt64Write> Ws,
WriteResultFn OnWriteComplete) override {
using namespace shared;
EPC.callSPSWrapperAsync<void(SPSSequence<SPSMemoryAccessUInt64Write>)>(
- std::move(OnWriteComplete), FAs.WriteUInt64s, Ws);
+ FAs.WriteUInt64s, std::move(OnWriteComplete), Ws);
}
void writeBuffersAsync(ArrayRef<tpctypes::BufferWrite> Ws,
WriteResultFn OnWriteComplete) override {
using namespace shared;
EPC.callSPSWrapperAsync<void(SPSSequence<SPSMemoryAccessBufferWrite>)>(
- std::move(OnWriteComplete), FAs.WriteBuffers, Ws);
+ FAs.WriteBuffers, std::move(OnWriteComplete), Ws);
}
private:
/// \endcode{.cpp}
///
/// The given OnComplete function will be called to return the result.
- virtual void callWrapperAsync(SendResultFunction OnComplete,
- ExecutorAddr WrapperFnAddr,
+ virtual void callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ SendResultFunction OnComplete,
ArrayRef<char> ArgBuffer) = 0;
/// Run a wrapper function in the executor. The wrapper function should be
std::promise<shared::WrapperFunctionResult> RP;
auto RF = RP.get_future();
callWrapperAsync(
+ WrapperFnAddr,
[&](shared::WrapperFunctionResult R) { RP.set_value(std::move(R)); },
- WrapperFnAddr, ArgBuffer);
+ ArgBuffer);
return RF.get();
}
/// Run a wrapper function using SPS to serialize the arguments and
/// deserialize the results.
template <typename SPSSignature, typename SendResultT, typename... ArgTs>
- void callSPSWrapperAsync(SendResultT &&SendResult, ExecutorAddr WrapperFnAddr,
+ void callSPSWrapperAsync(ExecutorAddr WrapperFnAddr, SendResultT &&SendResult,
const ArgTs &...Args) {
shared::WrapperFunction<SPSSignature>::callAsync(
[this,
WrapperFnAddr](ExecutorProcessControl::SendResultFunction SendResult,
const char *ArgData, size_t ArgSize) {
- callWrapperAsync(std::move(SendResult), WrapperFnAddr,
+ callWrapperAsync(WrapperFnAddr, std::move(SendResult),
ArrayRef<char>(ArgData, ArgSize));
},
std::move(SendResult), Args...);
llvm_unreachable("Unsupported");
}
- void callWrapperAsync(SendResultFunction OnComplete,
- ExecutorAddr WrapperFnAddr,
+ void callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ SendResultFunction OnComplete,
ArrayRef<char> ArgBuffer) override {
llvm_unreachable("Unsupported");
}
Expected<int32_t> runAsMain(ExecutorAddr MainFnAddr,
ArrayRef<std::string> Args) override;
- void callWrapperAsync(SendResultFunction OnComplete,
- ExecutorAddr WrapperFnAddr,
+ void callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ SendResultFunction OnComplete,
ArrayRef<char> ArgBuffer) override;
Error disconnect() override;
Expected<int32_t> runAsMain(ExecutorAddr MainFnAddr,
ArrayRef<std::string> Args) override;
- void callWrapperAsync(SendResultFunction OnComplete,
- ExecutorAddr WrapperFnAddr,
+ void callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ SendResultFunction OnComplete,
ArrayRef<char> ArgBuffer) override;
Error disconnect() override;
}
Parent.EPC.callSPSWrapperAsync<
rt::SPSSimpleExecutorMemoryManagerFinalizeSignature>(
+ Parent.SAs.Finalize,
[OnFinalize = std::move(OnFinalize)](Error SerializationErr,
Error FinalizeErr) {
if (SerializationErr)
else
OnFinalize(std::move(FinalizeErr));
},
- Parent.SAs.Finalize, Parent.SAs.Allocator, std::move(FR));
+ Parent.SAs.Allocator, std::move(FR));
}
Error deallocate() override {
return orc::runAsMain(MainFnAddr.toPtr<MainTy>(), Args);
}
-void SelfExecutorProcessControl::callWrapperAsync(SendResultFunction SendResult,
- ExecutorAddr WrapperFnAddr,
+void SelfExecutorProcessControl::callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ SendResultFunction SendResult,
ArrayRef<char> ArgBuffer) {
using WrapperFnTy =
shared::detail::CWrapperFunctionResult (*)(const char *Data, size_t Size);
return Result;
}
-void SimpleRemoteEPC::callWrapperAsync(SendResultFunction OnComplete,
- ExecutorAddr WrapperFnAddr,
+void SimpleRemoteEPC::callWrapperAsync(ExecutorAddr WrapperFnAddr,
+ SendResultFunction OnComplete,
ArrayRef<char> ArgBuffer) {
uint64_t SeqNo;
{
ExecutionSession ES(cantFail(SelfExecutorProcessControl::Create()));
std::promise<MSVCPError> RP;
- ES.callSPSWrapperAsync<void()>(
- [&](Error SerializationErr) {
- RP.set_value(std::move(SerializationErr));
- },
- ExecutorAddr::fromPtr(voidWrapper));
+ ES.callSPSWrapperAsync<void()>(ExecutorAddr::fromPtr(voidWrapper),
+ [&](Error SerializationErr) {
+ RP.set_value(std::move(SerializationErr));
+ });
Error Err = RP.get_future().get();
EXPECT_THAT_ERROR(std::move(Err), Succeeded());
}
std::promise<MSVCPExpected<int32_t>> RP;
ES.callSPSWrapperAsync<int32_t(int32_t, int32_t)>(
+ ExecutorAddr::fromPtr(addWrapper),
[&](Error SerializationErr, int32_t R) {
if (SerializationErr)
RP.set_value(std::move(SerializationErr));
RP.set_value(std::move(R));
},
- ExecutorAddr::fromPtr(addWrapper), 2, 3);
+ 2, 3);
Expected<int32_t> Result = RP.get_future().get();
EXPECT_THAT_EXPECTED(Result, HasValue(5));
}