aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/compiler-rt/lib/orc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/compiler-rt/lib/orc')
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/coff_platform.cpp12
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/common.h2
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/debug.h2
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/dlfcn_wrapper.cpp6
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/elfnix_platform.cpp45
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp217
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/run_program_wrapper.cpp2
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/tests/unit/c_api_test.cpp86
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp24
-rw-r--r--contrib/llvm-project/compiler-rt/lib/orc/wrapper_function_utils.h40
10 files changed, 156 insertions, 280 deletions
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/coff_platform.cpp b/contrib/llvm-project/compiler-rt/lib/orc/coff_platform.cpp
index 83ce07b1bcf8..78c86c855dcb 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/coff_platform.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/coff_platform.cpp
@@ -595,19 +595,19 @@ void *COFFPlatformRuntimeState::findJITDylibBaseByPC(uint64_t PC) {
return Range.Header;
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_platform_bootstrap(char *ArgData, size_t ArgSize) {
COFFPlatformRuntimeState::initialize();
return WrapperFunctionResult().release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_platform_shutdown(char *ArgData, size_t ArgSize) {
COFFPlatformRuntimeState::destroy();
return WrapperFunctionResult().release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_register_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSString, SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -618,7 +618,7 @@ __orc_rt_coff_register_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_deregister_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -629,7 +629,7 @@ __orc_rt_coff_deregister_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_register_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr, SPSCOFFObjectSectionsMap,
bool)>::
@@ -644,7 +644,7 @@ __orc_rt_coff_register_object_sections(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_deregister_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr, SPSCOFFObjectSectionsMap)>::
handle(ArgData, ArgSize,
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/common.h b/contrib/llvm-project/compiler-rt/lib/orc/common.h
index 5e01feee759b..73c5c4a2bd8d 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/common.h
+++ b/contrib/llvm-project/compiler-rt/lib/orc/common.h
@@ -41,7 +41,7 @@ ORC_RT_IMPORT __orc_rt_Opaque __orc_rt_jit_dispatch_ctx ORC_RT_WEAK_IMPORT;
/// This is declared for use by the runtime, but should be implemented in the
/// executor or provided by a definition added to the JIT before the runtime
/// is loaded.
-ORC_RT_IMPORT __orc_rt_CWrapperFunctionResult
+ORC_RT_IMPORT orc_rt_CWrapperFunctionResult
__orc_rt_jit_dispatch(__orc_rt_Opaque *DispatchCtx, const void *FnTag,
const char *Data, size_t Size) ORC_RT_WEAK_IMPORT;
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/debug.h b/contrib/llvm-project/compiler-rt/lib/orc/debug.h
index 4605d441c7cb..a0bc653d032e 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/debug.h
+++ b/contrib/llvm-project/compiler-rt/lib/orc/debug.h
@@ -53,4 +53,4 @@ void printdbg(const char *format, ...);
#define ORC_RT_DEBUG(X) ORC_RT_DEBUG_WITH_TYPE(DEBUG_TYPE, X)
-#endif // ORC_RT_COMMON_H
+#endif // ORC_RT_DEBUG_H
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/dlfcn_wrapper.cpp b/contrib/llvm-project/compiler-rt/lib/orc/dlfcn_wrapper.cpp
index c513aae97bb3..ece63da2cb48 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/dlfcn_wrapper.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/dlfcn_wrapper.cpp
@@ -22,7 +22,7 @@ extern "C" const char *__orc_rt_jit_dlerror();
extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
extern "C" int __orc_rt_jit_dlclose(void *dso_handle);
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlerror_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSString()>::handle(
ArgData, ArgSize,
@@ -30,7 +30,7 @@ __orc_rt_jit_dlerror_wrapper(const char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSExecutorAddr(SPSString, int32_t)>::handle(
ArgData, ArgSize,
@@ -41,7 +41,7 @@ __orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlclose_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/elfnix_platform.cpp b/contrib/llvm-project/compiler-rt/lib/orc/elfnix_platform.cpp
index 771e21d72e2d..c087e71038f9 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/elfnix_platform.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/elfnix_platform.cpp
@@ -12,6 +12,7 @@
#include "elfnix_platform.h"
#include "common.h"
+#include "compiler.h"
#include "error.h"
#include "wrapper_function_utils.h"
@@ -33,8 +34,13 @@ ORC_RT_JIT_DISPATCH_TAG(__orc_rt_elfnix_symbol_lookup_tag)
// eh-frame registration functions, made available via aliases
// installed by the Platform
-extern "C" void __orc_rt_register_eh_frame_section(const void *);
-extern "C" void __orc_rt_deregister_eh_frame_section(const void *);
+extern "C" void __register_frame(const void *);
+extern "C" void __deregister_frame(const void *);
+
+extern "C" void
+__unw_add_dynamic_eh_frame_section(const void *) ORC_RT_WEAK_IMPORT;
+extern "C" void
+__unw_remove_dynamic_eh_frame_section(const void *) ORC_RT_WEAK_IMPORT;
namespace {
@@ -96,8 +102,7 @@ public:
static ELFNixPlatformRuntimeState &get();
static void destroy();
- ELFNixPlatformRuntimeState(void *DSOHandle)
- : PlatformJDDSOHandle(DSOHandle) {}
+ ELFNixPlatformRuntimeState(void *DSOHandle);
// Delete copy and move constructors.
ELFNixPlatformRuntimeState(const ELFNixPlatformRuntimeState &) = delete;
@@ -143,6 +148,10 @@ private:
void *PlatformJDDSOHandle;
+ // Frame registration functions:
+ void (*registerEHFrameSection)(const void *) = nullptr;
+ void (*deregisterEHFrameSection)(const void *) = nullptr;
+
// FIXME: Move to thread-state.
std::string DLFcnError;
@@ -171,11 +180,22 @@ void ELFNixPlatformRuntimeState::destroy() {
delete MOPS;
}
+ELFNixPlatformRuntimeState::ELFNixPlatformRuntimeState(void *DSOHandle)
+ : PlatformJDDSOHandle(DSOHandle) {
+ if (__unw_add_dynamic_eh_frame_section &&
+ __unw_remove_dynamic_eh_frame_section) {
+ registerEHFrameSection = __unw_add_dynamic_eh_frame_section;
+ deregisterEHFrameSection = __unw_remove_dynamic_eh_frame_section;
+ } else {
+ registerEHFrameSection = __register_frame;
+ deregisterEHFrameSection = __deregister_frame;
+ }
+}
+
Error ELFNixPlatformRuntimeState::registerObjectSections(
ELFNixPerObjectSectionsToRegister POSR) {
if (POSR.EHFrameSection.Start)
- __orc_rt_register_eh_frame_section(
- POSR.EHFrameSection.Start.toPtr<const char *>());
+ registerEHFrameSection(POSR.EHFrameSection.Start.toPtr<const char *>());
if (POSR.ThreadDataSection.Start) {
if (auto Err = registerThreadDataSection(
@@ -189,8 +209,7 @@ Error ELFNixPlatformRuntimeState::registerObjectSections(
Error ELFNixPlatformRuntimeState::deregisterObjectSections(
ELFNixPerObjectSectionsToRegister POSR) {
if (POSR.EHFrameSection.Start)
- __orc_rt_deregister_eh_frame_section(
- POSR.EHFrameSection.Start.toPtr<const char *>());
+ deregisterEHFrameSection(POSR.EHFrameSection.Start.toPtr<const char *>());
return Error::success();
}
@@ -451,7 +470,7 @@ void destroyELFNixTLVMgr(void *ELFNixTLVMgr) {
// JIT entry points
//------------------------------------------------------------------------------
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_platform_bootstrap(char *ArgData, size_t ArgSize) {
return WrapperFunction<void(uint64_t)>::handle(
ArgData, ArgSize,
@@ -462,14 +481,14 @@ __orc_rt_elfnix_platform_bootstrap(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_platform_shutdown(char *ArgData, size_t ArgSize) {
ELFNixPlatformRuntimeState::destroy();
return WrapperFunctionResult().release();
}
/// Wrapper function for registering metadata on a per-object basis.
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_register_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSELFNixPerObjectSectionsToRegister)>::
handle(ArgData, ArgSize,
@@ -481,7 +500,7 @@ __orc_rt_elfnix_register_object_sections(char *ArgData, size_t ArgSize) {
}
/// Wrapper for releasing per-object metadat.
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_deregister_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSELFNixPerObjectSectionsToRegister)>::
handle(ArgData, ArgSize,
@@ -517,7 +536,7 @@ ORC_RT_INTERFACE ptrdiff_t ___orc_rt_elfnix_tlsdesc_resolver_impl(
return TLVPtr - ThreadPointer;
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_create_pthread_key(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSExpected<uint64_t>(void)>::handle(
ArgData, ArgSize,
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp b/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
index 9b5b954921c1..cb248aae0666 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
@@ -36,40 +36,18 @@ using namespace __orc_rt::macho;
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_push_initializers_tag)
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_symbol_lookup_tag)
-// Objective-C types.
-struct objc_class;
struct objc_image_info;
-struct objc_object;
-struct objc_selector;
-
-using Class = objc_class *;
-using id = objc_object *;
-using SEL = objc_selector *;
+struct mach_header;
// Objective-C registration functions.
// These are weakly imported. If the Objective-C runtime has not been loaded
// then code containing Objective-C sections will generate an error.
-extern "C" id objc_msgSend(id, SEL, ...) ORC_RT_WEAK_IMPORT;
-extern "C" Class objc_readClassPair(Class,
- const objc_image_info *) ORC_RT_WEAK_IMPORT;
-extern "C" SEL sel_registerName(const char *) ORC_RT_WEAK_IMPORT;
-
-// Swift types.
-class ProtocolRecord;
-class ProtocolConformanceRecord;
-class TypeMetadataRecord;
-
extern "C" void
-swift_registerProtocols(const ProtocolRecord *begin,
- const ProtocolRecord *end) ORC_RT_WEAK_IMPORT;
+_objc_map_images(unsigned count, const char *const paths[],
+ const mach_header *const mhdrs[]) ORC_RT_WEAK_IMPORT;
-extern "C" void swift_registerProtocolConformances(
- const ProtocolConformanceRecord *begin,
- const ProtocolConformanceRecord *end) ORC_RT_WEAK_IMPORT;
-
-extern "C" void swift_registerTypeMetadataRecords(
- const TypeMetadataRecord *begin,
- const TypeMetadataRecord *end) ORC_RT_WEAK_IMPORT;
+extern "C" void _objc_load_image(const char *path,
+ const mach_header *mh) ORC_RT_WEAK_IMPORT;
// Libunwind prototypes.
struct unw_dynamic_unwind_sections {
@@ -290,11 +268,7 @@ private:
std::unordered_map<void *, size_t> ZeroInitRanges;
UnwindSectionsMap UnwindSections;
RecordSectionsTracker<void (*)()> ModInitsSections;
- RecordSectionsTracker<void *> ObjCClassListSections;
- RecordSectionsTracker<void *> ObjCSelRefsSections;
- RecordSectionsTracker<char> Swift5ProtocolsSections;
- RecordSectionsTracker<char> Swift5ProtocolConformancesSections;
- RecordSectionsTracker<char> Swift5TypesSections;
+ RecordSectionsTracker<char> ObjCRuntimeRegistrationObjects;
bool referenced() const {
return LinkedAgainstRefCount != 0 || DlRefCount != 0;
@@ -357,11 +331,7 @@ private:
static Error registerEHFrames(span<const char> EHFrameSection);
static Error deregisterEHFrames(span<const char> EHFrameSection);
- static Error registerObjCSelectors(JITDylibState &JDS);
- static Error registerObjCClasses(JITDylibState &JDS);
- static Error registerSwift5Protocols(JITDylibState &JDS);
- static Error registerSwift5ProtocolConformances(JITDylibState &JDS);
- static Error registerSwift5Types(JITDylibState &JDS);
+ static Error registerObjCRegistrationObjects(JITDylibState &JDS);
static Error runModInits(std::unique_lock<std::mutex> &JDStatesLock,
JITDylibState &JDS);
@@ -437,8 +407,7 @@ Error MachOPlatformRuntimeState::initialize() {
}
Error MachOPlatformRuntimeState::shutdown() {
- if (__unw_add_find_dynamic_unwind_sections &&
- __unw_remove_find_dynamic_unwind_sections) {
+ if (UseCallbackStyleUnwindInfo) {
if (__unw_remove_find_dynamic_unwind_sections(&findDynamicUnwindSections)) {
ORC_RT_DEBUG(
{ printdbg("__unw_remove_find_dynamic_unwind_sections failed.\n"); });
@@ -581,22 +550,12 @@ Error MachOPlatformRuntimeState::registerObjectPlatformSections(
JDS->DataSectionContent[KV.second.Start.toPtr<char *>()] =
std::vector<char>(S.begin(), S.end());
} else if (KV.first == "__DATA,__common") {
- // fprintf(stderr, "Adding zero-init range %llx -- %llx\n",
- // KV.second.Start.getValue(), KV.second.size());
JDS->ZeroInitRanges[KV.second.Start.toPtr<char *>()] = KV.second.size();
} else if (KV.first == "__DATA,__thread_data") {
if (auto Err = registerThreadDataSection(KV.second.toSpan<const char>()))
return Err;
- } else if (KV.first == "__DATA,__objc_selrefs")
- JDS->ObjCSelRefsSections.add(KV.second.toSpan<void *>());
- else if (KV.first == "__DATA,__objc_classlist")
- JDS->ObjCClassListSections.add(KV.second.toSpan<void *>());
- else if (KV.first == "__TEXT,__swift5_protos")
- JDS->Swift5ProtocolsSections.add(KV.second.toSpan<char>());
- else if (KV.first == "__TEXT,__swift5_proto")
- JDS->Swift5ProtocolConformancesSections.add(KV.second.toSpan<char>());
- else if (KV.first == "__TEXT,__swift5_types")
- JDS->Swift5TypesSections.add(KV.second.toSpan<char>());
+ } else if (KV.first == "__llvm_jitlink_ObjCRuntimeRegistrationObject")
+ JDS->ObjCRuntimeRegistrationObjects.add(KV.second.toSpan<char>());
else if (KV.first == "__DATA,__mod_init_func")
JDS->ModInitsSections.add(KV.second.toSpan<void (*)()>());
else {
@@ -676,16 +635,8 @@ Error MachOPlatformRuntimeState::deregisterObjectPlatformSections(
if (auto Err =
deregisterThreadDataSection(KV.second.toSpan<const char>()))
return Err;
- } else if (KV.first == "__DATA,__objc_selrefs")
- JDS->ObjCSelRefsSections.removeIfPresent(KV.second);
- else if (KV.first == "__DATA,__objc_classlist")
- JDS->ObjCClassListSections.removeIfPresent(KV.second);
- else if (KV.first == "__TEXT,__swift5_protos")
- JDS->Swift5ProtocolsSections.removeIfPresent(KV.second);
- else if (KV.first == "__TEXT,__swift5_proto")
- JDS->Swift5ProtocolConformancesSections.removeIfPresent(KV.second);
- else if (KV.first == "__TEXT,__swift5_types")
- JDS->Swift5TypesSections.removeIfPresent(KV.second);
+ } else if (KV.first == "__llvm_jitlink_ObjCRuntimeRegistrationObject")
+ JDS->ObjCRuntimeRegistrationObjects.removeIfPresent(KV.second);
else if (KV.first == "__DATA,__mod_init_func")
JDS->ModInitsSections.removeIfPresent(KV.second);
else {
@@ -906,115 +857,29 @@ Error MachOPlatformRuntimeState::deregisterEHFrames(
return Error::success();
}
-Error MachOPlatformRuntimeState::registerObjCSelectors(JITDylibState &JDS) {
- if (!JDS.ObjCSelRefsSections.hasNewSections())
- return Error::success();
-
- if (ORC_RT_UNLIKELY(!sel_registerName))
- return make_error<StringError>("sel_registerName is not available");
-
- JDS.ObjCSelRefsSections.processNewSections([](span<void *> SelRefs) {
- for (void *&SelEntry : SelRefs) {
- const char *SelName = reinterpret_cast<const char *>(SelEntry);
- auto Sel = sel_registerName(SelName);
- *reinterpret_cast<SEL *>(&SelEntry) = Sel;
- }
- });
-
- return Error::success();
-}
-
-Error MachOPlatformRuntimeState::registerObjCClasses(JITDylibState &JDS) {
- if (!JDS.ObjCClassListSections.hasNewSections())
- return Error::success();
-
- if (ORC_RT_UNLIKELY(!objc_msgSend))
- return make_error<StringError>("objc_msgSend is not available");
- if (ORC_RT_UNLIKELY(!objc_readClassPair))
- return make_error<StringError>("objc_readClassPair is not available");
-
- struct ObjCClassCompiled {
- void *Metaclass;
- void *Parent;
- void *Cache1;
- void *Cache2;
- void *Data;
- };
-
- auto ClassSelector = sel_registerName("class");
-
- return JDS.ObjCClassListSections.processNewSections(
- [&](span<void *> ClassPtrs) -> Error {
- for (void *ClassPtr : ClassPtrs) {
- auto *Cls = reinterpret_cast<Class>(ClassPtr);
- auto *ClassCompiled = reinterpret_cast<ObjCClassCompiled *>(ClassPtr);
- objc_msgSend(reinterpret_cast<id>(ClassCompiled->Parent),
- ClassSelector);
- auto Registered = objc_readClassPair(Cls, JDS.ObjCImageInfo);
- // FIXME: Improve diagnostic by reporting the failed class's name.
- if (Registered != Cls)
- return make_error<StringError>(
- "Unable to register Objective-C class");
- }
- return Error::success();
- });
-}
-
-Error MachOPlatformRuntimeState::registerSwift5Protocols(JITDylibState &JDS) {
-
- if (!JDS.Swift5ProtocolsSections.hasNewSections())
- return Error::success();
-
- if (ORC_RT_UNLIKELY(!swift_registerProtocols))
- return make_error<StringError>("swift_registerProtocols is not available");
-
- JDS.Swift5ProtocolsSections.processNewSections([](span<char> ProtoSec) {
- swift_registerProtocols(
- reinterpret_cast<const ProtocolRecord *>(ProtoSec.data()),
- reinterpret_cast<const ProtocolRecord *>(ProtoSec.data() +
- ProtoSec.size()));
- });
-
- return Error::success();
-}
-
-Error MachOPlatformRuntimeState::registerSwift5ProtocolConformances(
+Error MachOPlatformRuntimeState::registerObjCRegistrationObjects(
JITDylibState &JDS) {
+ ORC_RT_DEBUG(printdbg("Registering Objective-C / Swift metadata.\n"));
- if (!JDS.Swift5ProtocolConformancesSections.hasNewSections())
- return Error::success();
-
- if (ORC_RT_UNLIKELY(!swift_registerProtocolConformances))
- return make_error<StringError>(
- "swift_registerProtocolConformances is not available");
-
- JDS.Swift5ProtocolConformancesSections.processNewSections(
- [](span<char> ProtoConfSec) {
- swift_registerProtocolConformances(
- reinterpret_cast<const ProtocolConformanceRecord *>(
- ProtoConfSec.data()),
- reinterpret_cast<const ProtocolConformanceRecord *>(
- ProtoConfSec.data() + ProtoConfSec.size()));
- });
-
- return Error::success();
-}
-
-Error MachOPlatformRuntimeState::registerSwift5Types(JITDylibState &JDS) {
+ std::vector<char *> RegObjBases;
+ JDS.ObjCRuntimeRegistrationObjects.processNewSections(
+ [&](span<char> RegObj) { RegObjBases.push_back(RegObj.data()); });
- if (!JDS.Swift5TypesSections.hasNewSections())
+ if (RegObjBases.empty())
return Error::success();
- if (ORC_RT_UNLIKELY(!swift_registerTypeMetadataRecords))
+ if (!_objc_map_images || !_objc_load_image)
return make_error<StringError>(
- "swift_registerTypeMetadataRecords is not available");
+ "Could not register Objective-C / Swift metadata: _objc_map_images / "
+ "_objc_load_image not found");
- JDS.Swift5TypesSections.processNewSections([&](span<char> TypesSec) {
- swift_registerTypeMetadataRecords(
- reinterpret_cast<const TypeMetadataRecord *>(TypesSec.data()),
- reinterpret_cast<const TypeMetadataRecord *>(TypesSec.data() +
- TypesSec.size()));
- });
+ std::vector<char *> Paths;
+ Paths.resize(RegObjBases.size());
+ _objc_map_images(RegObjBases.size(), Paths.data(),
+ reinterpret_cast<mach_header **>(RegObjBases.data()));
+
+ for (void *RegObjBase : RegObjBases)
+ _objc_load_image(nullptr, reinterpret_cast<mach_header *>(RegObjBase));
return Error::success();
}
@@ -1152,15 +1017,7 @@ Error MachOPlatformRuntimeState::dlopenInitialize(
}
// Initialize this JITDylib.
- if (auto Err = registerObjCSelectors(JDS))
- return Err;
- if (auto Err = registerObjCClasses(JDS))
- return Err;
- if (auto Err = registerSwift5Protocols(JDS))
- return Err;
- if (auto Err = registerSwift5ProtocolConformances(JDS))
- return Err;
- if (auto Err = registerSwift5Types(JDS))
+ if (auto Err = registerObjCRegistrationObjects(JDS))
return Err;
if (auto Err = runModInits(JDStatesLock, JDS))
return Err;
@@ -1281,7 +1138,7 @@ Error runWrapperFunctionCalls(std::vector<WrapperFunctionCall> WFCs) {
// JIT entry points
//------------------------------------------------------------------------------
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_platform_bootstrap(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError()>::handle(
ArgData, ArgSize,
@@ -1289,7 +1146,7 @@ __orc_rt_macho_platform_bootstrap(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_platform_shutdown(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError()>::handle(
ArgData, ArgSize,
@@ -1297,7 +1154,7 @@ __orc_rt_macho_platform_shutdown(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_register_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSString, SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -1308,7 +1165,7 @@ __orc_rt_macho_register_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_deregister_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -1319,7 +1176,7 @@ __orc_rt_macho_deregister_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_register_object_platform_sections(char *ArgData,
size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr,
@@ -1336,7 +1193,7 @@ __orc_rt_macho_register_object_platform_sections(char *ArgData,
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_deregister_object_platform_sections(char *ArgData,
size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr,
@@ -1353,7 +1210,7 @@ __orc_rt_macho_deregister_object_platform_sections(char *ArgData,
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_run_wrapper_function_calls(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSSequence<SPSWrapperFunctionCall>)>::handle(
ArgData, ArgSize, runWrapperFunctionCalls)
@@ -1379,7 +1236,7 @@ ORC_RT_INTERFACE void *__orc_rt_macho_tlv_get_addr_impl(TLVDescriptor *D) {
reinterpret_cast<char *>(static_cast<uintptr_t>(D->DataAddress)));
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_create_pthread_key(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSExpected<uint64_t>(void)>::handle(
ArgData, ArgSize,
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/run_program_wrapper.cpp b/contrib/llvm-project/compiler-rt/lib/orc/run_program_wrapper.cpp
index bb4edc56655e..24a7b4fc3cbe 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/run_program_wrapper.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/run_program_wrapper.cpp
@@ -22,7 +22,7 @@ extern "C" int64_t __orc_rt_run_program(const char *JITDylibName,
const char *EntrySymbolName, int argc,
char *argv[]);
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_run_program_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<int64_t(SPSString, SPSString,
SPSSequence<SPSString>)>::
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/c_api_test.cpp b/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/c_api_test.cpp
index ad3f055b8253..497cb937e2af 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/c_api_test.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/c_api_test.cpp
@@ -14,24 +14,24 @@
#include "gtest/gtest.h"
TEST(CAPITest, CWrapperFunctionResultInit) {
- __orc_rt_CWrapperFunctionResult R;
- __orc_rt_CWrapperFunctionResultInit(&R);
+ orc_rt_CWrapperFunctionResult R;
+ orc_rt_CWrapperFunctionResultInit(&R);
EXPECT_EQ(R.Size, 0U);
EXPECT_EQ(R.Data.ValuePtr, nullptr);
// Check that this value isn't treated as an out-of-band error.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultAllocSmall) {
constexpr size_t SmallAllocSize = sizeof(const char *);
- auto R = __orc_rt_CWrapperFunctionResultAllocate(SmallAllocSize);
- char *DataPtr = __orc_rt_CWrapperFunctionResultData(&R);
+ auto R = orc_rt_CWrapperFunctionResultAllocate(SmallAllocSize);
+ char *DataPtr = orc_rt_CWrapperFunctionResultData(&R);
for (size_t I = 0; I != SmallAllocSize; ++I)
DataPtr[I] = 0x55 + I;
@@ -44,24 +44,24 @@ TEST(CAPITest, CWrapperFunctionResultAllocSmall) {
<< "Unexpected value at index " << I;
// Check that this value isn't treated as an out-of-band error.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
- // Check that __orc_rt_CWrapperFunctionResult(Data|Result|Size) and
- // __orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultData(&R), R.Data.Value);
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultSize(&R), SmallAllocSize);
- EXPECT_FALSE(__orc_rt_CWrapperFunctionResultEmpty(&R));
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ // Check that orc_rt_CWrapperFunctionResult(Data|Result|Size) and
+ // orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultData(&R), R.Data.Value);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultSize(&R), SmallAllocSize);
+ EXPECT_FALSE(orc_rt_CWrapperFunctionResultEmpty(&R));
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultAllocLarge) {
constexpr size_t LargeAllocSize = sizeof(const char *) + 1;
- auto R = __orc_rt_CWrapperFunctionResultAllocate(LargeAllocSize);
- char *DataPtr = __orc_rt_CWrapperFunctionResultData(&R);
+ auto R = orc_rt_CWrapperFunctionResultAllocate(LargeAllocSize);
+ char *DataPtr = orc_rt_CWrapperFunctionResultData(&R);
for (size_t I = 0; I != LargeAllocSize; ++I)
DataPtr[I] = 0x55 + I;
@@ -75,17 +75,17 @@ TEST(CAPITest, CWrapperFunctionResultAllocLarge) {
<< "Unexpected value at index " << I;
// Check that this value isn't treated as an out-of-band error.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
- // Check that __orc_rt_CWrapperFunctionResult(Data|Result|Size) and
- // __orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultData(&R), R.Data.ValuePtr);
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultSize(&R), LargeAllocSize);
- EXPECT_FALSE(__orc_rt_CWrapperFunctionResultEmpty(&R));
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ // Check that orc_rt_CWrapperFunctionResult(Data|Result|Size) and
+ // orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultData(&R), R.Data.ValuePtr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultSize(&R), LargeAllocSize);
+ EXPECT_FALSE(orc_rt_CWrapperFunctionResultEmpty(&R));
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromRangeSmall) {
@@ -95,8 +95,8 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeSmall) {
for (size_t I = 0; I != SmallAllocSize; ++I)
Source[I] = 0x55 + I;
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromRange(Source, SmallAllocSize);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromRange(Source, SmallAllocSize);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -106,7 +106,7 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeSmall) {
<< "Unexpected value at index " << I;
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromRangeLarge) {
@@ -116,8 +116,8 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeLarge) {
for (size_t I = 0; I != LargeAllocSize; ++I)
Source[I] = 0x55 + I;
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromRange(Source, LargeAllocSize);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromRange(Source, LargeAllocSize);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -127,7 +127,7 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeLarge) {
<< "Unexpected value at index " << I;
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromStringSmall) {
@@ -138,8 +138,8 @@ TEST(CAPITest, CWrapperFunctionResultFromStringSmall) {
Source[I] = 'a' + I;
Source[SmallAllocSize - 1] = '\0';
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromString(Source);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromString(Source);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -151,7 +151,7 @@ TEST(CAPITest, CWrapperFunctionResultFromStringSmall) {
<< "Unexpected value at index " << (SmallAllocSize - 1);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromStringLarge) {
@@ -162,8 +162,8 @@ TEST(CAPITest, CWrapperFunctionResultFromStringLarge) {
Source[I] = 'a' + I;
Source[LargeAllocSize - 1] = '\0';
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromString(Source);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromString(Source);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -175,26 +175,26 @@ TEST(CAPITest, CWrapperFunctionResultFromStringLarge) {
<< "Unexpected value at index " << (LargeAllocSize - 1);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromOutOfBandError) {
constexpr const char *ErrMsg = "test error message";
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(ErrMsg);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(ErrMsg);
#ifndef NDEBUG
- EXPECT_DEATH({ __orc_rt_CWrapperFunctionResultData(&R); },
+ EXPECT_DEATH({ orc_rt_CWrapperFunctionResultData(&R); },
"Cannot get data for out-of-band error value");
- EXPECT_DEATH({ __orc_rt_CWrapperFunctionResultSize(&R); },
+ EXPECT_DEATH({ orc_rt_CWrapperFunctionResultSize(&R); },
"Cannot get size for out-of-band error value");
#endif
- EXPECT_FALSE(__orc_rt_CWrapperFunctionResultEmpty(&R));
- const char *OOBErrMsg = __orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
+ EXPECT_FALSE(orc_rt_CWrapperFunctionResultEmpty(&R));
+ const char *OOBErrMsg = orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
EXPECT_NE(OOBErrMsg, nullptr);
EXPECT_NE(OOBErrMsg, ErrMsg);
EXPECT_TRUE(strcmp(OOBErrMsg, ErrMsg) == 0);
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp b/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
index 8d4b9b3cba2b..f10c5093046d 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
+++ b/contrib/llvm-project/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
@@ -27,8 +27,8 @@ TEST(WrapperFunctionUtilsTest, DefaultWrapperFunctionResult) {
}
TEST(WrapperFunctionUtilsTest, WrapperFunctionResultFromCStruct) {
- __orc_rt_CWrapperFunctionResult CR =
- __orc_rt_CreateCWrapperFunctionResultFromString(TestString);
+ orc_rt_CWrapperFunctionResult CR =
+ orc_rt_CreateCWrapperFunctionResultFromString(TestString);
WrapperFunctionResult R(CR);
EXPECT_EQ(R.size(), strlen(TestString) + 1);
EXPECT_TRUE(strcmp(R.data(), TestString) == 0);
@@ -72,13 +72,13 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionCCallCreateEmpty) {
static void voidNoop() {}
-static __orc_rt_CWrapperFunctionResult voidNoopWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult voidNoopWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<void()>::handle(ArgData, ArgSize, voidNoop).release();
}
-static __orc_rt_CWrapperFunctionResult addWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult addWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<int32_t(int32_t, int32_t)>::handle(
ArgData, ArgSize,
[](int32_t X, int32_t Y) -> int32_t { return X + Y; })
@@ -87,11 +87,11 @@ static __orc_rt_CWrapperFunctionResult addWrapper(const char *ArgData,
extern "C" __orc_rt_Opaque __orc_rt_jit_dispatch_ctx{};
-extern "C" __orc_rt_CWrapperFunctionResult
+extern "C" orc_rt_CWrapperFunctionResult
__orc_rt_jit_dispatch(__orc_rt_Opaque *Ctx, const void *FnTag,
const char *ArgData, size_t ArgSize) {
using WrapperFunctionType =
- __orc_rt_CWrapperFunctionResult (*)(const char *, size_t);
+ orc_rt_CWrapperFunctionResult (*)(const char *, size_t);
return reinterpret_cast<WrapperFunctionType>(const_cast<void *>(FnTag))(
ArgData, ArgSize);
@@ -117,8 +117,8 @@ private:
int32_t X;
};
-static __orc_rt_CWrapperFunctionResult addMethodWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult addMethodWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
ArgData, ArgSize, makeMethodWrapperHandler(&AddClass::addMethod))
.release();
@@ -132,8 +132,8 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionMethodCallAndHandleRet) {
EXPECT_EQ(Result, (int32_t)3);
}
-static __orc_rt_CWrapperFunctionResult sumArrayWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult sumArrayWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<int8_t(SPSExecutorAddrRange)>::handle(
ArgData, ArgSize,
[](ExecutorAddrRange R) {
diff --git a/contrib/llvm-project/compiler-rt/lib/orc/wrapper_function_utils.h b/contrib/llvm-project/compiler-rt/lib/orc/wrapper_function_utils.h
index b48891b3b750..dcb6d0e6addb 100644
--- a/contrib/llvm-project/compiler-rt/lib/orc/wrapper_function_utils.h
+++ b/contrib/llvm-project/compiler-rt/lib/orc/wrapper_function_utils.h
@@ -27,66 +27,66 @@ namespace __orc_rt {
class WrapperFunctionResult {
public:
/// Create a default WrapperFunctionResult.
- WrapperFunctionResult() { __orc_rt_CWrapperFunctionResultInit(&R); }
+ WrapperFunctionResult() { orc_rt_CWrapperFunctionResultInit(&R); }
/// Create a WrapperFunctionResult from a CWrapperFunctionResult. This
/// instance takes ownership of the result object and will automatically
/// call dispose on the result upon destruction.
- WrapperFunctionResult(__orc_rt_CWrapperFunctionResult R) : R(R) {}
+ WrapperFunctionResult(orc_rt_CWrapperFunctionResult R) : R(R) {}
WrapperFunctionResult(const WrapperFunctionResult &) = delete;
WrapperFunctionResult &operator=(const WrapperFunctionResult &) = delete;
WrapperFunctionResult(WrapperFunctionResult &&Other) {
- __orc_rt_CWrapperFunctionResultInit(&R);
+ orc_rt_CWrapperFunctionResultInit(&R);
std::swap(R, Other.R);
}
WrapperFunctionResult &operator=(WrapperFunctionResult &&Other) {
- __orc_rt_CWrapperFunctionResult Tmp;
- __orc_rt_CWrapperFunctionResultInit(&Tmp);
+ orc_rt_CWrapperFunctionResult Tmp;
+ orc_rt_CWrapperFunctionResultInit(&Tmp);
std::swap(Tmp, Other.R);
std::swap(R, Tmp);
return *this;
}
- ~WrapperFunctionResult() { __orc_rt_DisposeCWrapperFunctionResult(&R); }
+ ~WrapperFunctionResult() { orc_rt_DisposeCWrapperFunctionResult(&R); }
/// Relinquish ownership of and return the
- /// __orc_rt_CWrapperFunctionResult.
- __orc_rt_CWrapperFunctionResult release() {
- __orc_rt_CWrapperFunctionResult Tmp;
- __orc_rt_CWrapperFunctionResultInit(&Tmp);
+ /// orc_rt_CWrapperFunctionResult.
+ orc_rt_CWrapperFunctionResult release() {
+ orc_rt_CWrapperFunctionResult Tmp;
+ orc_rt_CWrapperFunctionResultInit(&Tmp);
std::swap(R, Tmp);
return Tmp;
}
/// Get a pointer to the data contained in this instance.
- char *data() { return __orc_rt_CWrapperFunctionResultData(&R); }
+ char *data() { return orc_rt_CWrapperFunctionResultData(&R); }
/// Returns the size of the data contained in this instance.
- size_t size() const { return __orc_rt_CWrapperFunctionResultSize(&R); }
+ size_t size() const { return orc_rt_CWrapperFunctionResultSize(&R); }
/// Returns true if this value is equivalent to a default-constructed
/// WrapperFunctionResult.
- bool empty() const { return __orc_rt_CWrapperFunctionResultEmpty(&R); }
+ bool empty() const { return orc_rt_CWrapperFunctionResultEmpty(&R); }
/// Create a WrapperFunctionResult with the given size and return a pointer
/// to the underlying memory.
static WrapperFunctionResult allocate(size_t Size) {
WrapperFunctionResult R;
- R.R = __orc_rt_CWrapperFunctionResultAllocate(Size);
+ R.R = orc_rt_CWrapperFunctionResultAllocate(Size);
return R;
}
/// Copy from the given char range.
static WrapperFunctionResult copyFrom(const char *Source, size_t Size) {
- return __orc_rt_CreateCWrapperFunctionResultFromRange(Source, Size);
+ return orc_rt_CreateCWrapperFunctionResultFromRange(Source, Size);
}
/// Copy from the given null-terminated string (includes the null-terminator).
static WrapperFunctionResult copyFrom(const char *Source) {
- return __orc_rt_CreateCWrapperFunctionResultFromString(Source);
+ return orc_rt_CreateCWrapperFunctionResultFromString(Source);
}
/// Copy from the given std::string (includes the null terminator).
@@ -96,7 +96,7 @@ public:
/// Create an out-of-band error by copying the given string.
static WrapperFunctionResult createOutOfBandError(const char *Msg) {
- return __orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(Msg);
+ return orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(Msg);
}
/// Create an out-of-band error by copying the given string.
@@ -117,11 +117,11 @@ public:
/// If this value is an out-of-band error then this returns the error message,
/// otherwise returns nullptr.
const char *getOutOfBandError() const {
- return __orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
+ return orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
}
private:
- __orc_rt_CWrapperFunctionResult R;
+ orc_rt_CWrapperFunctionResult R;
};
namespace detail {
@@ -434,7 +434,7 @@ public:
/// Run call returning raw WrapperFunctionResult.
WrapperFunctionResult run() const {
using FnTy =
- __orc_rt_CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
+ orc_rt_CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
return WrapperFunctionResult(
FnAddr.toPtr<FnTy *>()(ArgData.data(), ArgData.size()));
}