[PATCH] D111528: [Orc] Allow in-band errors for runAsMain() via SPS
Stefan Gränitz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 01:39:52 PDT 2021
sgraenitz created this revision.
sgraenitz added a reviewer: lhames.
Herald added a subscriber: hiraditya.
sgraenitz requested review of this revision.
Herald added a project: LLVM.
`runAsMain()` may fail for function-specific reasons (e.g. provided pointer to main is invalid). There should be a way to propagate such in-band errors back to the controller.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111528
Files:
llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
Index: llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
+++ llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
@@ -51,7 +51,7 @@
return WrapperFunction<rt::SPSRunAsMainSignature>::handle(
ArgData, ArgSize,
[](ExecutorAddr MainAddr,
- std::vector<std::string> Args) -> int64_t {
+ std::vector<std::string> Args) -> Expected<int64_t> {
return runAsMain(MainAddr.toPtr<int (*)(int, char *[])>(), Args);
})
.release();
Index: llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
+++ llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
@@ -47,7 +47,7 @@
Expected<int32_t> SimpleRemoteEPC::runAsMain(ExecutorAddr MainFnAddr,
ArrayRef<std::string> Args) {
- int64_t Result = 0;
+ Expected<int64_t> Result(0);
if (auto Err = callSPSWrapper<rt::SPSRunAsMainSignature>(
RunAsMainAddr, Result, ExecutorAddr(MainFnAddr), Args))
return std::move(Err);
Index: llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
+++ llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
@@ -58,8 +58,8 @@
using SPSSimpleExecutorMemoryManagerDeallocateSignature = shared::SPSError(
shared::SPSExecutorAddr, shared::SPSSequence<shared::SPSExecutorAddr>);
-using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddr,
- shared::SPSSequence<shared::SPSString>);
+using SPSRunAsMainSignature = shared::SPSExpected<int64_t>(
+ shared::SPSExecutorAddr, shared::SPSSequence<shared::SPSString>);
} // end namespace rt
} // end namespace orc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111528.378592.patch
Type: text/x-patch
Size: 2038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211011/2a51af06/attachment.bin>
More information about the llvm-commits
mailing list