[ORC] Rename ExecutorAddress to ExecutorAddr.
Removing the 'ess' suffix improves the ergonomics without sacrificing clarity. Since this class is likely to be used more frequently in the future it's worth some short term pain to fix this now.
This commit is contained in:
@@ -27,18 +27,18 @@ namespace llvm {
|
|||||||
namespace orc {
|
namespace orc {
|
||||||
|
|
||||||
struct ELFPerObjectSectionsToRegister {
|
struct ELFPerObjectSectionsToRegister {
|
||||||
ExecutorAddressRange EHFrameSection;
|
ExecutorAddrRange EHFrameSection;
|
||||||
ExecutorAddressRange ThreadDataSection;
|
ExecutorAddrRange ThreadDataSection;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ELFNixJITDylibInitializers {
|
struct ELFNixJITDylibInitializers {
|
||||||
using SectionList = std::vector<ExecutorAddressRange>;
|
using SectionList = std::vector<ExecutorAddrRange>;
|
||||||
|
|
||||||
ELFNixJITDylibInitializers(std::string Name, ExecutorAddress DSOHandleAddress)
|
ELFNixJITDylibInitializers(std::string Name, ExecutorAddr DSOHandleAddress)
|
||||||
: Name(std::move(Name)), DSOHandleAddress(std::move(DSOHandleAddress)) {}
|
: Name(std::move(Name)), DSOHandleAddress(std::move(DSOHandleAddress)) {}
|
||||||
|
|
||||||
std::string Name;
|
std::string Name;
|
||||||
ExecutorAddress DSOHandleAddress;
|
ExecutorAddr DSOHandleAddress;
|
||||||
|
|
||||||
StringMap<SectionList> InitSections;
|
StringMap<SectionList> InitSections;
|
||||||
};
|
};
|
||||||
@@ -179,7 +179,7 @@ private:
|
|||||||
using SendDeinitializerSequenceFn =
|
using SendDeinitializerSequenceFn =
|
||||||
unique_function<void(Expected<ELFNixJITDylibDeinitializerSequence>)>;
|
unique_function<void(Expected<ELFNixJITDylibDeinitializerSequence>)>;
|
||||||
|
|
||||||
using SendSymbolAddressFn = unique_function<void(Expected<ExecutorAddress>)>;
|
using SendSymbolAddressFn = unique_function<void(Expected<ExecutorAddr>)>;
|
||||||
|
|
||||||
static bool supportedTarget(const Triple &TT);
|
static bool supportedTarget(const Triple &TT);
|
||||||
|
|
||||||
@@ -202,9 +202,9 @@ private:
|
|||||||
StringRef JDName);
|
StringRef JDName);
|
||||||
|
|
||||||
void rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
void rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
||||||
ExecutorAddress Handle);
|
ExecutorAddr Handle);
|
||||||
|
|
||||||
void rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddress Handle,
|
void rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddr Handle,
|
||||||
StringRef SymbolName);
|
StringRef SymbolName);
|
||||||
|
|
||||||
// Records the addresses of runtime symbols used by the platform.
|
// Records the addresses of runtime symbols used by the platform.
|
||||||
@@ -223,10 +223,10 @@ private:
|
|||||||
SymbolStringPtr DSOHandleSymbol;
|
SymbolStringPtr DSOHandleSymbol;
|
||||||
std::atomic<bool> RuntimeBootstrapped{false};
|
std::atomic<bool> RuntimeBootstrapped{false};
|
||||||
|
|
||||||
ExecutorAddress orc_rt_elfnix_platform_bootstrap;
|
ExecutorAddr orc_rt_elfnix_platform_bootstrap;
|
||||||
ExecutorAddress orc_rt_elfnix_platform_shutdown;
|
ExecutorAddr orc_rt_elfnix_platform_shutdown;
|
||||||
ExecutorAddress orc_rt_elfnix_register_object_sections;
|
ExecutorAddr orc_rt_elfnix_register_object_sections;
|
||||||
ExecutorAddress orc_rt_elfnix_create_pthread_key;
|
ExecutorAddr orc_rt_elfnix_create_pthread_key;
|
||||||
|
|
||||||
DenseMap<JITDylib *, SymbolLookupSet> RegisteredInitSymbols;
|
DenseMap<JITDylib *, SymbolLookupSet> RegisteredInitSymbols;
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ private:
|
|||||||
namespace shared {
|
namespace shared {
|
||||||
|
|
||||||
using SPSELFPerObjectSectionsToRegister =
|
using SPSELFPerObjectSectionsToRegister =
|
||||||
SPSTuple<SPSExecutorAddressRange, SPSExecutorAddressRange>;
|
SPSTuple<SPSExecutorAddrRange, SPSExecutorAddrRange>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class SPSSerializationTraits<SPSELFPerObjectSectionsToRegister,
|
class SPSSerializationTraits<SPSELFPerObjectSectionsToRegister,
|
||||||
@@ -268,12 +268,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SPSNamedExecutorAddressRangeSequenceMap =
|
using SPSNamedExecutorAddrRangeSequenceMap =
|
||||||
SPSSequence<SPSTuple<SPSString, SPSExecutorAddressRangeSequence>>;
|
SPSSequence<SPSTuple<SPSString, SPSExecutorAddrRangeSequence>>;
|
||||||
|
|
||||||
using SPSELFNixJITDylibInitializers =
|
using SPSELFNixJITDylibInitializers =
|
||||||
SPSTuple<SPSString, SPSExecutorAddress,
|
SPSTuple<SPSString, SPSExecutorAddr, SPSNamedExecutorAddrRangeSequenceMap>;
|
||||||
SPSNamedExecutorAddressRangeSequenceMap>;
|
|
||||||
|
|
||||||
using SPSELFNixJITDylibInitializerSequence =
|
using SPSELFNixJITDylibInitializerSequence =
|
||||||
SPSSequence<SPSELFNixJITDylibInitializers>;
|
SPSSequence<SPSELFNixJITDylibInitializers>;
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ class EPCGenericDylibManager {
|
|||||||
public:
|
public:
|
||||||
/// Function addresses for memory access.
|
/// Function addresses for memory access.
|
||||||
struct SymbolAddrs {
|
struct SymbolAddrs {
|
||||||
ExecutorAddress Instance;
|
ExecutorAddr Instance;
|
||||||
ExecutorAddress Open;
|
ExecutorAddr Open;
|
||||||
ExecutorAddress Lookup;
|
ExecutorAddr Lookup;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Create an EPCGenericMemoryAccess instance from a given set of
|
/// Create an EPCGenericMemoryAccess instance from a given set of
|
||||||
@@ -49,11 +49,11 @@ public:
|
|||||||
Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode);
|
Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode);
|
||||||
|
|
||||||
/// Looks up symbols within the given dylib.
|
/// Looks up symbols within the given dylib.
|
||||||
Expected<std::vector<ExecutorAddress>> lookup(tpctypes::DylibHandle H,
|
Expected<std::vector<ExecutorAddr>> lookup(tpctypes::DylibHandle H,
|
||||||
const SymbolLookupSet &Lookup);
|
const SymbolLookupSet &Lookup);
|
||||||
|
|
||||||
/// Looks up symbols within the given dylib.
|
/// Looks up symbols within the given dylib.
|
||||||
Expected<std::vector<ExecutorAddress>>
|
Expected<std::vector<ExecutorAddr>>
|
||||||
lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup);
|
lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ class EPCGenericJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
|
|||||||
public:
|
public:
|
||||||
/// Function addresses for memory access.
|
/// Function addresses for memory access.
|
||||||
struct SymbolAddrs {
|
struct SymbolAddrs {
|
||||||
ExecutorAddress Allocator;
|
ExecutorAddr Allocator;
|
||||||
ExecutorAddress Reserve;
|
ExecutorAddr Reserve;
|
||||||
ExecutorAddress Finalize;
|
ExecutorAddr Finalize;
|
||||||
ExecutorAddress Deallocate;
|
ExecutorAddr Deallocate;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Create an EPCGenericJITLinkMemoryManager instance from a given set of
|
/// Create an EPCGenericJITLinkMemoryManager instance from a given set of
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ class EPCGenericMemoryAccess : public ExecutorProcessControl::MemoryAccess {
|
|||||||
public:
|
public:
|
||||||
/// Function addresses for memory access.
|
/// Function addresses for memory access.
|
||||||
struct FuncAddrs {
|
struct FuncAddrs {
|
||||||
ExecutorAddress WriteUInt8s;
|
ExecutorAddr WriteUInt8s;
|
||||||
ExecutorAddress WriteUInt16s;
|
ExecutorAddr WriteUInt16s;
|
||||||
ExecutorAddress WriteUInt32s;
|
ExecutorAddr WriteUInt32s;
|
||||||
ExecutorAddress WriteUInt64s;
|
ExecutorAddr WriteUInt64s;
|
||||||
ExecutorAddress WriteBuffers;
|
ExecutorAddr WriteBuffers;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Create an EPCGenericMemoryAccess instance from a given set of
|
/// Create an EPCGenericMemoryAccess instance from a given set of
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ public:
|
|||||||
/// Contains the address of the dispatch function and context that the ORC
|
/// Contains the address of the dispatch function and context that the ORC
|
||||||
/// runtime can use to call functions in the JIT.
|
/// runtime can use to call functions in the JIT.
|
||||||
struct JITDispatchInfo {
|
struct JITDispatchInfo {
|
||||||
ExecutorAddress JITDispatchFunctionAddress;
|
ExecutorAddr JITDispatchFunction;
|
||||||
ExecutorAddress JITDispatchContextAddress;
|
ExecutorAddr JITDispatchContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~ExecutorProcessControl();
|
virtual ~ExecutorProcessControl();
|
||||||
@@ -159,15 +159,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the bootstrap symbol map.
|
/// Returns the bootstrap symbol map.
|
||||||
const StringMap<ExecutorAddress> &getBootstrapSymbolsMap() const {
|
const StringMap<ExecutorAddr> &getBootstrapSymbolsMap() const {
|
||||||
return BootstrapSymbols;
|
return BootstrapSymbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For each (ExecutorAddress&, StringRef) pair, looks up the string in the
|
/// For each (ExecutorAddr&, StringRef) pair, looks up the string in the
|
||||||
/// bootstrap symbols map and writes its address to the ExecutorAddress if
|
/// bootstrap symbols map and writes its address to the ExecutorAddr if
|
||||||
/// found. If any symbol is not found then the function returns an error.
|
/// found. If any symbol is not found then the function returns an error.
|
||||||
Error getBootstrapSymbols(
|
Error getBootstrapSymbols(
|
||||||
ArrayRef<std::pair<ExecutorAddress &, StringRef>> Pairs) const {
|
ArrayRef<std::pair<ExecutorAddr &, StringRef>> Pairs) const {
|
||||||
for (auto &KV : Pairs) {
|
for (auto &KV : Pairs) {
|
||||||
auto I = BootstrapSymbols.find(KV.second);
|
auto I = BootstrapSymbols.find(KV.second);
|
||||||
if (I == BootstrapSymbols.end())
|
if (I == BootstrapSymbols.end())
|
||||||
@@ -275,7 +275,7 @@ protected:
|
|||||||
JITDispatchInfo JDI;
|
JITDispatchInfo JDI;
|
||||||
MemoryAccess *MemAccess = nullptr;
|
MemoryAccess *MemAccess = nullptr;
|
||||||
jitlink::JITLinkMemoryManager *MemMgr = nullptr;
|
jitlink::JITLinkMemoryManager *MemMgr = nullptr;
|
||||||
StringMap<ExecutorAddress> BootstrapSymbols;
|
StringMap<ExecutorAddr> BootstrapSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A ExecutorProcessControl instance that asserts if any of its methods are
|
/// A ExecutorProcessControl instance that asserts if any of its methods are
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// Record the addresses of a set of symbols into ExecutorAddress objects.
|
// Record the addresses of a set of symbols into ExecutorAddr objects.
|
||||||
//
|
//
|
||||||
// This can be used to avoid repeated lookup (via ExecutionSession::lookup) of
|
// This can be used to avoid repeated lookup (via ExecutionSession::lookup) of
|
||||||
// the given symbols.
|
// the given symbols.
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace orc {
|
namespace orc {
|
||||||
|
|
||||||
/// Record addresses of the given symbols in the given ExecutorAddresses.
|
/// Record addresses of the given symbols in the given ExecutorAddrs.
|
||||||
///
|
///
|
||||||
/// Useful for making permanent records of symbol addreses to call or
|
/// Useful for making permanent records of symbol addreses to call or
|
||||||
/// access in the executor (e.g. runtime support functions in Platform
|
/// access in the executor (e.g. runtime support functions in Platform
|
||||||
@@ -44,24 +44,24 @@ namespace orc {
|
|||||||
void lookupAndRecordAddrs(
|
void lookupAndRecordAddrs(
|
||||||
unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
|
unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
|
||||||
const JITDylibSearchOrder &SearchOrder,
|
const JITDylibSearchOrder &SearchOrder,
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
|
||||||
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
|
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
|
||||||
|
|
||||||
/// Record addresses of the given symbols in the given ExecutorAddresses.
|
/// Record addresses of the given symbols in the given ExecutorAddrs.
|
||||||
///
|
///
|
||||||
/// Blocking version.
|
/// Blocking version.
|
||||||
Error lookupAndRecordAddrs(
|
Error lookupAndRecordAddrs(
|
||||||
ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
|
ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
|
||||||
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
|
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
|
||||||
|
|
||||||
/// Record addresses of given symbols in the given ExecutorAddresses.
|
/// Record addresses of given symbols in the given ExecutorAddrs.
|
||||||
///
|
///
|
||||||
/// ExecutorProcessControl lookup version. Lookups are always implicitly
|
/// ExecutorProcessControl lookup version. Lookups are always implicitly
|
||||||
/// weak.
|
/// weak.
|
||||||
Error lookupAndRecordAddrs(
|
Error lookupAndRecordAddrs(
|
||||||
ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
|
ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
|
||||||
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
|
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
|
||||||
|
|
||||||
} // End namespace orc
|
} // End namespace orc
|
||||||
|
|||||||
@@ -27,21 +27,20 @@ namespace llvm {
|
|||||||
namespace orc {
|
namespace orc {
|
||||||
|
|
||||||
struct MachOPerObjectSectionsToRegister {
|
struct MachOPerObjectSectionsToRegister {
|
||||||
ExecutorAddressRange EHFrameSection;
|
ExecutorAddrRange EHFrameSection;
|
||||||
ExecutorAddressRange ThreadDataSection;
|
ExecutorAddrRange ThreadDataSection;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MachOJITDylibInitializers {
|
struct MachOJITDylibInitializers {
|
||||||
using SectionList = std::vector<ExecutorAddressRange>;
|
using SectionList = std::vector<ExecutorAddrRange>;
|
||||||
|
|
||||||
MachOJITDylibInitializers(std::string Name,
|
MachOJITDylibInitializers(std::string Name, ExecutorAddr MachOHeaderAddress)
|
||||||
ExecutorAddress MachOHeaderAddress)
|
|
||||||
: Name(std::move(Name)),
|
: Name(std::move(Name)),
|
||||||
MachOHeaderAddress(std::move(MachOHeaderAddress)) {}
|
MachOHeaderAddress(std::move(MachOHeaderAddress)) {}
|
||||||
|
|
||||||
std::string Name;
|
std::string Name;
|
||||||
ExecutorAddress MachOHeaderAddress;
|
ExecutorAddr MachOHeaderAddress;
|
||||||
ExecutorAddress ObjCImageInfoAddress;
|
ExecutorAddr ObjCImageInfoAddress;
|
||||||
|
|
||||||
StringMap<SectionList> InitSections;
|
StringMap<SectionList> InitSections;
|
||||||
};
|
};
|
||||||
@@ -185,7 +184,7 @@ private:
|
|||||||
using SendDeinitializerSequenceFn =
|
using SendDeinitializerSequenceFn =
|
||||||
unique_function<void(Expected<MachOJITDylibDeinitializerSequence>)>;
|
unique_function<void(Expected<MachOJITDylibDeinitializerSequence>)>;
|
||||||
|
|
||||||
using SendSymbolAddressFn = unique_function<void(Expected<ExecutorAddress>)>;
|
using SendSymbolAddressFn = unique_function<void(Expected<ExecutorAddr>)>;
|
||||||
|
|
||||||
static bool supportedTarget(const Triple &TT);
|
static bool supportedTarget(const Triple &TT);
|
||||||
|
|
||||||
@@ -208,15 +207,15 @@ private:
|
|||||||
StringRef JDName);
|
StringRef JDName);
|
||||||
|
|
||||||
void rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
void rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
||||||
ExecutorAddress Handle);
|
ExecutorAddr Handle);
|
||||||
|
|
||||||
void rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddress Handle,
|
void rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddr Handle,
|
||||||
StringRef SymbolName);
|
StringRef SymbolName);
|
||||||
|
|
||||||
// Records the addresses of runtime symbols used by the platform.
|
// Records the addresses of runtime symbols used by the platform.
|
||||||
Error bootstrapMachORuntime(JITDylib &PlatformJD);
|
Error bootstrapMachORuntime(JITDylib &PlatformJD);
|
||||||
|
|
||||||
Error registerInitInfo(JITDylib &JD, ExecutorAddress ObjCImageInfoAddr,
|
Error registerInitInfo(JITDylib &JD, ExecutorAddr ObjCImageInfoAddr,
|
||||||
ArrayRef<jitlink::Section *> InitSections);
|
ArrayRef<jitlink::Section *> InitSections);
|
||||||
|
|
||||||
Error registerPerObjectSections(const MachOPerObjectSectionsToRegister &POSR);
|
Error registerPerObjectSections(const MachOPerObjectSectionsToRegister &POSR);
|
||||||
@@ -229,10 +228,10 @@ private:
|
|||||||
SymbolStringPtr MachOHeaderStartSymbol;
|
SymbolStringPtr MachOHeaderStartSymbol;
|
||||||
std::atomic<bool> RuntimeBootstrapped{false};
|
std::atomic<bool> RuntimeBootstrapped{false};
|
||||||
|
|
||||||
ExecutorAddress orc_rt_macho_platform_bootstrap;
|
ExecutorAddr orc_rt_macho_platform_bootstrap;
|
||||||
ExecutorAddress orc_rt_macho_platform_shutdown;
|
ExecutorAddr orc_rt_macho_platform_shutdown;
|
||||||
ExecutorAddress orc_rt_macho_register_object_sections;
|
ExecutorAddr orc_rt_macho_register_object_sections;
|
||||||
ExecutorAddress orc_rt_macho_create_pthread_key;
|
ExecutorAddr orc_rt_macho_create_pthread_key;
|
||||||
|
|
||||||
DenseMap<JITDylib *, SymbolLookupSet> RegisteredInitSymbols;
|
DenseMap<JITDylib *, SymbolLookupSet> RegisteredInitSymbols;
|
||||||
|
|
||||||
@@ -249,7 +248,7 @@ private:
|
|||||||
namespace shared {
|
namespace shared {
|
||||||
|
|
||||||
using SPSMachOPerObjectSectionsToRegister =
|
using SPSMachOPerObjectSectionsToRegister =
|
||||||
SPSTuple<SPSExecutorAddressRange, SPSExecutorAddressRange>;
|
SPSTuple<SPSExecutorAddrRange, SPSExecutorAddrRange>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class SPSSerializationTraits<SPSMachOPerObjectSectionsToRegister,
|
class SPSSerializationTraits<SPSMachOPerObjectSectionsToRegister,
|
||||||
@@ -274,12 +273,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SPSNamedExecutorAddressRangeSequenceMap =
|
using SPSNamedExecutorAddrRangeSequenceMap =
|
||||||
SPSSequence<SPSTuple<SPSString, SPSExecutorAddressRangeSequence>>;
|
SPSSequence<SPSTuple<SPSString, SPSExecutorAddrRangeSequence>>;
|
||||||
|
|
||||||
using SPSMachOJITDylibInitializers =
|
using SPSMachOJITDylibInitializers =
|
||||||
SPSTuple<SPSString, SPSExecutorAddress, SPSExecutorAddress,
|
SPSTuple<SPSString, SPSExecutorAddr, SPSExecutorAddr,
|
||||||
SPSNamedExecutorAddressRangeSequenceMap>;
|
SPSNamedExecutorAddrRangeSequenceMap>;
|
||||||
|
|
||||||
using SPSMachOJITDylibInitializerSequence =
|
using SPSMachOJITDylibInitializerSequence =
|
||||||
SPSSequence<SPSMachOJITDylibInitializers>;
|
SPSSequence<SPSMachOJITDylibInitializers>;
|
||||||
|
|||||||
@@ -402,8 +402,8 @@ protected:
|
|||||||
if (auto EPI = EP.template callB<orcrpctpc::GetExecutorProcessInfo>()) {
|
if (auto EPI = EP.template callB<orcrpctpc::GetExecutorProcessInfo>()) {
|
||||||
this->TargetTriple = Triple(EPI->Triple);
|
this->TargetTriple = Triple(EPI->Triple);
|
||||||
this->PageSize = EPI->PageSize;
|
this->PageSize = EPI->PageSize;
|
||||||
this->JDI = {ExecutorAddress(EPI->DispatchFuncAddr),
|
this->JDI = {ExecutorAddr(EPI->DispatchFuncAddr),
|
||||||
ExecutorAddress(EPI->DispatchCtxAddr)};
|
ExecutorAddr(EPI->DispatchCtxAddr)};
|
||||||
return Error::success();
|
return Error::success();
|
||||||
} else
|
} else
|
||||||
return EPI.takeError();
|
return EPI.takeError();
|
||||||
|
|||||||
@@ -34,25 +34,24 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Represents an address in the executor process.
|
/// Represents an address in the executor process.
|
||||||
class ExecutorAddress {
|
class ExecutorAddr {
|
||||||
public:
|
public:
|
||||||
ExecutorAddress() = default;
|
ExecutorAddr() = default;
|
||||||
explicit ExecutorAddress(uint64_t Addr) : Addr(Addr) {}
|
explicit ExecutorAddr(uint64_t Addr) : Addr(Addr) {}
|
||||||
|
|
||||||
/// Create an ExecutorAddress from the given pointer.
|
/// Create an ExecutorAddr from the given pointer.
|
||||||
/// Warning: This should only be used when JITing in-process.
|
/// Warning: This should only be used when JITing in-process.
|
||||||
template <typename T> static ExecutorAddress fromPtr(T *Value) {
|
template <typename T> static ExecutorAddr fromPtr(T *Value) {
|
||||||
return ExecutorAddress(
|
return ExecutorAddr(
|
||||||
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Value)));
|
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(Value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cast this ExecutorAddress to a pointer of the given type.
|
/// Cast this ExecutorAddr to a pointer of the given type.
|
||||||
/// Warning: This should only be used when JITing in-process.
|
/// Warning: This should only be used when JITing in-process.
|
||||||
template <typename T> T toPtr() const {
|
template <typename T> T toPtr() const {
|
||||||
static_assert(std::is_pointer<T>::value, "T must be a pointer type");
|
static_assert(std::is_pointer<T>::value, "T must be a pointer type");
|
||||||
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
|
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
|
||||||
assert(IntPtr == Addr &&
|
assert(IntPtr == Addr && "ExecutorAddr value out of range for uintptr_t");
|
||||||
"JITTargetAddress value out of range for uintptr_t");
|
|
||||||
return reinterpret_cast<T>(IntPtr);
|
return reinterpret_cast<T>(IntPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,53 +61,47 @@ public:
|
|||||||
|
|
||||||
explicit operator bool() const { return Addr != 0; }
|
explicit operator bool() const { return Addr != 0; }
|
||||||
|
|
||||||
friend bool operator==(const ExecutorAddress &LHS,
|
friend bool operator==(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
|
||||||
const ExecutorAddress &RHS) {
|
|
||||||
return LHS.Addr == RHS.Addr;
|
return LHS.Addr == RHS.Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(const ExecutorAddress &LHS,
|
friend bool operator!=(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
|
||||||
const ExecutorAddress &RHS) {
|
|
||||||
return LHS.Addr != RHS.Addr;
|
return LHS.Addr != RHS.Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator<(const ExecutorAddress &LHS,
|
friend bool operator<(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
|
||||||
const ExecutorAddress &RHS) {
|
|
||||||
return LHS.Addr < RHS.Addr;
|
return LHS.Addr < RHS.Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator<=(const ExecutorAddress &LHS,
|
friend bool operator<=(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
|
||||||
const ExecutorAddress &RHS) {
|
|
||||||
return LHS.Addr <= RHS.Addr;
|
return LHS.Addr <= RHS.Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator>(const ExecutorAddress &LHS,
|
friend bool operator>(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
|
||||||
const ExecutorAddress &RHS) {
|
|
||||||
return LHS.Addr > RHS.Addr;
|
return LHS.Addr > RHS.Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator>=(const ExecutorAddress &LHS,
|
friend bool operator>=(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
|
||||||
const ExecutorAddress &RHS) {
|
|
||||||
return LHS.Addr >= RHS.Addr;
|
return LHS.Addr >= RHS.Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorAddress &operator++() {
|
ExecutorAddr &operator++() {
|
||||||
++Addr;
|
++Addr;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
ExecutorAddress &operator--() {
|
ExecutorAddr &operator--() {
|
||||||
--Addr;
|
--Addr;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
ExecutorAddress operator++(int) { return ExecutorAddress(Addr++); }
|
ExecutorAddr operator++(int) { return ExecutorAddr(Addr++); }
|
||||||
ExecutorAddress operator--(int) { return ExecutorAddress(Addr++); }
|
ExecutorAddr operator--(int) { return ExecutorAddr(Addr++); }
|
||||||
|
|
||||||
ExecutorAddress &operator+=(const ExecutorAddrDiff Delta) {
|
ExecutorAddr &operator+=(const ExecutorAddrDiff Delta) {
|
||||||
Addr += Delta.getValue();
|
Addr += Delta.getValue();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorAddress &operator-=(const ExecutorAddrDiff Delta) {
|
ExecutorAddr &operator-=(const ExecutorAddrDiff Delta) {
|
||||||
Addr -= Delta.getValue();
|
Addr -= Delta.getValue();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -118,83 +111,81 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Subtracting two addresses yields an offset.
|
/// Subtracting two addresses yields an offset.
|
||||||
inline ExecutorAddrDiff operator-(const ExecutorAddress &LHS,
|
inline ExecutorAddrDiff operator-(const ExecutorAddr &LHS,
|
||||||
const ExecutorAddress &RHS) {
|
const ExecutorAddr &RHS) {
|
||||||
return ExecutorAddrDiff(LHS.getValue() - RHS.getValue());
|
return ExecutorAddrDiff(LHS.getValue() - RHS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adding an offset and an address yields an address.
|
/// Adding an offset and an address yields an address.
|
||||||
inline ExecutorAddress operator+(const ExecutorAddress &LHS,
|
inline ExecutorAddr operator+(const ExecutorAddr &LHS,
|
||||||
const ExecutorAddrDiff &RHS) {
|
const ExecutorAddrDiff &RHS) {
|
||||||
return ExecutorAddress(LHS.getValue() + RHS.getValue());
|
return ExecutorAddr(LHS.getValue() + RHS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adding an address and an offset yields an address.
|
/// Adding an address and an offset yields an address.
|
||||||
inline ExecutorAddress operator+(const ExecutorAddrDiff &LHS,
|
inline ExecutorAddr operator+(const ExecutorAddrDiff &LHS,
|
||||||
const ExecutorAddress &RHS) {
|
const ExecutorAddr &RHS) {
|
||||||
return ExecutorAddress(LHS.getValue() + RHS.getValue());
|
return ExecutorAddr(LHS.getValue() + RHS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an address range in the exceutor process.
|
/// Represents an address range in the exceutor process.
|
||||||
struct ExecutorAddressRange {
|
struct ExecutorAddrRange {
|
||||||
ExecutorAddressRange() = default;
|
ExecutorAddrRange() = default;
|
||||||
ExecutorAddressRange(ExecutorAddress StartAddress, ExecutorAddress EndAddress)
|
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
|
||||||
: StartAddress(StartAddress), EndAddress(EndAddress) {}
|
: Start(Start), End(End) {}
|
||||||
|
|
||||||
bool empty() const { return StartAddress == EndAddress; }
|
bool empty() const { return Start == End; }
|
||||||
ExecutorAddrDiff size() const { return EndAddress - StartAddress; }
|
ExecutorAddrDiff size() const { return End - Start; }
|
||||||
|
|
||||||
ExecutorAddress StartAddress;
|
ExecutorAddr Start;
|
||||||
ExecutorAddress EndAddress;
|
ExecutorAddr End;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace shared {
|
namespace shared {
|
||||||
|
|
||||||
/// SPS serializatior for ExecutorAddress.
|
/// SPS serializatior for ExecutorAddr.
|
||||||
template <> class SPSSerializationTraits<SPSExecutorAddress, ExecutorAddress> {
|
template <> class SPSSerializationTraits<SPSExecutorAddr, ExecutorAddr> {
|
||||||
public:
|
public:
|
||||||
static size_t size(const ExecutorAddress &EA) {
|
static size_t size(const ExecutorAddr &EA) {
|
||||||
return SPSArgList<uint64_t>::size(EA.getValue());
|
return SPSArgList<uint64_t>::size(EA.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddress &EA) {
|
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddr &EA) {
|
||||||
return SPSArgList<uint64_t>::serialize(BOB, EA.getValue());
|
return SPSArgList<uint64_t>::serialize(BOB, EA.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddress &EA) {
|
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddr &EA) {
|
||||||
uint64_t Tmp;
|
uint64_t Tmp;
|
||||||
if (!SPSArgList<uint64_t>::deserialize(BIB, Tmp))
|
if (!SPSArgList<uint64_t>::deserialize(BIB, Tmp))
|
||||||
return false;
|
return false;
|
||||||
EA = ExecutorAddress(Tmp);
|
EA = ExecutorAddr(Tmp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SPSExecutorAddressRange =
|
using SPSExecutorAddrRange = SPSTuple<SPSExecutorAddr, SPSExecutorAddr>;
|
||||||
SPSTuple<SPSExecutorAddress, SPSExecutorAddress>;
|
|
||||||
|
|
||||||
/// Serialization traits for address ranges.
|
/// Serialization traits for address ranges.
|
||||||
template <>
|
template <>
|
||||||
class SPSSerializationTraits<SPSExecutorAddressRange, ExecutorAddressRange> {
|
class SPSSerializationTraits<SPSExecutorAddrRange, ExecutorAddrRange> {
|
||||||
public:
|
public:
|
||||||
static size_t size(const ExecutorAddressRange &Value) {
|
static size_t size(const ExecutorAddrRange &Value) {
|
||||||
return SPSArgList<SPSExecutorAddress, SPSExecutorAddress>::size(
|
return SPSArgList<SPSExecutorAddr, SPSExecutorAddr>::size(Value.Start,
|
||||||
Value.StartAddress, Value.EndAddress);
|
Value.End);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool serialize(SPSOutputBuffer &BOB,
|
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddrRange &Value) {
|
||||||
const ExecutorAddressRange &Value) {
|
return SPSArgList<SPSExecutorAddr, SPSExecutorAddr>::serialize(
|
||||||
return SPSArgList<SPSExecutorAddress, SPSExecutorAddress>::serialize(
|
BOB, Value.Start, Value.End);
|
||||||
BOB, Value.StartAddress, Value.EndAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddressRange &Value) {
|
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddrRange &Value) {
|
||||||
return SPSArgList<SPSExecutorAddress, SPSExecutorAddress>::deserialize(
|
return SPSArgList<SPSExecutorAddr, SPSExecutorAddr>::deserialize(
|
||||||
BIB, Value.StartAddress, Value.EndAddress);
|
BIB, Value.Start, Value.End);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SPSExecutorAddressRangeSequence = SPSSequence<SPSExecutorAddressRange>;
|
using SPSExecutorAddrRangeSequence = SPSSequence<SPSExecutorAddrRange>;
|
||||||
|
|
||||||
} // End namespace shared.
|
} // End namespace shared.
|
||||||
} // End namespace orc.
|
} // End namespace orc.
|
||||||
|
|||||||
@@ -40,23 +40,22 @@ extern const char *MemoryWriteBuffersWrapperName;
|
|||||||
extern const char *RunAsMainWrapperName;
|
extern const char *RunAsMainWrapperName;
|
||||||
|
|
||||||
using SPSSimpleExecutorDylibManagerOpenSignature =
|
using SPSSimpleExecutorDylibManagerOpenSignature =
|
||||||
shared::SPSExpected<uint64_t>(shared::SPSExecutorAddress, shared::SPSString,
|
shared::SPSExpected<uint64_t>(shared::SPSExecutorAddr, shared::SPSString,
|
||||||
uint64_t);
|
uint64_t);
|
||||||
|
|
||||||
using SPSSimpleExecutorDylibManagerLookupSignature =
|
using SPSSimpleExecutorDylibManagerLookupSignature =
|
||||||
shared::SPSExpected<shared::SPSSequence<shared::SPSExecutorAddress>>(
|
shared::SPSExpected<shared::SPSSequence<shared::SPSExecutorAddr>>(
|
||||||
shared::SPSExecutorAddress, uint64_t, shared::SPSRemoteSymbolLookupSet);
|
shared::SPSExecutorAddr, uint64_t, shared::SPSRemoteSymbolLookupSet);
|
||||||
|
|
||||||
using SPSSimpleExecutorMemoryManagerReserveSignature =
|
using SPSSimpleExecutorMemoryManagerReserveSignature =
|
||||||
shared::SPSExpected<shared::SPSExecutorAddress>(shared::SPSExecutorAddress,
|
shared::SPSExpected<shared::SPSExecutorAddr>(shared::SPSExecutorAddr,
|
||||||
uint64_t);
|
uint64_t);
|
||||||
using SPSSimpleExecutorMemoryManagerFinalizeSignature =
|
using SPSSimpleExecutorMemoryManagerFinalizeSignature =
|
||||||
shared::SPSError(shared::SPSExecutorAddress, shared::SPSFinalizeRequest);
|
shared::SPSError(shared::SPSExecutorAddr, shared::SPSFinalizeRequest);
|
||||||
using SPSSimpleExecutorMemoryManagerDeallocateSignature =
|
using SPSSimpleExecutorMemoryManagerDeallocateSignature = shared::SPSError(
|
||||||
shared::SPSError(shared::SPSExecutorAddress,
|
shared::SPSExecutorAddr, shared::SPSSequence<shared::SPSExecutorAddr>);
|
||||||
shared::SPSSequence<shared::SPSExecutorAddress>);
|
|
||||||
|
|
||||||
using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddress,
|
using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddr,
|
||||||
shared::SPSSequence<shared::SPSString>);
|
shared::SPSSequence<shared::SPSString>);
|
||||||
|
|
||||||
} // end namespace rt
|
} // end namespace rt
|
||||||
|
|||||||
@@ -196,10 +196,10 @@ template <typename SPSElementTagT> class SPSSequence;
|
|||||||
using SPSString = SPSSequence<char>;
|
using SPSString = SPSSequence<char>;
|
||||||
|
|
||||||
/// SPS tag type for executor addresseses.
|
/// SPS tag type for executor addresseses.
|
||||||
class SPSExecutorAddress {};
|
class SPSExecutorAddr {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class SPSSerializationTraits<SPSExecutorAddress, uint64_t>
|
class SPSSerializationTraits<SPSExecutorAddr, uint64_t>
|
||||||
: public SPSSerializationTraits<uint64_t, uint64_t> {};
|
: public SPSSerializationTraits<uint64_t, uint64_t> {};
|
||||||
|
|
||||||
/// SPS tag type for maps.
|
/// SPS tag type for maps.
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ enum class SimpleRemoteEPCOpcode : uint8_t {
|
|||||||
struct SimpleRemoteEPCExecutorInfo {
|
struct SimpleRemoteEPCExecutorInfo {
|
||||||
std::string TargetTriple;
|
std::string TargetTriple;
|
||||||
uint64_t PageSize;
|
uint64_t PageSize;
|
||||||
StringMap<ExecutorAddress> BootstrapSymbols;
|
StringMap<ExecutorAddr> BootstrapSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
using SimpleRemoteEPCArgBytesVector = SmallVector<char, 128>;
|
using SimpleRemoteEPCArgBytesVector = SmallVector<char, 128>;
|
||||||
@@ -61,8 +61,7 @@ public:
|
|||||||
/// client will not accept any further messages, and 'ContinueSession'
|
/// client will not accept any further messages, and 'ContinueSession'
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
virtual Expected<HandleMessageAction>
|
virtual Expected<HandleMessageAction>
|
||||||
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
ExecutorAddress TagAddr,
|
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) = 0;
|
SimpleRemoteEPCArgBytesVector ArgBytes) = 0;
|
||||||
|
|
||||||
/// Handle a disconnection from the underlying transport. No further messages
|
/// Handle a disconnection from the underlying transport. No further messages
|
||||||
@@ -83,8 +82,7 @@ public:
|
|||||||
/// This function may be called concurrently. Subclasses should implement
|
/// This function may be called concurrently. Subclasses should implement
|
||||||
/// locking if required for the underlying transport.
|
/// locking if required for the underlying transport.
|
||||||
virtual Error sendMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
virtual Error sendMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
||||||
ExecutorAddress TagAddr,
|
ExecutorAddr TagAddr, ArrayRef<char> ArgBytes) = 0;
|
||||||
ArrayRef<char> ArgBytes) = 0;
|
|
||||||
|
|
||||||
/// Trigger disconnection from the transport. The implementation should
|
/// Trigger disconnection from the transport. The implementation should
|
||||||
/// respond by calling handleDisconnect on the client once disconnection
|
/// respond by calling handleDisconnect on the client once disconnection
|
||||||
@@ -110,7 +108,7 @@ public:
|
|||||||
~FDSimpleRemoteEPCTransport() override;
|
~FDSimpleRemoteEPCTransport() override;
|
||||||
|
|
||||||
Error sendMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
Error sendMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
||||||
ExecutorAddress TagAddr, ArrayRef<char> ArgBytes) override;
|
ExecutorAddr TagAddr, ArrayRef<char> ArgBytes) override;
|
||||||
|
|
||||||
void disconnect() override;
|
void disconnect() override;
|
||||||
|
|
||||||
@@ -151,7 +149,7 @@ using SPSRemoteSymbolLookup = SPSTuple<uint64_t, SPSRemoteSymbolLookupSet>;
|
|||||||
/// Tuple containing target triple, page size, and bootstrap symbols.
|
/// Tuple containing target triple, page size, and bootstrap symbols.
|
||||||
using SPSSimpleRemoteEPCExecutorInfo =
|
using SPSSimpleRemoteEPCExecutorInfo =
|
||||||
SPSTuple<SPSString, uint64_t,
|
SPSTuple<SPSString, uint64_t,
|
||||||
SPSSequence<SPSTuple<SPSString, SPSExecutorAddress>>>;
|
SPSSequence<SPSTuple<SPSString, SPSExecutorAddr>>>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class SPSSerializationTraits<SPSRemoteSymbolLookupSetElement,
|
class SPSSerializationTraits<SPSRemoteSymbolLookupSetElement,
|
||||||
@@ -211,12 +209,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using SPSLoadDylibSignature =
|
using SPSLoadDylibSignature = SPSExpected<SPSExecutorAddr>(SPSExecutorAddr,
|
||||||
SPSExpected<SPSExecutorAddress>(SPSExecutorAddress, SPSString, uint64_t);
|
SPSString, uint64_t);
|
||||||
|
|
||||||
using SPSLookupSymbolsSignature =
|
using SPSLookupSymbolsSignature =
|
||||||
SPSExpected<SPSSequence<SPSSequence<SPSExecutorAddress>>>(
|
SPSExpected<SPSSequence<SPSSequence<SPSExecutorAddr>>>(
|
||||||
SPSExecutorAddress, SPSSequence<SPSRemoteSymbolLookup>);
|
SPSExecutorAddr, SPSSequence<SPSRemoteSymbolLookup>);
|
||||||
|
|
||||||
} // end namespace shared
|
} // end namespace shared
|
||||||
} // end namespace orc
|
} // end namespace orc
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ inline std::string getWireProtectionFlagsStr(WireProtectionFlags WPF) {
|
|||||||
struct SupportFunctionCall {
|
struct SupportFunctionCall {
|
||||||
using FnTy = shared::detail::CWrapperFunctionResult(const char *ArgData,
|
using FnTy = shared::detail::CWrapperFunctionResult(const char *ArgData,
|
||||||
size_t ArgSize);
|
size_t ArgSize);
|
||||||
ExecutorAddress Func;
|
ExecutorAddr Func;
|
||||||
ExecutorAddress ArgData;
|
ExecutorAddr ArgData;
|
||||||
uint64_t ArgSize;
|
uint64_t ArgSize;
|
||||||
|
|
||||||
Error run() {
|
Error run() {
|
||||||
@@ -96,7 +96,7 @@ struct AllocationActionsPair {
|
|||||||
|
|
||||||
struct SegFinalizeRequest {
|
struct SegFinalizeRequest {
|
||||||
WireProtectionFlags Prot;
|
WireProtectionFlags Prot;
|
||||||
ExecutorAddress Addr;
|
ExecutorAddr Addr;
|
||||||
uint64_t Size;
|
uint64_t Size;
|
||||||
ArrayRef<char> Content;
|
ArrayRef<char> Content;
|
||||||
};
|
};
|
||||||
@@ -150,10 +150,10 @@ namespace shared {
|
|||||||
class SPSMemoryProtectionFlags {};
|
class SPSMemoryProtectionFlags {};
|
||||||
|
|
||||||
using SPSSupportFunctionCall =
|
using SPSSupportFunctionCall =
|
||||||
SPSTuple<SPSExecutorAddress, SPSExecutorAddress, uint64_t>;
|
SPSTuple<SPSExecutorAddr, SPSExecutorAddr, uint64_t>;
|
||||||
|
|
||||||
using SPSSegFinalizeRequest =
|
using SPSSegFinalizeRequest =
|
||||||
SPSTuple<SPSMemoryProtectionFlags, SPSExecutorAddress, uint64_t,
|
SPSTuple<SPSMemoryProtectionFlags, SPSExecutorAddr, uint64_t,
|
||||||
SPSSequence<char>>;
|
SPSSequence<char>>;
|
||||||
|
|
||||||
using SPSAllocationActionsPair =
|
using SPSAllocationActionsPair =
|
||||||
@@ -163,15 +163,14 @@ using SPSFinalizeRequest = SPSTuple<SPSSequence<SPSSegFinalizeRequest>,
|
|||||||
SPSSequence<SPSAllocationActionsPair>>;
|
SPSSequence<SPSAllocationActionsPair>>;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using SPSMemoryAccessUIntWrite = SPSTuple<SPSExecutorAddress, T>;
|
using SPSMemoryAccessUIntWrite = SPSTuple<SPSExecutorAddr, T>;
|
||||||
|
|
||||||
using SPSMemoryAccessUInt8Write = SPSMemoryAccessUIntWrite<uint8_t>;
|
using SPSMemoryAccessUInt8Write = SPSMemoryAccessUIntWrite<uint8_t>;
|
||||||
using SPSMemoryAccessUInt16Write = SPSMemoryAccessUIntWrite<uint16_t>;
|
using SPSMemoryAccessUInt16Write = SPSMemoryAccessUIntWrite<uint16_t>;
|
||||||
using SPSMemoryAccessUInt32Write = SPSMemoryAccessUIntWrite<uint32_t>;
|
using SPSMemoryAccessUInt32Write = SPSMemoryAccessUIntWrite<uint32_t>;
|
||||||
using SPSMemoryAccessUInt64Write = SPSMemoryAccessUIntWrite<uint64_t>;
|
using SPSMemoryAccessUInt64Write = SPSMemoryAccessUIntWrite<uint64_t>;
|
||||||
|
|
||||||
using SPSMemoryAccessBufferWrite =
|
using SPSMemoryAccessBufferWrite = SPSTuple<SPSExecutorAddr, SPSSequence<char>>;
|
||||||
SPSTuple<SPSExecutorAddress, SPSSequence<char>>;
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class SPSSerializationTraits<SPSMemoryProtectionFlags,
|
class SPSSerializationTraits<SPSMemoryProtectionFlags,
|
||||||
@@ -283,17 +282,17 @@ class SPSSerializationTraits<SPSMemoryAccessUIntWrite<T>,
|
|||||||
tpctypes::UIntWrite<T>> {
|
tpctypes::UIntWrite<T>> {
|
||||||
public:
|
public:
|
||||||
static size_t size(const tpctypes::UIntWrite<T> &W) {
|
static size_t size(const tpctypes::UIntWrite<T> &W) {
|
||||||
return SPSTuple<SPSExecutorAddress, T>::AsArgList::size(W.Address, W.Value);
|
return SPSTuple<SPSExecutorAddr, T>::AsArgList::size(W.Address, W.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool serialize(SPSOutputBuffer &OB, const tpctypes::UIntWrite<T> &W) {
|
static bool serialize(SPSOutputBuffer &OB, const tpctypes::UIntWrite<T> &W) {
|
||||||
return SPSTuple<SPSExecutorAddress, T>::AsArgList::serialize(OB, W.Address,
|
return SPSTuple<SPSExecutorAddr, T>::AsArgList::serialize(OB, W.Address,
|
||||||
W.Value);
|
W.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool deserialize(SPSInputBuffer &IB, tpctypes::UIntWrite<T> &W) {
|
static bool deserialize(SPSInputBuffer &IB, tpctypes::UIntWrite<T> &W) {
|
||||||
return SPSTuple<SPSExecutorAddress, T>::AsArgList::deserialize(
|
return SPSTuple<SPSExecutorAddr, T>::AsArgList::deserialize(IB, W.Address,
|
||||||
IB, W.Address, W.Value);
|
W.Value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -302,18 +301,17 @@ class SPSSerializationTraits<SPSMemoryAccessBufferWrite,
|
|||||||
tpctypes::BufferWrite> {
|
tpctypes::BufferWrite> {
|
||||||
public:
|
public:
|
||||||
static size_t size(const tpctypes::BufferWrite &W) {
|
static size_t size(const tpctypes::BufferWrite &W) {
|
||||||
return SPSTuple<SPSExecutorAddress, SPSSequence<char>>::AsArgList::size(
|
return SPSTuple<SPSExecutorAddr, SPSSequence<char>>::AsArgList::size(
|
||||||
W.Address, W.Buffer);
|
W.Address, W.Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool serialize(SPSOutputBuffer &OB, const tpctypes::BufferWrite &W) {
|
static bool serialize(SPSOutputBuffer &OB, const tpctypes::BufferWrite &W) {
|
||||||
return SPSTuple<SPSExecutorAddress,
|
return SPSTuple<SPSExecutorAddr, SPSSequence<char>>::AsArgList ::serialize(
|
||||||
SPSSequence<char>>::AsArgList ::serialize(OB, W.Address,
|
OB, W.Address, W.Buffer);
|
||||||
W.Buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool deserialize(SPSInputBuffer &IB, tpctypes::BufferWrite &W) {
|
static bool deserialize(SPSInputBuffer &IB, tpctypes::BufferWrite &W) {
|
||||||
return SPSTuple<SPSExecutorAddress,
|
return SPSTuple<SPSExecutorAddr,
|
||||||
SPSSequence<char>>::AsArgList ::deserialize(IB, W.Address,
|
SPSSequence<char>>::AsArgList ::deserialize(IB, W.Address,
|
||||||
W.Buffer);
|
W.Buffer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ public:
|
|||||||
using WrapperFunction<SPSEmpty(SPSTagTs...)>::handleAsync;
|
using WrapperFunction<SPSEmpty(SPSTagTs...)>::handleAsync;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A function object that takes an ExecutorAddress as its first argument,
|
/// A function object that takes an ExecutorAddr as its first argument,
|
||||||
/// casts that address to a ClassT*, then calls the given method on that
|
/// casts that address to a ClassT*, then calls the given method on that
|
||||||
/// pointer passing in the remaining function arguments. This utility
|
/// pointer passing in the remaining function arguments. This utility
|
||||||
/// removes some of the boilerplate from writing wrappers for method calls.
|
/// removes some of the boilerplate from writing wrappers for method calls.
|
||||||
@@ -580,7 +580,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// // SPS Method signature -- note MyClass object address as first argument.
|
/// // SPS Method signature -- note MyClass object address as first argument.
|
||||||
/// using SPSMyMethodWrapperSignature =
|
/// using SPSMyMethodWrapperSignature =
|
||||||
/// SPSTuple<SPSExecutorAddress, uint32_t, bool>;
|
/// SPSTuple<SPSExecutorAddr, uint32_t, bool>;
|
||||||
///
|
///
|
||||||
/// WrapperFunctionResult
|
/// WrapperFunctionResult
|
||||||
/// myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
|
/// myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
|
||||||
@@ -594,9 +594,10 @@ class MethodWrapperHandler {
|
|||||||
public:
|
public:
|
||||||
using MethodT = RetT (ClassT::*)(ArgTs...);
|
using MethodT = RetT (ClassT::*)(ArgTs...);
|
||||||
MethodWrapperHandler(MethodT M) : M(M) {}
|
MethodWrapperHandler(MethodT M) : M(M) {}
|
||||||
RetT operator()(ExecutorAddress ObjAddr, ArgTs &... Args) {
|
RetT operator()(ExecutorAddr ObjAddr, ArgTs &...Args) {
|
||||||
return (ObjAddr.toPtr<ClassT*>()->*M)(std::forward<ArgTs>(Args)...);
|
return (ObjAddr.toPtr<ClassT*>()->*M)(std::forward<ArgTs>(Args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MethodT M;
|
MethodT M;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -77,8 +77,7 @@ public:
|
|||||||
Error disconnect() override;
|
Error disconnect() override;
|
||||||
|
|
||||||
Expected<HandleMessageAction>
|
Expected<HandleMessageAction>
|
||||||
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
ExecutorAddress TagAddr,
|
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) override;
|
SimpleRemoteEPCArgBytesVector ArgBytes) override;
|
||||||
|
|
||||||
void handleDisconnect(Error Err) override;
|
void handleDisconnect(Error Err) override;
|
||||||
@@ -92,16 +91,16 @@ private:
|
|||||||
SimpleRemoteEPC(std::shared_ptr<SymbolStringPool> SSP)
|
SimpleRemoteEPC(std::shared_ptr<SymbolStringPool> SSP)
|
||||||
: ExecutorProcessControl(std::move(SSP)) {}
|
: ExecutorProcessControl(std::move(SSP)) {}
|
||||||
|
|
||||||
Error handleSetup(uint64_t SeqNo, ExecutorAddress TagAddr,
|
Error handleSetup(uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes);
|
SimpleRemoteEPCArgBytesVector ArgBytes);
|
||||||
void prepareToReceiveSetupMessage(
|
void prepareToReceiveSetupMessage(
|
||||||
std::promise<MSVCPExpected<SimpleRemoteEPCExecutorInfo>> &ExecInfoP);
|
std::promise<MSVCPExpected<SimpleRemoteEPCExecutorInfo>> &ExecInfoP);
|
||||||
Error setup(std::unique_ptr<SimpleRemoteEPCTransport> T,
|
Error setup(std::unique_ptr<SimpleRemoteEPCTransport> T,
|
||||||
SimpleRemoteEPCExecutorInfo EI);
|
SimpleRemoteEPCExecutorInfo EI);
|
||||||
|
|
||||||
Error handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
|
Error handleResult(uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes);
|
SimpleRemoteEPCArgBytesVector ArgBytes);
|
||||||
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
|
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes);
|
SimpleRemoteEPCArgBytesVector ArgBytes);
|
||||||
|
|
||||||
uint64_t getNextSeqNo() { return NextSeqNo++; }
|
uint64_t getNextSeqNo() { return NextSeqNo++; }
|
||||||
@@ -116,7 +115,7 @@ private:
|
|||||||
std::unique_ptr<MemoryAccess> OwnedMemAccess;
|
std::unique_ptr<MemoryAccess> OwnedMemAccess;
|
||||||
|
|
||||||
std::unique_ptr<EPCGenericDylibManager> DylibMgr;
|
std::unique_ptr<EPCGenericDylibManager> DylibMgr;
|
||||||
ExecutorAddress RunAsMainAddr;
|
ExecutorAddr RunAsMainAddr;
|
||||||
|
|
||||||
uint64_t NextSeqNo = 0;
|
uint64_t NextSeqNo = 0;
|
||||||
PendingCallWrapperResultsMap PendingCallWrapperResults;
|
PendingCallWrapperResultsMap PendingCallWrapperResults;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
virtual ~ExecutorBootstrapService();
|
virtual ~ExecutorBootstrapService();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
addBootstrapSymbols(StringMap<ExecutorAddress> &BootstrapSymbols) = 0;
|
addBootstrapSymbols(StringMap<ExecutorAddr> &BootstrapSymbols) = 0;
|
||||||
virtual Error shutdown() = 0;
|
virtual Error shutdown() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ public:
|
|||||||
virtual ~SimpleExecutorDylibManager();
|
virtual ~SimpleExecutorDylibManager();
|
||||||
|
|
||||||
Expected<tpctypes::DylibHandle> open(const std::string &Path, uint64_t Mode);
|
Expected<tpctypes::DylibHandle> open(const std::string &Path, uint64_t Mode);
|
||||||
Expected<std::vector<ExecutorAddress>> lookup(tpctypes::DylibHandle H,
|
Expected<std::vector<ExecutorAddr>> lookup(tpctypes::DylibHandle H,
|
||||||
const RemoteSymbolLookupSet &L);
|
const RemoteSymbolLookupSet &L);
|
||||||
|
|
||||||
Error shutdown() override;
|
Error shutdown() override;
|
||||||
void addBootstrapSymbols(StringMap<ExecutorAddress> &M) override;
|
void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using DylibsMap = DenseMap<uint64_t, sys::DynamicLibrary>;
|
using DylibsMap = DenseMap<uint64_t, sys::DynamicLibrary>;
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ class SimpleExecutorMemoryManager : public ExecutorBootstrapService {
|
|||||||
public:
|
public:
|
||||||
virtual ~SimpleExecutorMemoryManager();
|
virtual ~SimpleExecutorMemoryManager();
|
||||||
|
|
||||||
Expected<ExecutorAddress> allocate(uint64_t Size);
|
Expected<ExecutorAddr> allocate(uint64_t Size);
|
||||||
Error finalize(tpctypes::FinalizeRequest &FR);
|
Error finalize(tpctypes::FinalizeRequest &FR);
|
||||||
Error deallocate(const std::vector<ExecutorAddress> &Bases);
|
Error deallocate(const std::vector<ExecutorAddr> &Bases);
|
||||||
|
|
||||||
Error shutdown() override;
|
Error shutdown() override;
|
||||||
void addBootstrapSymbols(StringMap<ExecutorAddress> &M) override;
|
void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Allocation {
|
struct Allocation {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SimpleRemoteEPCServer &server();
|
SimpleRemoteEPCServer &server();
|
||||||
StringMap<ExecutorAddress> &bootstrapSymbols() { return BootstrapSymbols; }
|
StringMap<ExecutorAddr> &bootstrapSymbols() { return BootstrapSymbols; }
|
||||||
std::vector<std::unique_ptr<ExecutorBootstrapService>> &services() {
|
std::vector<std::unique_ptr<ExecutorBootstrapService>> &services() {
|
||||||
return Services;
|
return Services;
|
||||||
}
|
}
|
||||||
@@ -76,11 +76,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
Setup(SimpleRemoteEPCServer &S) : S(S) {}
|
Setup(SimpleRemoteEPCServer &S) : S(S) {}
|
||||||
SimpleRemoteEPCServer &S;
|
SimpleRemoteEPCServer &S;
|
||||||
StringMap<ExecutorAddress> BootstrapSymbols;
|
StringMap<ExecutorAddr> BootstrapSymbols;
|
||||||
std::vector<std::unique_ptr<ExecutorBootstrapService>> Services;
|
std::vector<std::unique_ptr<ExecutorBootstrapService>> Services;
|
||||||
};
|
};
|
||||||
|
|
||||||
static StringMap<ExecutorAddress> defaultBootstrapSymbols();
|
static StringMap<ExecutorAddr> defaultBootstrapSymbols();
|
||||||
|
|
||||||
template <typename TransportT, typename... TransportTCtorArgTs>
|
template <typename TransportT, typename... TransportTCtorArgTs>
|
||||||
static Expected<std::unique_ptr<SimpleRemoteEPCServer>>
|
static Expected<std::unique_ptr<SimpleRemoteEPCServer>>
|
||||||
@@ -128,8 +128,7 @@ public:
|
|||||||
/// otherwise returns 'Continue'. If the server has moved to an error state,
|
/// otherwise returns 'Continue'. If the server has moved to an error state,
|
||||||
/// returns an error, which should be reported and treated as a 'Disconnect'.
|
/// returns an error, which should be reported and treated as a 'Disconnect'.
|
||||||
Expected<HandleMessageAction>
|
Expected<HandleMessageAction>
|
||||||
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
ExecutorAddress TagAddr,
|
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) override;
|
SimpleRemoteEPCArgBytesVector ArgBytes) override;
|
||||||
|
|
||||||
Error waitForDisconnect();
|
Error waitForDisconnect();
|
||||||
@@ -137,11 +136,11 @@ public:
|
|||||||
void handleDisconnect(Error Err) override;
|
void handleDisconnect(Error Err) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Error sendSetupMessage(StringMap<ExecutorAddress> BootstrapSymbols);
|
Error sendSetupMessage(StringMap<ExecutorAddr> BootstrapSymbols);
|
||||||
|
|
||||||
Error handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
|
Error handleResult(uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes);
|
SimpleRemoteEPCArgBytesVector ArgBytes);
|
||||||
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
|
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes);
|
SimpleRemoteEPCArgBytesVector ArgBytes);
|
||||||
|
|
||||||
shared::WrapperFunctionResult
|
shared::WrapperFunctionResult
|
||||||
|
|||||||
@@ -125,10 +125,10 @@ ELFNixPlatform::Create(ExecutionSession &ES,
|
|||||||
// Add JIT-dispatch function support symbols.
|
// Add JIT-dispatch function support symbols.
|
||||||
if (auto Err = PlatformJD.define(absoluteSymbols(
|
if (auto Err = PlatformJD.define(absoluteSymbols(
|
||||||
{{ES.intern("__orc_rt_jit_dispatch"),
|
{{ES.intern("__orc_rt_jit_dispatch"),
|
||||||
{EPC.getJITDispatchInfo().JITDispatchFunctionAddress.getValue(),
|
{EPC.getJITDispatchInfo().JITDispatchFunction.getValue(),
|
||||||
JITSymbolFlags::Exported}},
|
JITSymbolFlags::Exported}},
|
||||||
{ES.intern("__orc_rt_jit_dispatch_ctx"),
|
{ES.intern("__orc_rt_jit_dispatch_ctx"),
|
||||||
{EPC.getJITDispatchInfo().JITDispatchContextAddress.getValue(),
|
{EPC.getJITDispatchInfo().JITDispatchContext.getValue(),
|
||||||
JITSymbolFlags::Exported}}})))
|
JITSymbolFlags::Exported}}})))
|
||||||
return std::move(Err);
|
return std::move(Err);
|
||||||
|
|
||||||
@@ -274,13 +274,13 @@ Error ELFNixPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) {
|
|||||||
this, &ELFNixPlatform::rt_getInitializers);
|
this, &ELFNixPlatform::rt_getInitializers);
|
||||||
|
|
||||||
using GetDeinitializersSPSSig =
|
using GetDeinitializersSPSSig =
|
||||||
SPSExpected<SPSELFJITDylibDeinitializerSequence>(SPSExecutorAddress);
|
SPSExpected<SPSELFJITDylibDeinitializerSequence>(SPSExecutorAddr);
|
||||||
WFs[ES.intern("__orc_rt_elfnix_get_deinitializers_tag")] =
|
WFs[ES.intern("__orc_rt_elfnix_get_deinitializers_tag")] =
|
||||||
ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
|
ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
|
||||||
this, &ELFNixPlatform::rt_getDeinitializers);
|
this, &ELFNixPlatform::rt_getDeinitializers);
|
||||||
|
|
||||||
using LookupSymbolSPSSig =
|
using LookupSymbolSPSSig =
|
||||||
SPSExpected<SPSExecutorAddress>(SPSExecutorAddress, SPSString);
|
SPSExpected<SPSExecutorAddr>(SPSExecutorAddr, SPSString);
|
||||||
WFs[ES.intern("__orc_rt_elfnix_symbol_lookup_tag")] =
|
WFs[ES.intern("__orc_rt_elfnix_symbol_lookup_tag")] =
|
||||||
ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
|
ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
|
||||||
&ELFNixPlatform::rt_lookupSymbol);
|
&ELFNixPlatform::rt_lookupSymbol);
|
||||||
@@ -364,7 +364,7 @@ void ELFNixPlatform::rt_getInitializers(SendInitializerSequenceFn SendResult,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ELFNixPlatform::rt_getDeinitializers(
|
void ELFNixPlatform::rt_getDeinitializers(
|
||||||
SendDeinitializerSequenceFn SendResult, ExecutorAddress Handle) {
|
SendDeinitializerSequenceFn SendResult, ExecutorAddr Handle) {
|
||||||
LLVM_DEBUG({
|
LLVM_DEBUG({
|
||||||
dbgs() << "ELFNixPlatform::rt_getDeinitializers(\""
|
dbgs() << "ELFNixPlatform::rt_getDeinitializers(\""
|
||||||
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
|
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
|
||||||
@@ -394,7 +394,7 @@ void ELFNixPlatform::rt_getDeinitializers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
||||||
ExecutorAddress Handle,
|
ExecutorAddr Handle,
|
||||||
StringRef SymbolName) {
|
StringRef SymbolName) {
|
||||||
LLVM_DEBUG({
|
LLVM_DEBUG({
|
||||||
dbgs() << "ELFNixPlatform::rt_lookupSymbol(\""
|
dbgs() << "ELFNixPlatform::rt_lookupSymbol(\""
|
||||||
@@ -429,7 +429,7 @@ void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
|||||||
void operator()(Expected<SymbolMap> Result) {
|
void operator()(Expected<SymbolMap> Result) {
|
||||||
if (Result) {
|
if (Result) {
|
||||||
assert(Result->size() == 1 && "Unexpected result map count");
|
assert(Result->size() == 1 && "Unexpected result map count");
|
||||||
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
|
SendResult(ExecutorAddr(Result->begin()->second.getAddress()));
|
||||||
} else {
|
} else {
|
||||||
SendResult(Result.takeError());
|
SendResult(Result.takeError());
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,7 @@ void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
|||||||
|
|
||||||
Error ELFNixPlatform::bootstrapELFNixRuntime(JITDylib &PlatformJD) {
|
Error ELFNixPlatform::bootstrapELFNixRuntime(JITDylib &PlatformJD) {
|
||||||
|
|
||||||
std::pair<const char *, ExecutorAddress *> Symbols[] = {
|
std::pair<const char *, ExecutorAddr *> Symbols[] = {
|
||||||
{"__orc_rt_elfnix_platform_bootstrap", &orc_rt_elfnix_platform_bootstrap},
|
{"__orc_rt_elfnix_platform_bootstrap", &orc_rt_elfnix_platform_bootstrap},
|
||||||
{"__orc_rt_elfnix_platform_shutdown", &orc_rt_elfnix_platform_shutdown},
|
{"__orc_rt_elfnix_platform_shutdown", &orc_rt_elfnix_platform_shutdown},
|
||||||
{"__orc_rt_elfnix_register_object_sections",
|
{"__orc_rt_elfnix_register_object_sections",
|
||||||
@@ -456,7 +456,7 @@ Error ELFNixPlatform::bootstrapELFNixRuntime(JITDylib &PlatformJD) {
|
|||||||
&orc_rt_elfnix_create_pthread_key}};
|
&orc_rt_elfnix_create_pthread_key}};
|
||||||
|
|
||||||
SymbolLookupSet RuntimeSymbols;
|
SymbolLookupSet RuntimeSymbols;
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> AddrsToRecord;
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> AddrsToRecord;
|
||||||
for (const auto &KV : Symbols) {
|
for (const auto &KV : Symbols) {
|
||||||
auto Name = ES.intern(KV.first);
|
auto Name = ES.intern(KV.first);
|
||||||
RuntimeSymbols.add(Name);
|
RuntimeSymbols.add(Name);
|
||||||
@@ -525,7 +525,7 @@ Error ELFNixPlatform::registerInitInfo(
|
|||||||
// FIXME: Avoid copy here.
|
// FIXME: Avoid copy here.
|
||||||
jitlink::SectionRange R(*Sec);
|
jitlink::SectionRange R(*Sec);
|
||||||
InitSeq->InitSections[Sec->getName()].push_back(
|
InitSeq->InitSections[Sec->getName()].push_back(
|
||||||
{ExecutorAddress(R.getStart()), ExecutorAddress(R.getEnd())});
|
{ExecutorAddr(R.getStart()), ExecutorAddr(R.getEnd())});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Error::success();
|
return Error::success();
|
||||||
@@ -627,9 +627,9 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addDSOHandleSupportPasses(
|
|||||||
JITTargetAddress HandleAddr = (*I)->getAddress();
|
JITTargetAddress HandleAddr = (*I)->getAddress();
|
||||||
MP.HandleAddrToJITDylib[HandleAddr] = &JD;
|
MP.HandleAddrToJITDylib[HandleAddr] = &JD;
|
||||||
assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
|
assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
|
||||||
MP.InitSeqs.insert(
|
MP.InitSeqs.insert(std::make_pair(
|
||||||
std::make_pair(&JD, ELFNixJITDylibInitializers(
|
&JD,
|
||||||
JD.getName(), ExecutorAddress(HandleAddr))));
|
ELFNixJITDylibInitializers(JD.getName(), ExecutorAddr(HandleAddr))));
|
||||||
}
|
}
|
||||||
return Error::success();
|
return Error::success();
|
||||||
});
|
});
|
||||||
@@ -656,8 +656,8 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
|
|||||||
if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
|
if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
|
||||||
jitlink::SectionRange R(*EHFrameSection);
|
jitlink::SectionRange R(*EHFrameSection);
|
||||||
if (!R.empty())
|
if (!R.empty())
|
||||||
POSR.EHFrameSection = {ExecutorAddress(R.getStart()),
|
POSR.EHFrameSection = {ExecutorAddr(R.getStart()),
|
||||||
ExecutorAddress(R.getEnd())};
|
ExecutorAddr(R.getEnd())};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a pointer to the thread data section if there is one. It will be used
|
// Get a pointer to the thread data section if there is one. It will be used
|
||||||
@@ -681,12 +681,11 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
|
|||||||
if (ThreadDataSection) {
|
if (ThreadDataSection) {
|
||||||
jitlink::SectionRange R(*ThreadDataSection);
|
jitlink::SectionRange R(*ThreadDataSection);
|
||||||
if (!R.empty())
|
if (!R.empty())
|
||||||
POSR.ThreadDataSection = {ExecutorAddress(R.getStart()),
|
POSR.ThreadDataSection = {ExecutorAddr(R.getStart()),
|
||||||
ExecutorAddress(R.getEnd())};
|
ExecutorAddr(R.getEnd())};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (POSR.EHFrameSection.StartAddress ||
|
if (POSR.EHFrameSection.Start || POSR.ThreadDataSection.Start) {
|
||||||
POSR.ThreadDataSection.StartAddress) {
|
|
||||||
|
|
||||||
// If we're still bootstrapping the runtime then just record this
|
// If we're still bootstrapping the runtime then just record this
|
||||||
// frame for now.
|
// frame for now.
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ createJITLoaderGDBRegistrar(ExecutionSession &ES) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error EPCDebugObjectRegistrar::registerDebugObject(sys::MemoryBlock TargetMem) {
|
Error EPCDebugObjectRegistrar::registerDebugObject(sys::MemoryBlock TargetMem) {
|
||||||
return ES.callSPSWrapper<void(SPSExecutorAddress, uint64_t)>(
|
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
|
||||||
RegisterFn, ExecutorAddress::fromPtr(TargetMem.base()),
|
RegisterFn, ExecutorAddr::fromPtr(TargetMem.base()),
|
||||||
static_cast<uint64_t>(TargetMem.allocatedSize()));
|
static_cast<uint64_t>(TargetMem.allocatedSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ EPCEHFrameRegistrar::Create(ExecutionSession &ES) {
|
|||||||
|
|
||||||
Error EPCEHFrameRegistrar::registerEHFrames(JITTargetAddress EHFrameSectionAddr,
|
Error EPCEHFrameRegistrar::registerEHFrames(JITTargetAddress EHFrameSectionAddr,
|
||||||
size_t EHFrameSectionSize) {
|
size_t EHFrameSectionSize) {
|
||||||
return ES.callSPSWrapper<void(SPSExecutorAddress, uint64_t)>(
|
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
|
||||||
RegisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
|
RegisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
|
||||||
static_cast<uint64_t>(EHFrameSectionSize));
|
static_cast<uint64_t>(EHFrameSectionSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
Error EPCEHFrameRegistrar::deregisterEHFrames(
|
Error EPCEHFrameRegistrar::deregisterEHFrames(
|
||||||
JITTargetAddress EHFrameSectionAddr, size_t EHFrameSectionSize) {
|
JITTargetAddress EHFrameSectionAddr, size_t EHFrameSectionSize) {
|
||||||
return ES.callSPSWrapper<void(SPSExecutorAddress, uint64_t)>(
|
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
|
||||||
DeregisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
|
DeregisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
|
||||||
static_cast<uint64_t>(EHFrameSectionSize));
|
static_cast<uint64_t>(EHFrameSectionSize));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,16 +43,16 @@ template <>
|
|||||||
class SPSSerializationTraits<SPSRemoteSymbolLookup,
|
class SPSSerializationTraits<SPSRemoteSymbolLookup,
|
||||||
ExecutorProcessControl::LookupRequest> {
|
ExecutorProcessControl::LookupRequest> {
|
||||||
using MemberSerialization =
|
using MemberSerialization =
|
||||||
SPSArgList<SPSExecutorAddress, SPSRemoteSymbolLookupSet>;
|
SPSArgList<SPSExecutorAddr, SPSRemoteSymbolLookupSet>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static size_t size(const ExecutorProcessControl::LookupRequest &LR) {
|
static size_t size(const ExecutorProcessControl::LookupRequest &LR) {
|
||||||
return MemberSerialization::size(ExecutorAddress(LR.Handle), LR.Symbols);
|
return MemberSerialization::size(ExecutorAddr(LR.Handle), LR.Symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool serialize(SPSOutputBuffer &OB,
|
static bool serialize(SPSOutputBuffer &OB,
|
||||||
const ExecutorProcessControl::LookupRequest &LR) {
|
const ExecutorProcessControl::LookupRequest &LR) {
|
||||||
return MemberSerialization::serialize(OB, ExecutorAddress(LR.Handle),
|
return MemberSerialization::serialize(OB, ExecutorAddr(LR.Handle),
|
||||||
LR.Symbols);
|
LR.Symbols);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -81,11 +81,10 @@ Expected<tpctypes::DylibHandle> EPCGenericDylibManager::open(StringRef Path,
|
|||||||
return H;
|
return H;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected<std::vector<ExecutorAddress>>
|
Expected<std::vector<ExecutorAddr>>
|
||||||
EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
|
EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
|
||||||
const SymbolLookupSet &Lookup) {
|
const SymbolLookupSet &Lookup) {
|
||||||
Expected<std::vector<ExecutorAddress>> Result(
|
Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
|
||||||
(std::vector<ExecutorAddress>()));
|
|
||||||
if (auto Err =
|
if (auto Err =
|
||||||
EPC.callSPSWrapper<rt::SPSSimpleExecutorDylibManagerLookupSignature>(
|
EPC.callSPSWrapper<rt::SPSSimpleExecutorDylibManagerLookupSignature>(
|
||||||
SAs.Lookup.getValue(), Result, SAs.Instance, H, Lookup))
|
SAs.Lookup.getValue(), Result, SAs.Instance, H, Lookup))
|
||||||
@@ -93,11 +92,10 @@ EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected<std::vector<ExecutorAddress>>
|
Expected<std::vector<ExecutorAddr>>
|
||||||
EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
|
EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
|
||||||
const RemoteSymbolLookupSet &Lookup) {
|
const RemoteSymbolLookupSet &Lookup) {
|
||||||
Expected<std::vector<ExecutorAddress>> Result(
|
Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
|
||||||
(std::vector<ExecutorAddress>()));
|
|
||||||
if (auto Err =
|
if (auto Err =
|
||||||
EPC.callSPSWrapper<rt::SPSSimpleExecutorDylibManagerLookupSignature>(
|
EPC.callSPSWrapper<rt::SPSSimpleExecutorDylibManagerLookupSignature>(
|
||||||
SAs.Lookup.getValue(), Result, SAs.Instance, H, Lookup))
|
SAs.Lookup.getValue(), Result, SAs.Instance, H, Lookup))
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ class EPCGenericJITLinkMemoryManager::Alloc
|
|||||||
public:
|
public:
|
||||||
struct SegInfo {
|
struct SegInfo {
|
||||||
char *WorkingMem = nullptr;
|
char *WorkingMem = nullptr;
|
||||||
ExecutorAddress TargetAddr;
|
ExecutorAddr TargetAddr;
|
||||||
uint64_t ContentSize = 0;
|
uint64_t ContentSize = 0;
|
||||||
uint64_t ZeroFillSize = 0;
|
uint64_t ZeroFillSize = 0;
|
||||||
};
|
};
|
||||||
using SegInfoMap = DenseMap<unsigned, SegInfo>;
|
using SegInfoMap = DenseMap<unsigned, SegInfo>;
|
||||||
|
|
||||||
Alloc(EPCGenericJITLinkMemoryManager &Parent, ExecutorAddress TargetAddr,
|
Alloc(EPCGenericJITLinkMemoryManager &Parent, ExecutorAddr TargetAddr,
|
||||||
std::unique_ptr<char[]> WorkingBuffer, SegInfoMap Segs)
|
std::unique_ptr<char[]> WorkingBuffer, SegInfoMap Segs)
|
||||||
: Parent(Parent), TargetAddr(TargetAddr),
|
: Parent(Parent), TargetAddr(TargetAddr),
|
||||||
WorkingBuffer(std::move(WorkingBuffer)), Segs(std::move(Segs)) {}
|
WorkingBuffer(std::move(WorkingBuffer)), Segs(std::move(Segs)) {}
|
||||||
@@ -75,14 +75,14 @@ public:
|
|||||||
if (auto E2 = Parent.EPC.callSPSWrapper<
|
if (auto E2 = Parent.EPC.callSPSWrapper<
|
||||||
rt::SPSSimpleExecutorMemoryManagerDeallocateSignature>(
|
rt::SPSSimpleExecutorMemoryManagerDeallocateSignature>(
|
||||||
Parent.SAs.Deallocate.getValue(), Err, Parent.SAs.Allocator,
|
Parent.SAs.Deallocate.getValue(), Err, Parent.SAs.Allocator,
|
||||||
ArrayRef<ExecutorAddress>(TargetAddr)))
|
ArrayRef<ExecutorAddr>(TargetAddr)))
|
||||||
return E2;
|
return E2;
|
||||||
return Err;
|
return Err;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EPCGenericJITLinkMemoryManager &Parent;
|
EPCGenericJITLinkMemoryManager &Parent;
|
||||||
ExecutorAddress TargetAddr;
|
ExecutorAddr TargetAddr;
|
||||||
std::unique_ptr<char[]> WorkingBuffer;
|
std::unique_ptr<char[]> WorkingBuffer;
|
||||||
SegInfoMap Segs;
|
SegInfoMap Segs;
|
||||||
};
|
};
|
||||||
@@ -111,7 +111,7 @@ EPCGenericJITLinkMemoryManager::allocate(const jitlink::JITLinkDylib *JD,
|
|||||||
std::unique_ptr<char[]> WorkingBuffer;
|
std::unique_ptr<char[]> WorkingBuffer;
|
||||||
if (WorkingSize > 0)
|
if (WorkingSize > 0)
|
||||||
WorkingBuffer = std::make_unique<char[]>(WorkingSize);
|
WorkingBuffer = std::make_unique<char[]>(WorkingSize);
|
||||||
Expected<ExecutorAddress> TargetAllocAddr((ExecutorAddress()));
|
Expected<ExecutorAddr> TargetAllocAddr((ExecutorAddr()));
|
||||||
if (auto Err = EPC.callSPSWrapper<
|
if (auto Err = EPC.callSPSWrapper<
|
||||||
rt::SPSSimpleExecutorMemoryManagerReserveSignature>(
|
rt::SPSSimpleExecutorMemoryManagerReserveSignature>(
|
||||||
SAs.Reserve.getValue(), TargetAllocAddr, SAs.Allocator, AllocSize))
|
SAs.Reserve.getValue(), TargetAllocAddr, SAs.Allocator, AllocSize))
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ SelfExecutorProcessControl::SelfExecutorProcessControl(
|
|||||||
this->PageSize = PageSize;
|
this->PageSize = PageSize;
|
||||||
this->MemMgr = OwnedMemMgr.get();
|
this->MemMgr = OwnedMemMgr.get();
|
||||||
this->MemAccess = this;
|
this->MemAccess = this;
|
||||||
this->JDI = {ExecutorAddress::fromPtr(jitDispatchViaWrapperFunctionManager),
|
this->JDI = {ExecutorAddr::fromPtr(jitDispatchViaWrapperFunctionManager),
|
||||||
ExecutorAddress::fromPtr(this)};
|
ExecutorAddr::fromPtr(this)};
|
||||||
if (this->TargetTriple.isOSBinFormatMachO())
|
if (this->TargetTriple.isOSBinFormatMachO())
|
||||||
GlobalManglingPrefix = '_';
|
GlobalManglingPrefix = '_';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace orc {
|
|||||||
void lookupAndRecordAddrs(
|
void lookupAndRecordAddrs(
|
||||||
unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
|
unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
|
||||||
const JITDylibSearchOrder &SearchOrder,
|
const JITDylibSearchOrder &SearchOrder,
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
|
||||||
SymbolLookupFlags LookupFlags) {
|
SymbolLookupFlags LookupFlags) {
|
||||||
|
|
||||||
SymbolLookupSet Symbols;
|
SymbolLookupSet Symbols;
|
||||||
@@ -41,7 +41,7 @@ void lookupAndRecordAddrs(
|
|||||||
|
|
||||||
Error lookupAndRecordAddrs(
|
Error lookupAndRecordAddrs(
|
||||||
ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
|
ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
|
||||||
SymbolLookupFlags LookupFlags) {
|
SymbolLookupFlags LookupFlags) {
|
||||||
|
|
||||||
std::promise<MSVCPError> ResultP;
|
std::promise<MSVCPError> ResultP;
|
||||||
@@ -53,7 +53,7 @@ Error lookupAndRecordAddrs(
|
|||||||
|
|
||||||
Error lookupAndRecordAddrs(
|
Error lookupAndRecordAddrs(
|
||||||
ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
|
ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
|
||||||
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
|
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
|
||||||
SymbolLookupFlags LookupFlags) {
|
SymbolLookupFlags LookupFlags) {
|
||||||
|
|
||||||
SymbolLookupSet Symbols;
|
SymbolLookupSet Symbols;
|
||||||
|
|||||||
@@ -173,10 +173,10 @@ MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
|||||||
// Add JIT-dispatch function support symbols.
|
// Add JIT-dispatch function support symbols.
|
||||||
if (auto Err = PlatformJD.define(absoluteSymbols(
|
if (auto Err = PlatformJD.define(absoluteSymbols(
|
||||||
{{ES.intern("___orc_rt_jit_dispatch"),
|
{{ES.intern("___orc_rt_jit_dispatch"),
|
||||||
{EPC.getJITDispatchInfo().JITDispatchFunctionAddress.getValue(),
|
{EPC.getJITDispatchInfo().JITDispatchFunction.getValue(),
|
||||||
JITSymbolFlags::Exported}},
|
JITSymbolFlags::Exported}},
|
||||||
{ES.intern("___orc_rt_jit_dispatch_ctx"),
|
{ES.intern("___orc_rt_jit_dispatch_ctx"),
|
||||||
{EPC.getJITDispatchInfo().JITDispatchContextAddress.getValue(),
|
{EPC.getJITDispatchInfo().JITDispatchContext.getValue(),
|
||||||
JITSymbolFlags::Exported}}})))
|
JITSymbolFlags::Exported}}})))
|
||||||
return std::move(Err);
|
return std::move(Err);
|
||||||
|
|
||||||
@@ -322,13 +322,13 @@ Error MachOPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) {
|
|||||||
this, &MachOPlatform::rt_getInitializers);
|
this, &MachOPlatform::rt_getInitializers);
|
||||||
|
|
||||||
using GetDeinitializersSPSSig =
|
using GetDeinitializersSPSSig =
|
||||||
SPSExpected<SPSMachOJITDylibDeinitializerSequence>(SPSExecutorAddress);
|
SPSExpected<SPSMachOJITDylibDeinitializerSequence>(SPSExecutorAddr);
|
||||||
WFs[ES.intern("___orc_rt_macho_get_deinitializers_tag")] =
|
WFs[ES.intern("___orc_rt_macho_get_deinitializers_tag")] =
|
||||||
ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
|
ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
|
||||||
this, &MachOPlatform::rt_getDeinitializers);
|
this, &MachOPlatform::rt_getDeinitializers);
|
||||||
|
|
||||||
using LookupSymbolSPSSig =
|
using LookupSymbolSPSSig =
|
||||||
SPSExpected<SPSExecutorAddress>(SPSExecutorAddress, SPSString);
|
SPSExpected<SPSExecutorAddr>(SPSExecutorAddr, SPSString);
|
||||||
WFs[ES.intern("___orc_rt_macho_symbol_lookup_tag")] =
|
WFs[ES.intern("___orc_rt_macho_symbol_lookup_tag")] =
|
||||||
ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
|
ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
|
||||||
&MachOPlatform::rt_lookupSymbol);
|
&MachOPlatform::rt_lookupSymbol);
|
||||||
@@ -412,7 +412,7 @@ void MachOPlatform::rt_getInitializers(SendInitializerSequenceFn SendResult,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MachOPlatform::rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
void MachOPlatform::rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
||||||
ExecutorAddress Handle) {
|
ExecutorAddr Handle) {
|
||||||
LLVM_DEBUG({
|
LLVM_DEBUG({
|
||||||
dbgs() << "MachOPlatform::rt_getDeinitializers(\""
|
dbgs() << "MachOPlatform::rt_getDeinitializers(\""
|
||||||
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
|
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
|
||||||
@@ -442,8 +442,7 @@ void MachOPlatform::rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
||||||
ExecutorAddress Handle,
|
ExecutorAddr Handle, StringRef SymbolName) {
|
||||||
StringRef SymbolName) {
|
|
||||||
LLVM_DEBUG({
|
LLVM_DEBUG({
|
||||||
dbgs() << "MachOPlatform::rt_lookupSymbol(\""
|
dbgs() << "MachOPlatform::rt_lookupSymbol(\""
|
||||||
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
|
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
|
||||||
@@ -477,7 +476,7 @@ void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
|
|||||||
void operator()(Expected<SymbolMap> Result) {
|
void operator()(Expected<SymbolMap> Result) {
|
||||||
if (Result) {
|
if (Result) {
|
||||||
assert(Result->size() == 1 && "Unexpected result map count");
|
assert(Result->size() == 1 && "Unexpected result map count");
|
||||||
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
|
SendResult(ExecutorAddr(Result->begin()->second.getAddress()));
|
||||||
} else {
|
} else {
|
||||||
SendResult(Result.takeError());
|
SendResult(Result.takeError());
|
||||||
}
|
}
|
||||||
@@ -531,7 +530,7 @@ Error MachOPlatform::bootstrapMachORuntime(JITDylib &PlatformJD) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error MachOPlatform::registerInitInfo(
|
Error MachOPlatform::registerInitInfo(
|
||||||
JITDylib &JD, ExecutorAddress ObjCImageInfoAddr,
|
JITDylib &JD, ExecutorAddr ObjCImageInfoAddr,
|
||||||
ArrayRef<jitlink::Section *> InitSections) {
|
ArrayRef<jitlink::Section *> InitSections) {
|
||||||
|
|
||||||
std::unique_lock<std::mutex> Lock(PlatformMutex);
|
std::unique_lock<std::mutex> Lock(PlatformMutex);
|
||||||
@@ -563,7 +562,7 @@ Error MachOPlatform::registerInitInfo(
|
|||||||
// FIXME: Avoid copy here.
|
// FIXME: Avoid copy here.
|
||||||
jitlink::SectionRange R(*Sec);
|
jitlink::SectionRange R(*Sec);
|
||||||
InitSeq->InitSections[Sec->getName()].push_back(
|
InitSeq->InitSections[Sec->getName()].push_back(
|
||||||
{ExecutorAddress(R.getStart()), ExecutorAddress(R.getEnd())});
|
{ExecutorAddr(R.getStart()), ExecutorAddr(R.getEnd())});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Error::success();
|
return Error::success();
|
||||||
@@ -666,9 +665,9 @@ void MachOPlatform::MachOPlatformPlugin::addMachOHeaderSupportPasses(
|
|||||||
JITTargetAddress HeaderAddr = (*I)->getAddress();
|
JITTargetAddress HeaderAddr = (*I)->getAddress();
|
||||||
MP.HeaderAddrToJITDylib[HeaderAddr] = &JD;
|
MP.HeaderAddrToJITDylib[HeaderAddr] = &JD;
|
||||||
assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
|
assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
|
||||||
MP.InitSeqs.insert(
|
MP.InitSeqs.insert(std::make_pair(
|
||||||
std::make_pair(&JD, MachOJITDylibInitializers(
|
&JD,
|
||||||
JD.getName(), ExecutorAddress(HeaderAddr))));
|
MachOJITDylibInitializers(JD.getName(), ExecutorAddr(HeaderAddr))));
|
||||||
}
|
}
|
||||||
return Error::success();
|
return Error::success();
|
||||||
});
|
});
|
||||||
@@ -693,8 +692,8 @@ void MachOPlatform::MachOPlatformPlugin::addEHAndTLVSupportPasses(
|
|||||||
if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
|
if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
|
||||||
jitlink::SectionRange R(*EHFrameSection);
|
jitlink::SectionRange R(*EHFrameSection);
|
||||||
if (!R.empty())
|
if (!R.empty())
|
||||||
POSR.EHFrameSection = {ExecutorAddress(R.getStart()),
|
POSR.EHFrameSection = {ExecutorAddr(R.getStart()),
|
||||||
ExecutorAddress(R.getEnd())};
|
ExecutorAddr(R.getEnd())};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a pointer to the thread data section if there is one. It will be used
|
// Get a pointer to the thread data section if there is one. It will be used
|
||||||
@@ -718,12 +717,11 @@ void MachOPlatform::MachOPlatformPlugin::addEHAndTLVSupportPasses(
|
|||||||
if (ThreadDataSection) {
|
if (ThreadDataSection) {
|
||||||
jitlink::SectionRange R(*ThreadDataSection);
|
jitlink::SectionRange R(*ThreadDataSection);
|
||||||
if (!R.empty())
|
if (!R.empty())
|
||||||
POSR.ThreadDataSection = {ExecutorAddress(R.getStart()),
|
POSR.ThreadDataSection = {ExecutorAddr(R.getStart()),
|
||||||
ExecutorAddress(R.getEnd())};
|
ExecutorAddr(R.getEnd())};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (POSR.EHFrameSection.StartAddress ||
|
if (POSR.EHFrameSection.Start || POSR.ThreadDataSection.Start) {
|
||||||
POSR.ThreadDataSection.StartAddress) {
|
|
||||||
|
|
||||||
// If we're still bootstrapping the runtime then just record this
|
// If we're still bootstrapping the runtime then just record this
|
||||||
// frame for now.
|
// frame for now.
|
||||||
@@ -860,7 +858,7 @@ Error MachOPlatform::MachOPlatformPlugin::processObjCImageInfo(
|
|||||||
Error MachOPlatform::MachOPlatformPlugin::registerInitSections(
|
Error MachOPlatform::MachOPlatformPlugin::registerInitSections(
|
||||||
jitlink::LinkGraph &G, JITDylib &JD) {
|
jitlink::LinkGraph &G, JITDylib &JD) {
|
||||||
|
|
||||||
ExecutorAddress ObjCImageInfoAddr;
|
ExecutorAddr ObjCImageInfoAddr;
|
||||||
SmallVector<jitlink::Section *> InitSections;
|
SmallVector<jitlink::Section *> InitSections;
|
||||||
|
|
||||||
if (auto *ObjCImageInfoSec = G.findSectionByName(ObjCImageInfoSectionName)) {
|
if (auto *ObjCImageInfoSec = G.findSectionByName(ObjCImageInfoSectionName)) {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ FDSimpleRemoteEPCTransport::~FDSimpleRemoteEPCTransport() {
|
|||||||
|
|
||||||
Error FDSimpleRemoteEPCTransport::sendMessage(SimpleRemoteEPCOpcode OpC,
|
Error FDSimpleRemoteEPCTransport::sendMessage(SimpleRemoteEPCOpcode OpC,
|
||||||
uint64_t SeqNo,
|
uint64_t SeqNo,
|
||||||
ExecutorAddress TagAddr,
|
ExecutorAddr TagAddr,
|
||||||
ArrayRef<char> ArgBytes) {
|
ArrayRef<char> ArgBytes) {
|
||||||
char HeaderBuffer[FDMsgHeader::Size];
|
char HeaderBuffer[FDMsgHeader::Size];
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ void FDSimpleRemoteEPCTransport::listenLoop() {
|
|||||||
uint64_t MsgSize;
|
uint64_t MsgSize;
|
||||||
SimpleRemoteEPCOpcode OpC;
|
SimpleRemoteEPCOpcode OpC;
|
||||||
uint64_t SeqNo;
|
uint64_t SeqNo;
|
||||||
ExecutorAddress TagAddr;
|
ExecutorAddr TagAddr;
|
||||||
|
|
||||||
MsgSize =
|
MsgSize =
|
||||||
*((support::ulittle64_t *)(HeaderBuffer + FDMsgHeader::MsgSizeOffset));
|
*((support::ulittle64_t *)(HeaderBuffer + FDMsgHeader::MsgSizeOffset));
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Expected<int32_t> SimpleRemoteEPC::runAsMain(JITTargetAddress MainFnAddr,
|
|||||||
ArrayRef<std::string> Args) {
|
ArrayRef<std::string> Args) {
|
||||||
int64_t Result = 0;
|
int64_t Result = 0;
|
||||||
if (auto Err = callSPSWrapper<rt::SPSRunAsMainSignature>(
|
if (auto Err = callSPSWrapper<rt::SPSRunAsMainSignature>(
|
||||||
RunAsMainAddr.getValue(), Result, ExecutorAddress(MainFnAddr), Args))
|
RunAsMainAddr.getValue(), Result, ExecutorAddr(MainFnAddr), Args))
|
||||||
return std::move(Err);
|
return std::move(Err);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ void SimpleRemoteEPC::callWrapperAsync(SendResultFunction OnComplete,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auto Err = T->sendMessage(SimpleRemoteEPCOpcode::CallWrapper, SeqNo,
|
if (auto Err = T->sendMessage(SimpleRemoteEPCOpcode::CallWrapper, SeqNo,
|
||||||
ExecutorAddress(WrapperFnAddr), ArgBuffer)) {
|
ExecutorAddr(WrapperFnAddr), ArgBuffer)) {
|
||||||
getExecutionSession().reportError(std::move(Err));
|
getExecutionSession().reportError(std::move(Err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ Error SimpleRemoteEPC::disconnect() {
|
|||||||
|
|
||||||
Expected<SimpleRemoteEPCTransportClient::HandleMessageAction>
|
Expected<SimpleRemoteEPCTransportClient::HandleMessageAction>
|
||||||
SimpleRemoteEPC::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
SimpleRemoteEPC::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
||||||
ExecutorAddress TagAddr,
|
ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
|
using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
|
||||||
if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
|
if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
|
||||||
@@ -143,7 +143,7 @@ SimpleRemoteEPC::createMemoryAccess() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleRemoteEPC::handleSetup(uint64_t SeqNo, ExecutorAddress TagAddr,
|
Error SimpleRemoteEPC::handleSetup(uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
if (SeqNo != 0)
|
if (SeqNo != 0)
|
||||||
return make_error<StringError>("Setup packet SeqNo not zero",
|
return make_error<StringError>("Setup packet SeqNo not zero",
|
||||||
@@ -206,8 +206,8 @@ Error SimpleRemoteEPC::setup(std::unique_ptr<SimpleRemoteEPCTransport> T,
|
|||||||
BootstrapSymbols = std::move(EI.BootstrapSymbols);
|
BootstrapSymbols = std::move(EI.BootstrapSymbols);
|
||||||
|
|
||||||
if (auto Err = getBootstrapSymbols(
|
if (auto Err = getBootstrapSymbols(
|
||||||
{{JDI.JITDispatchContextAddress, ExecutorSessionObjectName},
|
{{JDI.JITDispatchContext, ExecutorSessionObjectName},
|
||||||
{JDI.JITDispatchFunctionAddress, DispatchFnName},
|
{JDI.JITDispatchFunction, DispatchFnName},
|
||||||
{RunAsMainAddr, rt::RunAsMainWrapperName}}))
|
{RunAsMainAddr, rt::RunAsMainWrapperName}}))
|
||||||
return Err;
|
return Err;
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ Error SimpleRemoteEPC::setup(std::unique_ptr<SimpleRemoteEPCTransport> T,
|
|||||||
return Error::success();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
|
Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
SendResultFunction SendResult;
|
SendResultFunction SendResult;
|
||||||
|
|
||||||
@@ -259,14 +259,14 @@ Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRemoteEPC::handleCallWrapper(
|
void SimpleRemoteEPC::handleCallWrapper(
|
||||||
uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
|
uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
assert(ES && "No ExecutionSession attached");
|
assert(ES && "No ExecutionSession attached");
|
||||||
ES->runJITDispatchHandler(
|
ES->runJITDispatchHandler(
|
||||||
[this, RemoteSeqNo](shared::WrapperFunctionResult WFR) {
|
[this, RemoteSeqNo](shared::WrapperFunctionResult WFR) {
|
||||||
if (auto Err =
|
if (auto Err =
|
||||||
T->sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
|
T->sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
|
||||||
ExecutorAddress(), {WFR.data(), WFR.size()}))
|
ExecutorAddr(), {WFR.data(), WFR.size()}))
|
||||||
getExecutionSession().reportError(std::move(Err));
|
getExecutionSession().reportError(std::move(Err));
|
||||||
},
|
},
|
||||||
TagAddr.getValue(), ArgBytes);
|
TagAddr.getValue(), ArgBytes);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ static void registerJITLoaderGDBImpl(JITTargetAddress Addr, uint64_t Size) {
|
|||||||
extern "C" orc::shared::detail::CWrapperFunctionResult
|
extern "C" orc::shared::detail::CWrapperFunctionResult
|
||||||
llvm_orc_registerJITLoaderGDBWrapper(const char *Data, uint64_t Size) {
|
llvm_orc_registerJITLoaderGDBWrapper(const char *Data, uint64_t Size) {
|
||||||
using namespace orc::shared;
|
using namespace orc::shared;
|
||||||
return WrapperFunction<void(SPSExecutorAddress, uint64_t)>::handle(
|
return WrapperFunction<void(SPSExecutorAddr, uint64_t)>::handle(
|
||||||
Data, Size, registerJITLoaderGDBImpl)
|
Data, Size, registerJITLoaderGDBImpl)
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,29 +49,29 @@ static llvm::orc::shared::detail::CWrapperFunctionResult
|
|||||||
runAsMainWrapper(const char *ArgData, size_t ArgSize) {
|
runAsMainWrapper(const char *ArgData, size_t ArgSize) {
|
||||||
return WrapperFunction<rt::SPSRunAsMainSignature>::handle(
|
return WrapperFunction<rt::SPSRunAsMainSignature>::handle(
|
||||||
ArgData, ArgSize,
|
ArgData, ArgSize,
|
||||||
[](ExecutorAddress MainAddr,
|
[](ExecutorAddr MainAddr,
|
||||||
std::vector<std::string> Args) -> int64_t {
|
std::vector<std::string> Args) -> int64_t {
|
||||||
return runAsMain(MainAddr.toPtr<int (*)(int, char *[])>(), Args);
|
return runAsMain(MainAddr.toPtr<int (*)(int, char *[])>(), Args);
|
||||||
})
|
})
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addTo(StringMap<ExecutorAddress> &M) {
|
void addTo(StringMap<ExecutorAddr> &M) {
|
||||||
M[rt::MemoryWriteUInt8sWrapperName] = ExecutorAddress::fromPtr(
|
M[rt::MemoryWriteUInt8sWrapperName] = ExecutorAddr::fromPtr(
|
||||||
&writeUIntsWrapper<tpctypes::UInt8Write,
|
&writeUIntsWrapper<tpctypes::UInt8Write,
|
||||||
shared::SPSMemoryAccessUInt8Write>);
|
shared::SPSMemoryAccessUInt8Write>);
|
||||||
M[rt::MemoryWriteUInt16sWrapperName] = ExecutorAddress::fromPtr(
|
M[rt::MemoryWriteUInt16sWrapperName] = ExecutorAddr::fromPtr(
|
||||||
&writeUIntsWrapper<tpctypes::UInt16Write,
|
&writeUIntsWrapper<tpctypes::UInt16Write,
|
||||||
shared::SPSMemoryAccessUInt16Write>);
|
shared::SPSMemoryAccessUInt16Write>);
|
||||||
M[rt::MemoryWriteUInt32sWrapperName] = ExecutorAddress::fromPtr(
|
M[rt::MemoryWriteUInt32sWrapperName] = ExecutorAddr::fromPtr(
|
||||||
&writeUIntsWrapper<tpctypes::UInt32Write,
|
&writeUIntsWrapper<tpctypes::UInt32Write,
|
||||||
shared::SPSMemoryAccessUInt32Write>);
|
shared::SPSMemoryAccessUInt32Write>);
|
||||||
M[rt::MemoryWriteUInt64sWrapperName] = ExecutorAddress::fromPtr(
|
M[rt::MemoryWriteUInt64sWrapperName] = ExecutorAddr::fromPtr(
|
||||||
&writeUIntsWrapper<tpctypes::UInt64Write,
|
&writeUIntsWrapper<tpctypes::UInt64Write,
|
||||||
shared::SPSMemoryAccessUInt64Write>);
|
shared::SPSMemoryAccessUInt64Write>);
|
||||||
M[rt::MemoryWriteBuffersWrapperName] =
|
M[rt::MemoryWriteBuffersWrapperName] =
|
||||||
ExecutorAddress::fromPtr(&writeBuffersWrapper);
|
ExecutorAddr::fromPtr(&writeBuffersWrapper);
|
||||||
M[rt::RunAsMainWrapperName] = ExecutorAddress::fromPtr(&runAsMainWrapper);
|
M[rt::RunAsMainWrapperName] = ExecutorAddr::fromPtr(&runAsMainWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace rt_bootstrap
|
} // end namespace rt_bootstrap
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace llvm {
|
|||||||
namespace orc {
|
namespace orc {
|
||||||
namespace rt_bootstrap {
|
namespace rt_bootstrap {
|
||||||
|
|
||||||
void addTo(StringMap<ExecutorAddress> &M);
|
void addTo(StringMap<ExecutorAddr> &M);
|
||||||
|
|
||||||
} // namespace rt_bootstrap
|
} // namespace rt_bootstrap
|
||||||
} // end namespace orc
|
} // end namespace orc
|
||||||
|
|||||||
@@ -170,14 +170,14 @@ static Error deregisterEHFrameWrapper(JITTargetAddress Addr, uint64_t Size) {
|
|||||||
|
|
||||||
extern "C" orc::shared::detail::CWrapperFunctionResult
|
extern "C" orc::shared::detail::CWrapperFunctionResult
|
||||||
llvm_orc_registerEHFrameSectionWrapper(const char *Data, uint64_t Size) {
|
llvm_orc_registerEHFrameSectionWrapper(const char *Data, uint64_t Size) {
|
||||||
return WrapperFunction<SPSError(SPSExecutorAddress, uint64_t)>::handle(
|
return WrapperFunction<SPSError(SPSExecutorAddr, uint64_t)>::handle(
|
||||||
Data, Size, registerEHFrameWrapper)
|
Data, Size, registerEHFrameWrapper)
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" orc::shared::detail::CWrapperFunctionResult
|
extern "C" orc::shared::detail::CWrapperFunctionResult
|
||||||
llvm_orc_deregisterEHFrameSectionWrapper(const char *Data, uint64_t Size) {
|
llvm_orc_deregisterEHFrameSectionWrapper(const char *Data, uint64_t Size) {
|
||||||
return WrapperFunction<SPSError(SPSExecutorAddress, uint64_t)>::handle(
|
return WrapperFunction<SPSError(SPSExecutorAddr, uint64_t)>::handle(
|
||||||
Data, Size, deregisterEHFrameWrapper)
|
Data, Size, deregisterEHFrameWrapper)
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ SimpleExecutorDylibManager::open(const std::string &Path, uint64_t Mode) {
|
|||||||
return NextId++;
|
return NextId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected<std::vector<ExecutorAddress>>
|
Expected<std::vector<ExecutorAddr>>
|
||||||
SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
|
SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
|
||||||
const RemoteSymbolLookupSet &L) {
|
const RemoteSymbolLookupSet &L) {
|
||||||
std::vector<ExecutorAddress> Result;
|
std::vector<ExecutorAddr> Result;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> Lock(M);
|
std::lock_guard<std::mutex> Lock(M);
|
||||||
auto I = Dylibs.find(H);
|
auto I = Dylibs.find(H);
|
||||||
@@ -58,7 +58,7 @@ SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
|
|||||||
return make_error<StringError>("Required address for empty symbol \"\"",
|
return make_error<StringError>("Required address for empty symbol \"\"",
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
else
|
else
|
||||||
Result.push_back(ExecutorAddress());
|
Result.push_back(ExecutorAddr());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const char *DemangledSymName = E.Name.c_str();
|
const char *DemangledSymName = E.Name.c_str();
|
||||||
@@ -76,7 +76,7 @@ SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
|
|||||||
DemangledSymName,
|
DemangledSymName,
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
|
|
||||||
Result.push_back(ExecutorAddress::fromPtr(Addr));
|
Result.push_back(ExecutorAddr::fromPtr(Addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,13 +96,12 @@ Error SimpleExecutorDylibManager::shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SimpleExecutorDylibManager::addBootstrapSymbols(
|
void SimpleExecutorDylibManager::addBootstrapSymbols(
|
||||||
StringMap<ExecutorAddress> &M) {
|
StringMap<ExecutorAddr> &M) {
|
||||||
M[rt::SimpleExecutorDylibManagerInstanceName] =
|
M[rt::SimpleExecutorDylibManagerInstanceName] = ExecutorAddr::fromPtr(this);
|
||||||
ExecutorAddress::fromPtr(this);
|
|
||||||
M[rt::SimpleExecutorDylibManagerOpenWrapperName] =
|
M[rt::SimpleExecutorDylibManagerOpenWrapperName] =
|
||||||
ExecutorAddress::fromPtr(&openWrapper);
|
ExecutorAddr::fromPtr(&openWrapper);
|
||||||
M[rt::SimpleExecutorDylibManagerLookupWrapperName] =
|
M[rt::SimpleExecutorDylibManagerLookupWrapperName] =
|
||||||
ExecutorAddress::fromPtr(&lookupWrapper);
|
ExecutorAddr::fromPtr(&lookupWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::orc::shared::detail::CWrapperFunctionResult
|
llvm::orc::shared::detail::CWrapperFunctionResult
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ SimpleExecutorMemoryManager::~SimpleExecutorMemoryManager() {
|
|||||||
assert(Allocations.empty() && "shutdown not called?");
|
assert(Allocations.empty() && "shutdown not called?");
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected<ExecutorAddress> SimpleExecutorMemoryManager::allocate(uint64_t Size) {
|
Expected<ExecutorAddr> SimpleExecutorMemoryManager::allocate(uint64_t Size) {
|
||||||
std::error_code EC;
|
std::error_code EC;
|
||||||
auto MB = sys::Memory::allocateMappedMemory(
|
auto MB = sys::Memory::allocateMappedMemory(
|
||||||
Size, 0, sys::Memory::MF_READ | sys::Memory::MF_WRITE, EC);
|
Size, 0, sys::Memory::MF_READ | sys::Memory::MF_WRITE, EC);
|
||||||
@@ -30,11 +30,11 @@ Expected<ExecutorAddress> SimpleExecutorMemoryManager::allocate(uint64_t Size) {
|
|||||||
std::lock_guard<std::mutex> Lock(M);
|
std::lock_guard<std::mutex> Lock(M);
|
||||||
assert(!Allocations.count(MB.base()) && "Duplicate allocation addr");
|
assert(!Allocations.count(MB.base()) && "Duplicate allocation addr");
|
||||||
Allocations[MB.base()].Size = Size;
|
Allocations[MB.base()].Size = Size;
|
||||||
return ExecutorAddress::fromPtr(MB.base());
|
return ExecutorAddr::fromPtr(MB.base());
|
||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
|
Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
|
||||||
ExecutorAddress Base(~0ULL);
|
ExecutorAddr Base(~0ULL);
|
||||||
std::vector<tpctypes::SupportFunctionCall> DeallocationActions;
|
std::vector<tpctypes::SupportFunctionCall> DeallocationActions;
|
||||||
size_t SuccessfulFinalizationActions = 0;
|
size_t SuccessfulFinalizationActions = 0;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
|
|||||||
AllocSize = I->second.Size;
|
AllocSize = I->second.Size;
|
||||||
I->second.DeallocationActions = std::move(DeallocationActions);
|
I->second.DeallocationActions = std::move(DeallocationActions);
|
||||||
}
|
}
|
||||||
ExecutorAddress AllocEnd = Base + ExecutorAddrDiff(AllocSize);
|
ExecutorAddr AllocEnd = Base + ExecutorAddrDiff(AllocSize);
|
||||||
|
|
||||||
// Bail-out function: this will run deallocation actions corresponding to any
|
// Bail-out function: this will run deallocation actions corresponding to any
|
||||||
// completed finalization actions, then deallocate memory.
|
// completed finalization actions, then deallocate memory.
|
||||||
@@ -106,7 +106,7 @@ Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
|
|||||||
"exceeds segment size ({2:x} bytes)",
|
"exceeds segment size ({2:x} bytes)",
|
||||||
Seg.Addr.getValue(), Seg.Content.size(), Seg.Size),
|
Seg.Addr.getValue(), Seg.Content.size(), Seg.Size),
|
||||||
inconvertibleErrorCode()));
|
inconvertibleErrorCode()));
|
||||||
ExecutorAddress SegEnd = Seg.Addr + ExecutorAddrDiff(Seg.Size);
|
ExecutorAddr SegEnd = Seg.Addr + ExecutorAddrDiff(Seg.Size);
|
||||||
if (LLVM_UNLIKELY(Seg.Addr < Base || SegEnd > AllocEnd))
|
if (LLVM_UNLIKELY(Seg.Addr < Base || SegEnd > AllocEnd))
|
||||||
return BailOut(make_error<StringError>(
|
return BailOut(make_error<StringError>(
|
||||||
formatv("Segment {0:x} -- {1:x} crosses boundary of "
|
formatv("Segment {0:x} -- {1:x} crosses boundary of "
|
||||||
@@ -138,7 +138,7 @@ Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleExecutorMemoryManager::deallocate(
|
Error SimpleExecutorMemoryManager::deallocate(
|
||||||
const std::vector<ExecutorAddress> &Bases) {
|
const std::vector<ExecutorAddr> &Bases) {
|
||||||
std::vector<std::pair<void *, Allocation>> AllocPairs;
|
std::vector<std::pair<void *, Allocation>> AllocPairs;
|
||||||
AllocPairs.reserve(Bases.size());
|
AllocPairs.reserve(Bases.size());
|
||||||
|
|
||||||
@@ -187,15 +187,14 @@ Error SimpleExecutorMemoryManager::shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SimpleExecutorMemoryManager::addBootstrapSymbols(
|
void SimpleExecutorMemoryManager::addBootstrapSymbols(
|
||||||
StringMap<ExecutorAddress> &M) {
|
StringMap<ExecutorAddr> &M) {
|
||||||
M[rt::SimpleExecutorMemoryManagerInstanceName] =
|
M[rt::SimpleExecutorMemoryManagerInstanceName] = ExecutorAddr::fromPtr(this);
|
||||||
ExecutorAddress::fromPtr(this);
|
|
||||||
M[rt::SimpleExecutorMemoryManagerReserveWrapperName] =
|
M[rt::SimpleExecutorMemoryManagerReserveWrapperName] =
|
||||||
ExecutorAddress::fromPtr(&reserveWrapper);
|
ExecutorAddr::fromPtr(&reserveWrapper);
|
||||||
M[rt::SimpleExecutorMemoryManagerFinalizeWrapperName] =
|
M[rt::SimpleExecutorMemoryManagerFinalizeWrapperName] =
|
||||||
ExecutorAddress::fromPtr(&finalizeWrapper);
|
ExecutorAddr::fromPtr(&finalizeWrapper);
|
||||||
M[rt::SimpleExecutorMemoryManagerDeallocateWrapperName] =
|
M[rt::SimpleExecutorMemoryManagerDeallocateWrapperName] =
|
||||||
ExecutorAddress::fromPtr(&deallocateWrapper);
|
ExecutorAddr::fromPtr(&deallocateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleExecutorMemoryManager::deallocateImpl(void *Base, Allocation &A) {
|
Error SimpleExecutorMemoryManager::deallocateImpl(void *Base, Allocation &A) {
|
||||||
|
|||||||
@@ -51,15 +51,15 @@ void SimpleRemoteEPCServer::ThreadDispatcher::shutdown() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StringMap<ExecutorAddress> SimpleRemoteEPCServer::defaultBootstrapSymbols() {
|
StringMap<ExecutorAddr> SimpleRemoteEPCServer::defaultBootstrapSymbols() {
|
||||||
StringMap<ExecutorAddress> DBS;
|
StringMap<ExecutorAddr> DBS;
|
||||||
rt_bootstrap::addTo(DBS);
|
rt_bootstrap::addTo(DBS);
|
||||||
return DBS;
|
return DBS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected<SimpleRemoteEPCTransportClient::HandleMessageAction>
|
Expected<SimpleRemoteEPCTransportClient::HandleMessageAction>
|
||||||
SimpleRemoteEPCServer::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
SimpleRemoteEPCServer::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
|
||||||
ExecutorAddress TagAddr,
|
ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
|
using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
|
||||||
if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
|
if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
|
||||||
@@ -124,7 +124,7 @@ void SimpleRemoteEPCServer::handleDisconnect(Error Err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleRemoteEPCServer::sendSetupMessage(
|
Error SimpleRemoteEPCServer::sendSetupMessage(
|
||||||
StringMap<ExecutorAddress> BootstrapSymbols) {
|
StringMap<ExecutorAddr> BootstrapSymbols) {
|
||||||
|
|
||||||
using namespace SimpleRemoteEPCDefaultBootstrapSymbolNames;
|
using namespace SimpleRemoteEPCDefaultBootstrapSymbolNames;
|
||||||
|
|
||||||
@@ -141,10 +141,8 @@ Error SimpleRemoteEPCServer::sendSetupMessage(
|
|||||||
"Dispatch context name should not be set");
|
"Dispatch context name should not be set");
|
||||||
assert(!EI.BootstrapSymbols.count(DispatchFnName) &&
|
assert(!EI.BootstrapSymbols.count(DispatchFnName) &&
|
||||||
"Dispatch function name should not be set");
|
"Dispatch function name should not be set");
|
||||||
EI.BootstrapSymbols[ExecutorSessionObjectName] =
|
EI.BootstrapSymbols[ExecutorSessionObjectName] = ExecutorAddr::fromPtr(this);
|
||||||
ExecutorAddress::fromPtr(this);
|
EI.BootstrapSymbols[DispatchFnName] = ExecutorAddr::fromPtr(jitDispatchEntry);
|
||||||
EI.BootstrapSymbols[DispatchFnName] =
|
|
||||||
ExecutorAddress::fromPtr(jitDispatchEntry);
|
|
||||||
|
|
||||||
using SPSSerialize =
|
using SPSSerialize =
|
||||||
shared::SPSArgList<shared::SPSSimpleRemoteEPCExecutorInfo>;
|
shared::SPSArgList<shared::SPSSimpleRemoteEPCExecutorInfo>;
|
||||||
@@ -155,12 +153,12 @@ Error SimpleRemoteEPCServer::sendSetupMessage(
|
|||||||
return make_error<StringError>("Could not send setup packet",
|
return make_error<StringError>("Could not send setup packet",
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
|
|
||||||
return T->sendMessage(SimpleRemoteEPCOpcode::Setup, 0, ExecutorAddress(),
|
return T->sendMessage(SimpleRemoteEPCOpcode::Setup, 0, ExecutorAddr(),
|
||||||
{SetupPacketBytes.data(), SetupPacketBytes.size()});
|
{SetupPacketBytes.data(), SetupPacketBytes.size()});
|
||||||
}
|
}
|
||||||
|
|
||||||
Error SimpleRemoteEPCServer::handleResult(
|
Error SimpleRemoteEPCServer::handleResult(
|
||||||
uint64_t SeqNo, ExecutorAddress TagAddr,
|
uint64_t SeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
std::promise<shared::WrapperFunctionResult> *P = nullptr;
|
std::promise<shared::WrapperFunctionResult> *P = nullptr;
|
||||||
{
|
{
|
||||||
@@ -181,7 +179,7 @@ Error SimpleRemoteEPCServer::handleResult(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SimpleRemoteEPCServer::handleCallWrapper(
|
void SimpleRemoteEPCServer::handleCallWrapper(
|
||||||
uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
|
uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
|
||||||
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
SimpleRemoteEPCArgBytesVector ArgBytes) {
|
||||||
D->dispatch([this, RemoteSeqNo, TagAddr, ArgBytes = std::move(ArgBytes)]() {
|
D->dispatch([this, RemoteSeqNo, TagAddr, ArgBytes = std::move(ArgBytes)]() {
|
||||||
using WrapperFnTy =
|
using WrapperFnTy =
|
||||||
@@ -190,7 +188,7 @@ void SimpleRemoteEPCServer::handleCallWrapper(
|
|||||||
shared::WrapperFunctionResult ResultBytes(
|
shared::WrapperFunctionResult ResultBytes(
|
||||||
Fn(ArgBytes.data(), ArgBytes.size()));
|
Fn(ArgBytes.data(), ArgBytes.size()));
|
||||||
if (auto Err = T->sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
|
if (auto Err = T->sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
|
||||||
ExecutorAddress(),
|
ExecutorAddr(),
|
||||||
{ResultBytes.data(), ResultBytes.size()}))
|
{ResultBytes.data(), ResultBytes.size()}))
|
||||||
ReportError(std::move(Err));
|
ReportError(std::move(Err));
|
||||||
});
|
});
|
||||||
@@ -215,7 +213,7 @@ SimpleRemoteEPCServer::doJITDispatch(const void *FnTag, const char *ArgData,
|
|||||||
|
|
||||||
if (auto Err =
|
if (auto Err =
|
||||||
T->sendMessage(SimpleRemoteEPCOpcode::CallWrapper, SeqNo,
|
T->sendMessage(SimpleRemoteEPCOpcode::CallWrapper, SeqNo,
|
||||||
ExecutorAddress::fromPtr(FnTag), {ArgData, ArgSize}))
|
ExecutorAddr::fromPtr(FnTag), {ArgData, ArgSize}))
|
||||||
ReportError(std::move(Err));
|
ReportError(std::move(Err));
|
||||||
|
|
||||||
return ResultF.get();
|
return ResultF.get();
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ namespace {
|
|||||||
|
|
||||||
class SimpleAllocator {
|
class SimpleAllocator {
|
||||||
public:
|
public:
|
||||||
Expected<ExecutorAddress> reserve(uint64_t Size) {
|
Expected<ExecutorAddr> reserve(uint64_t Size) {
|
||||||
std::error_code EC;
|
std::error_code EC;
|
||||||
auto MB = sys::Memory::allocateMappedMemory(
|
auto MB = sys::Memory::allocateMappedMemory(
|
||||||
Size, 0, sys::Memory::MF_READ | sys::Memory::MF_WRITE, EC);
|
Size, 0, sys::Memory::MF_READ | sys::Memory::MF_WRITE, EC);
|
||||||
if (EC)
|
if (EC)
|
||||||
return errorCodeToError(EC);
|
return errorCodeToError(EC);
|
||||||
Blocks[MB.base()] = sys::OwningMemoryBlock(std::move(MB));
|
Blocks[MB.base()] = sys::OwningMemoryBlock(std::move(MB));
|
||||||
return ExecutorAddress::fromPtr(MB.base());
|
return ExecutorAddr::fromPtr(MB.base());
|
||||||
}
|
}
|
||||||
|
|
||||||
Error finalize(tpctypes::FinalizeRequest FR) {
|
Error finalize(tpctypes::FinalizeRequest FR) {
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
return Error::success();
|
return Error::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
Error deallocate(std::vector<ExecutorAddress> &Bases) {
|
Error deallocate(std::vector<ExecutorAddr> &Bases) {
|
||||||
Error Err = Error::success();
|
Error Err = Error::success();
|
||||||
for (auto &Base : Bases) {
|
for (auto &Base : Bases) {
|
||||||
auto I = Blocks.find(Base.toPtr<void *>());
|
auto I = Blocks.find(Base.toPtr<void *>());
|
||||||
@@ -109,10 +109,10 @@ TEST(EPCGenericJITLinkMemoryManagerTest, AllocFinalizeFree) {
|
|||||||
SimpleAllocator SA;
|
SimpleAllocator SA;
|
||||||
|
|
||||||
EPCGenericJITLinkMemoryManager::SymbolAddrs SAs;
|
EPCGenericJITLinkMemoryManager::SymbolAddrs SAs;
|
||||||
SAs.Allocator = ExecutorAddress::fromPtr(&SA);
|
SAs.Allocator = ExecutorAddr::fromPtr(&SA);
|
||||||
SAs.Reserve = ExecutorAddress::fromPtr(&testReserve);
|
SAs.Reserve = ExecutorAddr::fromPtr(&testReserve);
|
||||||
SAs.Finalize = ExecutorAddress::fromPtr(&testFinalize);
|
SAs.Finalize = ExecutorAddr::fromPtr(&testFinalize);
|
||||||
SAs.Deallocate = ExecutorAddress::fromPtr(&testDeallocate);
|
SAs.Deallocate = ExecutorAddr::fromPtr(&testDeallocate);
|
||||||
|
|
||||||
auto MemMgr = std::make_unique<EPCGenericJITLinkMemoryManager>(*SelfEPC, SAs);
|
auto MemMgr = std::make_unique<EPCGenericJITLinkMemoryManager>(*SelfEPC, SAs);
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ TEST(EPCGenericJITLinkMemoryManagerTest, AllocFinalizeFree) {
|
|||||||
auto Err = (*Alloc)->finalize();
|
auto Err = (*Alloc)->finalize();
|
||||||
EXPECT_THAT_ERROR(std::move(Err), Succeeded());
|
EXPECT_THAT_ERROR(std::move(Err), Succeeded());
|
||||||
|
|
||||||
ExecutorAddress TargetAddr((*Alloc)->getTargetMemory(sys::Memory::MF_READ));
|
ExecutorAddr TargetAddr((*Alloc)->getTargetMemory(sys::Memory::MF_READ));
|
||||||
|
|
||||||
const char *TargetMem = TargetAddr.toPtr<const char *>();
|
const char *TargetMem = TargetAddr.toPtr<const char *>();
|
||||||
EXPECT_NE(TargetMem, WorkingMem.data());
|
EXPECT_NE(TargetMem, WorkingMem.data());
|
||||||
|
|||||||
@@ -46,15 +46,15 @@ TEST(EPCGenericMemoryAccessTest, MemWrites) {
|
|||||||
auto SelfEPC = cantFail(SelfExecutorProcessControl::Create());
|
auto SelfEPC = cantFail(SelfExecutorProcessControl::Create());
|
||||||
|
|
||||||
EPCGenericMemoryAccess::FuncAddrs FAs;
|
EPCGenericMemoryAccess::FuncAddrs FAs;
|
||||||
FAs.WriteUInt8s = ExecutorAddress::fromPtr(
|
FAs.WriteUInt8s = ExecutorAddr::fromPtr(
|
||||||
&testWriteUInts<tpctypes::UInt8Write, SPSMemoryAccessUInt8Write>);
|
&testWriteUInts<tpctypes::UInt8Write, SPSMemoryAccessUInt8Write>);
|
||||||
FAs.WriteUInt16s = ExecutorAddress::fromPtr(
|
FAs.WriteUInt16s = ExecutorAddr::fromPtr(
|
||||||
&testWriteUInts<tpctypes::UInt16Write, SPSMemoryAccessUInt16Write>);
|
&testWriteUInts<tpctypes::UInt16Write, SPSMemoryAccessUInt16Write>);
|
||||||
FAs.WriteUInt32s = ExecutorAddress::fromPtr(
|
FAs.WriteUInt32s = ExecutorAddr::fromPtr(
|
||||||
&testWriteUInts<tpctypes::UInt32Write, SPSMemoryAccessUInt32Write>);
|
&testWriteUInts<tpctypes::UInt32Write, SPSMemoryAccessUInt32Write>);
|
||||||
FAs.WriteUInt64s = ExecutorAddress::fromPtr(
|
FAs.WriteUInt64s = ExecutorAddr::fromPtr(
|
||||||
&testWriteUInts<tpctypes::UInt64Write, SPSMemoryAccessUInt64Write>);
|
&testWriteUInts<tpctypes::UInt64Write, SPSMemoryAccessUInt64Write>);
|
||||||
FAs.WriteBuffers = ExecutorAddress::fromPtr(&testWriteBuffers);
|
FAs.WriteBuffers = ExecutorAddr::fromPtr(&testWriteBuffers);
|
||||||
|
|
||||||
auto MemAccess = std::make_unique<EPCGenericMemoryAccess>(*SelfEPC, FAs);
|
auto MemAccess = std::make_unique<EPCGenericMemoryAccess>(*SelfEPC, FAs);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace {
|
|||||||
TEST_F(LookupAndRecordAddrsTest, AsyncRequiredSuccess) {
|
TEST_F(LookupAndRecordAddrsTest, AsyncRequiredSuccess) {
|
||||||
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarSym}})));
|
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarSym}})));
|
||||||
|
|
||||||
ExecutorAddress FooAddress, BarAddress;
|
ExecutorAddr FooAddress, BarAddress;
|
||||||
std::promise<MSVCPError> ErrP;
|
std::promise<MSVCPError> ErrP;
|
||||||
|
|
||||||
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
|
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
|
||||||
@@ -39,7 +39,7 @@ TEST_F(LookupAndRecordAddrsTest, AsyncRequiredSuccess) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LookupAndRecordAddrsTest, AsyncRequiredFailure) {
|
TEST_F(LookupAndRecordAddrsTest, AsyncRequiredFailure) {
|
||||||
ExecutorAddress FooAddress, BarAddress;
|
ExecutorAddr FooAddress, BarAddress;
|
||||||
std::promise<MSVCPError> ErrP;
|
std::promise<MSVCPError> ErrP;
|
||||||
|
|
||||||
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
|
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
|
||||||
@@ -54,7 +54,7 @@ TEST_F(LookupAndRecordAddrsTest, AsyncRequiredFailure) {
|
|||||||
TEST_F(LookupAndRecordAddrsTest, AsyncWeakReference) {
|
TEST_F(LookupAndRecordAddrsTest, AsyncWeakReference) {
|
||||||
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
|
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
|
||||||
|
|
||||||
ExecutorAddress FooAddress, BarAddress;
|
ExecutorAddr FooAddress, BarAddress;
|
||||||
std::promise<MSVCPError> ErrP;
|
std::promise<MSVCPError> ErrP;
|
||||||
|
|
||||||
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
|
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
|
||||||
@@ -72,7 +72,7 @@ TEST_F(LookupAndRecordAddrsTest, AsyncWeakReference) {
|
|||||||
TEST_F(LookupAndRecordAddrsTest, BlockingRequiredSuccess) {
|
TEST_F(LookupAndRecordAddrsTest, BlockingRequiredSuccess) {
|
||||||
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarSym}})));
|
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarSym}})));
|
||||||
|
|
||||||
ExecutorAddress FooAddress, BarAddress;
|
ExecutorAddr FooAddress, BarAddress;
|
||||||
auto Err =
|
auto Err =
|
||||||
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
|
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
|
||||||
{{Foo, &FooAddress}, {Bar, &BarAddress}});
|
{{Foo, &FooAddress}, {Bar, &BarAddress}});
|
||||||
@@ -83,7 +83,7 @@ TEST_F(LookupAndRecordAddrsTest, BlockingRequiredSuccess) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LookupAndRecordAddrsTest, BlockingRequiredFailure) {
|
TEST_F(LookupAndRecordAddrsTest, BlockingRequiredFailure) {
|
||||||
ExecutorAddress FooAddress, BarAddress;
|
ExecutorAddr FooAddress, BarAddress;
|
||||||
auto Err =
|
auto Err =
|
||||||
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
|
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
|
||||||
{{Foo, &FooAddress}, {Bar, &BarAddress}});
|
{{Foo, &FooAddress}, {Bar, &BarAddress}});
|
||||||
@@ -94,7 +94,7 @@ TEST_F(LookupAndRecordAddrsTest, BlockingRequiredFailure) {
|
|||||||
TEST_F(LookupAndRecordAddrsTest, BlockingWeakReference) {
|
TEST_F(LookupAndRecordAddrsTest, BlockingWeakReference) {
|
||||||
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
|
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
|
||||||
|
|
||||||
ExecutorAddress FooAddress, BarAddress;
|
ExecutorAddr FooAddress, BarAddress;
|
||||||
auto Err =
|
auto Err =
|
||||||
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
|
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
|
||||||
{{Foo, &FooAddress}, {Bar, &BarAddress}},
|
{{Foo, &FooAddress}, {Bar, &BarAddress}},
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ namespace {
|
|||||||
|
|
||||||
orc::shared::detail::CWrapperFunctionResult
|
orc::shared::detail::CWrapperFunctionResult
|
||||||
incrementWrapper(const char *ArgData, size_t ArgSize) {
|
incrementWrapper(const char *ArgData, size_t ArgSize) {
|
||||||
return WrapperFunction<void(SPSExecutorAddress)>::handle(
|
return WrapperFunction<void(SPSExecutorAddr)>::handle(
|
||||||
ArgData, ArgSize,
|
ArgData, ArgSize, [](ExecutorAddr A) { *A.toPtr<int *>() += 1; })
|
||||||
[](ExecutorAddress A) { *A.toPtr<int *>() += 1; })
|
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,14 +39,13 @@ TEST(SimpleExecutorMemoryManagerTest, AllocFinalizeFree) {
|
|||||||
int FinalizeCounter = 0;
|
int FinalizeCounter = 0;
|
||||||
auto FinalizeCounterAddrArgBuffer =
|
auto FinalizeCounterAddrArgBuffer =
|
||||||
orc::shared::detail::serializeViaSPSToWrapperFunctionResult<
|
orc::shared::detail::serializeViaSPSToWrapperFunctionResult<
|
||||||
SPSArgList<SPSExecutorAddress>>(
|
SPSArgList<SPSExecutorAddr>>(ExecutorAddr::fromPtr(&FinalizeCounter));
|
||||||
ExecutorAddress::fromPtr(&FinalizeCounter));
|
|
||||||
|
|
||||||
int DeallocateCounter = 0;
|
int DeallocateCounter = 0;
|
||||||
auto DeallocateCounterAddrArgBuffer =
|
auto DeallocateCounterAddrArgBuffer =
|
||||||
orc::shared::detail::serializeViaSPSToWrapperFunctionResult<
|
orc::shared::detail::serializeViaSPSToWrapperFunctionResult<
|
||||||
SPSArgList<SPSExecutorAddress>>(
|
SPSArgList<SPSExecutorAddr>>(
|
||||||
ExecutorAddress::fromPtr(&DeallocateCounter));
|
ExecutorAddr::fromPtr(&DeallocateCounter));
|
||||||
|
|
||||||
tpctypes::FinalizeRequest FR;
|
tpctypes::FinalizeRequest FR;
|
||||||
FR.Segments.push_back(
|
FR.Segments.push_back(
|
||||||
@@ -57,12 +55,12 @@ TEST(SimpleExecutorMemoryManagerTest, AllocFinalizeFree) {
|
|||||||
{HW.data(), HW.size() + 1}});
|
{HW.data(), HW.size() + 1}});
|
||||||
FR.Actions.push_back(
|
FR.Actions.push_back(
|
||||||
{/* Finalize: */
|
{/* Finalize: */
|
||||||
{ExecutorAddress::fromPtr(incrementWrapper),
|
{ExecutorAddr::fromPtr(incrementWrapper),
|
||||||
ExecutorAddress::fromPtr(FinalizeCounterAddrArgBuffer.data()),
|
ExecutorAddr::fromPtr(FinalizeCounterAddrArgBuffer.data()),
|
||||||
FinalizeCounterAddrArgBuffer.size()},
|
FinalizeCounterAddrArgBuffer.size()},
|
||||||
/* Deallocate: */
|
/* Deallocate: */
|
||||||
{ExecutorAddress::fromPtr(incrementWrapper),
|
{ExecutorAddr::fromPtr(incrementWrapper),
|
||||||
ExecutorAddress::fromPtr(DeallocateCounterAddrArgBuffer.data()),
|
ExecutorAddr::fromPtr(DeallocateCounterAddrArgBuffer.data()),
|
||||||
DeallocateCounterAddrArgBuffer.size()}});
|
DeallocateCounterAddrArgBuffer.size()}});
|
||||||
|
|
||||||
EXPECT_EQ(FinalizeCounter, 0);
|
EXPECT_EQ(FinalizeCounter, 0);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ static WrapperFunctionResult addWrapper(const char *ArgData, size_t ArgSize) {
|
|||||||
|
|
||||||
static WrapperFunctionResult addMethodWrapper(const char *ArgData,
|
static WrapperFunctionResult addMethodWrapper(const char *ArgData,
|
||||||
size_t ArgSize) {
|
size_t ArgSize) {
|
||||||
return WrapperFunction<int32_t(SPSExecutorAddress, int32_t)>::handle(
|
return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
|
||||||
ArgData, ArgSize, makeMethodWrapperHandler(&AddClass::addMethod));
|
ArgData, ArgSize, makeMethodWrapperHandler(&AddClass::addMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,8 +97,8 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionCallAndHandleRet) {
|
|||||||
TEST(WrapperFunctionUtilsTest, WrapperFunctionMethodCallAndHandleRet) {
|
TEST(WrapperFunctionUtilsTest, WrapperFunctionMethodCallAndHandleRet) {
|
||||||
int32_t Result;
|
int32_t Result;
|
||||||
AddClass AddObj(1);
|
AddClass AddObj(1);
|
||||||
EXPECT_FALSE(!!WrapperFunction<int32_t(SPSExecutorAddress, int32_t)>::call(
|
EXPECT_FALSE(!!WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::call(
|
||||||
addMethodWrapper, Result, ExecutorAddress::fromPtr(&AddObj), 2));
|
addMethodWrapper, Result, ExecutorAddr::fromPtr(&AddObj), 2));
|
||||||
EXPECT_EQ(Result, (int32_t)3);
|
EXPECT_EQ(Result, (int32_t)3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user