[llvm] a4e311d - [ORC] Call createPThreadKey through a Proxy in MachO/ELFNixPlatform (#226656)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 26 03:09:32 PDT 2026
Author: Lang Hames
Date: 2026-09-26T20:09:26+10:00
New Revision: a4e311d3f80f0bc1b0912d3f9f650a8d949a06e5
URL: https://github.com/llvm/llvm-project/commit/a4e311d3f80f0bc1b0912d3f9f650a8d949a06e5
DIFF: https://github.com/llvm/llvm-project/commit/a4e311d3f80f0bc1b0912d3f9f650a8d949a06e5.diff
LOG: [ORC] Call createPThreadKey through a Proxy in MachO/ELFNixPlatform (#226656)
Replace the callSPSWrapper calls in MachOPlatform::createPThreadKey and
ELFNixPlatform::createPThreadKey with a Proxy built over the address
recorded during bootstrap, using a local CI descriptor for each
platform's create_pthread_key wrapper. The address stays in the
platforms' RuntimeFunction table, which is filled uniformly by the
bootstrap recording pass.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
index dc03d2047e943..5a8e37a5898ba 100644
--- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
@@ -15,6 +15,7 @@
#include "llvm/ExecutionEngine/JITLink/systemz.h"
#include "llvm/ExecutionEngine/JITLink/x86_64.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
+#include "llvm/ExecutionEngine/Orc/SPSProxySpec.h"
#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/Support/Debug.h"
@@ -26,6 +27,16 @@ using namespace llvm;
using namespace llvm::orc;
using namespace llvm::orc::shared;
+// Controller-interface descriptors for the ELFNix platform runtime's SPS
+// wrapper calls.
+namespace llvm::orc::elfnix_sps_ci {
+struct CreatePThreadKey {
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::c("__orc_rt_elfnix_create_pthread_key");
+ using SPSSig = SPSExpected<uint64_t>();
+};
+} // namespace llvm::orc::elfnix_sps_ci
+
namespace {
template <typename SPSSerializer, typename... ArgTs>
@@ -727,11 +738,12 @@ Expected<uint64_t> ELFNixPlatform::createPThreadKey() {
"not been loaded yet",
inconvertibleErrorCode());
- Expected<uint64_t> Result(0);
- if (auto Err = ES.callSPSWrapper<SPSExpected<uint64_t>(void)>(
- CreatePThreadKey.Addr, Result))
- return std::move(Err);
- return Result;
+ using CreatePThreadKeyProxy = Proxy<Expected<uint64_t>()>;
+ CreatePThreadKeyProxy CreateKey(
+ sps::ProxySpec<CreatePThreadKeyProxy,
+ elfnix_sps_ci::CreatePThreadKey>::dispatch,
+ CreatePThreadKey.Addr);
+ return CreateKey(ES);
}
void ELFNixPlatform::ELFNixPlatformPlugin::modifyPassConfig(
diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index 2e9fa50d7cff7..fc4f2c86361f9 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -16,6 +16,7 @@
#include "llvm/ExecutionEngine/JITLink/x86_64.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/MachOBuilder.h"
+#include "llvm/ExecutionEngine/Orc/SPSProxySpec.h"
#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
#include "llvm/Support/Debug.h"
#include <optional>
@@ -87,6 +88,16 @@ class SPSSerializationTraits<SPSMachOExecutorSymbolFlags,
} // namespace orc
} // namespace llvm
+// Controller-interface descriptors for the MachO platform runtime's SPS
+// wrapper calls.
+namespace llvm::orc::macho_sps_ci {
+struct CreatePThreadKey {
+ static constexpr SymbolNameSpec Name =
+ SymbolNameSpec::c("__orc_rt_macho_create_pthread_key");
+ using SPSSig = SPSExpected<uint64_t>();
+};
+} // namespace llvm::orc::macho_sps_ci
+
namespace {
using SPSRegisterSymbolsArgs =
@@ -799,11 +810,12 @@ Expected<uint64_t> MachOPlatform::createPThreadKey() {
"not been loaded yet",
inconvertibleErrorCode());
- Expected<uint64_t> Result(0);
- if (auto Err = ES.callSPSWrapper<SPSExpected<uint64_t>(void)>(
- CreatePThreadKey.Addr, Result))
- return std::move(Err);
- return Result;
+ using CreatePThreadKeyProxy = Proxy<Expected<uint64_t>()>;
+ CreatePThreadKeyProxy CreateKey(
+ sps::ProxySpec<CreatePThreadKeyProxy,
+ macho_sps_ci::CreatePThreadKey>::dispatch,
+ CreatePThreadKey.Addr);
+ return CreateKey(ES);
}
void MachOPlatform::MachOPlatformPlugin::modifyPassConfig(
More information about the llvm-commits
mailing list