[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:
Lang Hames 2021-09-23 12:00:47 -07:00
parent 4ed05312a1
commit ef391df2b6
41 changed files with 320 additions and 348 deletions

View File

@ -27,18 +27,18 @@ namespace llvm {
namespace orc {
struct ELFPerObjectSectionsToRegister {
ExecutorAddressRange EHFrameSection;
ExecutorAddressRange ThreadDataSection;
ExecutorAddrRange EHFrameSection;
ExecutorAddrRange ThreadDataSection;
};
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)) {}
std::string Name;
ExecutorAddress DSOHandleAddress;
ExecutorAddr DSOHandleAddress;
StringMap<SectionList> InitSections;
};
@ -179,7 +179,7 @@ private:
using SendDeinitializerSequenceFn =
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);
@ -202,9 +202,9 @@ private:
StringRef JDName);
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);
// Records the addresses of runtime symbols used by the platform.
@ -223,10 +223,10 @@ private:
SymbolStringPtr DSOHandleSymbol;
std::atomic<bool> RuntimeBootstrapped{false};
ExecutorAddress orc_rt_elfnix_platform_bootstrap;
ExecutorAddress orc_rt_elfnix_platform_shutdown;
ExecutorAddress orc_rt_elfnix_register_object_sections;
ExecutorAddress orc_rt_elfnix_create_pthread_key;
ExecutorAddr orc_rt_elfnix_platform_bootstrap;
ExecutorAddr orc_rt_elfnix_platform_shutdown;
ExecutorAddr orc_rt_elfnix_register_object_sections;
ExecutorAddr orc_rt_elfnix_create_pthread_key;
DenseMap<JITDylib *, SymbolLookupSet> RegisteredInitSymbols;
@ -243,7 +243,7 @@ private:
namespace shared {
using SPSELFPerObjectSectionsToRegister =
SPSTuple<SPSExecutorAddressRange, SPSExecutorAddressRange>;
SPSTuple<SPSExecutorAddrRange, SPSExecutorAddrRange>;
template <>
class SPSSerializationTraits<SPSELFPerObjectSectionsToRegister,
@ -268,12 +268,11 @@ public:
}
};
using SPSNamedExecutorAddressRangeSequenceMap =
SPSSequence<SPSTuple<SPSString, SPSExecutorAddressRangeSequence>>;
using SPSNamedExecutorAddrRangeSequenceMap =
SPSSequence<SPSTuple<SPSString, SPSExecutorAddrRangeSequence>>;
using SPSELFNixJITDylibInitializers =
SPSTuple<SPSString, SPSExecutorAddress,
SPSNamedExecutorAddressRangeSequenceMap>;
SPSTuple<SPSString, SPSExecutorAddr, SPSNamedExecutorAddrRangeSequenceMap>;
using SPSELFNixJITDylibInitializerSequence =
SPSSequence<SPSELFNixJITDylibInitializers>;

View File

@ -30,9 +30,9 @@ class EPCGenericDylibManager {
public:
/// Function addresses for memory access.
struct SymbolAddrs {
ExecutorAddress Instance;
ExecutorAddress Open;
ExecutorAddress Lookup;
ExecutorAddr Instance;
ExecutorAddr Open;
ExecutorAddr Lookup;
};
/// Create an EPCGenericMemoryAccess instance from a given set of
@ -49,11 +49,11 @@ public:
Expected<tpctypes::DylibHandle> open(StringRef Path, uint64_t Mode);
/// Looks up symbols within the given dylib.
Expected<std::vector<ExecutorAddress>> lookup(tpctypes::DylibHandle H,
const SymbolLookupSet &Lookup);
Expected<std::vector<ExecutorAddr>> lookup(tpctypes::DylibHandle H,
const SymbolLookupSet &Lookup);
/// Looks up symbols within the given dylib.
Expected<std::vector<ExecutorAddress>>
Expected<std::vector<ExecutorAddr>>
lookup(tpctypes::DylibHandle H, const RemoteSymbolLookupSet &Lookup);
private:

View File

@ -28,10 +28,10 @@ class EPCGenericJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
public:
/// Function addresses for memory access.
struct SymbolAddrs {
ExecutorAddress Allocator;
ExecutorAddress Reserve;
ExecutorAddress Finalize;
ExecutorAddress Deallocate;
ExecutorAddr Allocator;
ExecutorAddr Reserve;
ExecutorAddr Finalize;
ExecutorAddr Deallocate;
};
/// Create an EPCGenericJITLinkMemoryManager instance from a given set of

View File

@ -27,11 +27,11 @@ class EPCGenericMemoryAccess : public ExecutorProcessControl::MemoryAccess {
public:
/// Function addresses for memory access.
struct FuncAddrs {
ExecutorAddress WriteUInt8s;
ExecutorAddress WriteUInt16s;
ExecutorAddress WriteUInt32s;
ExecutorAddress WriteUInt64s;
ExecutorAddress WriteBuffers;
ExecutorAddr WriteUInt8s;
ExecutorAddr WriteUInt16s;
ExecutorAddr WriteUInt32s;
ExecutorAddr WriteUInt64s;
ExecutorAddr WriteBuffers;
};
/// Create an EPCGenericMemoryAccess instance from a given set of

View File

@ -118,8 +118,8 @@ public:
/// Contains the address of the dispatch function and context that the ORC
/// runtime can use to call functions in the JIT.
struct JITDispatchInfo {
ExecutorAddress JITDispatchFunctionAddress;
ExecutorAddress JITDispatchContextAddress;
ExecutorAddr JITDispatchFunction;
ExecutorAddr JITDispatchContext;
};
virtual ~ExecutorProcessControl();
@ -159,15 +159,15 @@ public:
}
/// Returns the bootstrap symbol map.
const StringMap<ExecutorAddress> &getBootstrapSymbolsMap() const {
const StringMap<ExecutorAddr> &getBootstrapSymbolsMap() const {
return BootstrapSymbols;
}
/// For each (ExecutorAddress&, StringRef) pair, looks up the string in the
/// bootstrap symbols map and writes its address to the ExecutorAddress if
/// For each (ExecutorAddr&, StringRef) pair, looks up the string in the
/// bootstrap symbols map and writes its address to the ExecutorAddr if
/// found. If any symbol is not found then the function returns an error.
Error getBootstrapSymbols(
ArrayRef<std::pair<ExecutorAddress &, StringRef>> Pairs) const {
ArrayRef<std::pair<ExecutorAddr &, StringRef>> Pairs) const {
for (auto &KV : Pairs) {
auto I = BootstrapSymbols.find(KV.second);
if (I == BootstrapSymbols.end())
@ -275,7 +275,7 @@ protected:
JITDispatchInfo JDI;
MemoryAccess *MemAccess = nullptr;
jitlink::JITLinkMemoryManager *MemMgr = nullptr;
StringMap<ExecutorAddress> BootstrapSymbols;
StringMap<ExecutorAddr> BootstrapSymbols;
};
/// A ExecutorProcessControl instance that asserts if any of its methods are

View File

@ -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
// the given symbols.
@ -25,7 +25,7 @@
namespace llvm {
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
/// access in the executor (e.g. runtime support functions in Platform
@ -44,24 +44,24 @@ namespace orc {
void lookupAndRecordAddrs(
unique_function<void(Error)> OnRecorded, 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);
/// Record addresses of the given symbols in the given ExecutorAddresses.
/// Record addresses of the given symbols in the given ExecutorAddrs.
///
/// Blocking version.
Error lookupAndRecordAddrs(
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);
/// 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
/// weak.
Error lookupAndRecordAddrs(
ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
SymbolLookupFlags LookupFlags = SymbolLookupFlags::RequiredSymbol);
} // End namespace orc

View File

@ -27,21 +27,20 @@ namespace llvm {
namespace orc {
struct MachOPerObjectSectionsToRegister {
ExecutorAddressRange EHFrameSection;
ExecutorAddressRange ThreadDataSection;
ExecutorAddrRange EHFrameSection;
ExecutorAddrRange ThreadDataSection;
};
struct MachOJITDylibInitializers {
using SectionList = std::vector<ExecutorAddressRange>;
using SectionList = std::vector<ExecutorAddrRange>;
MachOJITDylibInitializers(std::string Name,
ExecutorAddress MachOHeaderAddress)
MachOJITDylibInitializers(std::string Name, ExecutorAddr MachOHeaderAddress)
: Name(std::move(Name)),
MachOHeaderAddress(std::move(MachOHeaderAddress)) {}
std::string Name;
ExecutorAddress MachOHeaderAddress;
ExecutorAddress ObjCImageInfoAddress;
ExecutorAddr MachOHeaderAddress;
ExecutorAddr ObjCImageInfoAddress;
StringMap<SectionList> InitSections;
};
@ -185,7 +184,7 @@ private:
using SendDeinitializerSequenceFn =
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);
@ -208,15 +207,15 @@ private:
StringRef JDName);
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);
// Records the addresses of runtime symbols used by the platform.
Error bootstrapMachORuntime(JITDylib &PlatformJD);
Error registerInitInfo(JITDylib &JD, ExecutorAddress ObjCImageInfoAddr,
Error registerInitInfo(JITDylib &JD, ExecutorAddr ObjCImageInfoAddr,
ArrayRef<jitlink::Section *> InitSections);
Error registerPerObjectSections(const MachOPerObjectSectionsToRegister &POSR);
@ -229,10 +228,10 @@ private:
SymbolStringPtr MachOHeaderStartSymbol;
std::atomic<bool> RuntimeBootstrapped{false};
ExecutorAddress orc_rt_macho_platform_bootstrap;
ExecutorAddress orc_rt_macho_platform_shutdown;
ExecutorAddress orc_rt_macho_register_object_sections;
ExecutorAddress orc_rt_macho_create_pthread_key;
ExecutorAddr orc_rt_macho_platform_bootstrap;
ExecutorAddr orc_rt_macho_platform_shutdown;
ExecutorAddr orc_rt_macho_register_object_sections;
ExecutorAddr orc_rt_macho_create_pthread_key;
DenseMap<JITDylib *, SymbolLookupSet> RegisteredInitSymbols;
@ -249,7 +248,7 @@ private:
namespace shared {
using SPSMachOPerObjectSectionsToRegister =
SPSTuple<SPSExecutorAddressRange, SPSExecutorAddressRange>;
SPSTuple<SPSExecutorAddrRange, SPSExecutorAddrRange>;
template <>
class SPSSerializationTraits<SPSMachOPerObjectSectionsToRegister,
@ -274,12 +273,12 @@ public:
}
};
using SPSNamedExecutorAddressRangeSequenceMap =
SPSSequence<SPSTuple<SPSString, SPSExecutorAddressRangeSequence>>;
using SPSNamedExecutorAddrRangeSequenceMap =
SPSSequence<SPSTuple<SPSString, SPSExecutorAddrRangeSequence>>;
using SPSMachOJITDylibInitializers =
SPSTuple<SPSString, SPSExecutorAddress, SPSExecutorAddress,
SPSNamedExecutorAddressRangeSequenceMap>;
SPSTuple<SPSString, SPSExecutorAddr, SPSExecutorAddr,
SPSNamedExecutorAddrRangeSequenceMap>;
using SPSMachOJITDylibInitializerSequence =
SPSSequence<SPSMachOJITDylibInitializers>;

View File

@ -402,8 +402,8 @@ protected:
if (auto EPI = EP.template callB<orcrpctpc::GetExecutorProcessInfo>()) {
this->TargetTriple = Triple(EPI->Triple);
this->PageSize = EPI->PageSize;
this->JDI = {ExecutorAddress(EPI->DispatchFuncAddr),
ExecutorAddress(EPI->DispatchCtxAddr)};
this->JDI = {ExecutorAddr(EPI->DispatchFuncAddr),
ExecutorAddr(EPI->DispatchCtxAddr)};
return Error::success();
} else
return EPI.takeError();

View File

@ -34,25 +34,24 @@ private:
};
/// Represents an address in the executor process.
class ExecutorAddress {
class ExecutorAddr {
public:
ExecutorAddress() = default;
explicit ExecutorAddress(uint64_t Addr) : Addr(Addr) {}
ExecutorAddr() = default;
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.
template <typename T> static ExecutorAddress fromPtr(T *Value) {
return ExecutorAddress(
template <typename T> static ExecutorAddr fromPtr(T *Value) {
return ExecutorAddr(
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.
template <typename T> T toPtr() const {
static_assert(std::is_pointer<T>::value, "T must be a pointer type");
uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
assert(IntPtr == Addr &&
"JITTargetAddress value out of range for uintptr_t");
assert(IntPtr == Addr && "ExecutorAddr value out of range for uintptr_t");
return reinterpret_cast<T>(IntPtr);
}
@ -62,53 +61,47 @@ public:
explicit operator bool() const { return Addr != 0; }
friend bool operator==(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
friend bool operator==(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
return LHS.Addr == RHS.Addr;
}
friend bool operator!=(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
friend bool operator!=(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
return LHS.Addr != RHS.Addr;
}
friend bool operator<(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
friend bool operator<(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
return LHS.Addr < RHS.Addr;
}
friend bool operator<=(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
friend bool operator<=(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
return LHS.Addr <= RHS.Addr;
}
friend bool operator>(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
friend bool operator>(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
return LHS.Addr > RHS.Addr;
}
friend bool operator>=(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
friend bool operator>=(const ExecutorAddr &LHS, const ExecutorAddr &RHS) {
return LHS.Addr >= RHS.Addr;
}
ExecutorAddress &operator++() {
ExecutorAddr &operator++() {
++Addr;
return *this;
}
ExecutorAddress &operator--() {
ExecutorAddr &operator--() {
--Addr;
return *this;
}
ExecutorAddress operator++(int) { return ExecutorAddress(Addr++); }
ExecutorAddress operator--(int) { return ExecutorAddress(Addr++); }
ExecutorAddr operator++(int) { return ExecutorAddr(Addr++); }
ExecutorAddr operator--(int) { return ExecutorAddr(Addr++); }
ExecutorAddress &operator+=(const ExecutorAddrDiff Delta) {
ExecutorAddr &operator+=(const ExecutorAddrDiff Delta) {
Addr += Delta.getValue();
return *this;
}
ExecutorAddress &operator-=(const ExecutorAddrDiff Delta) {
ExecutorAddr &operator-=(const ExecutorAddrDiff Delta) {
Addr -= Delta.getValue();
return *this;
}
@ -118,83 +111,81 @@ private:
};
/// Subtracting two addresses yields an offset.
inline ExecutorAddrDiff operator-(const ExecutorAddress &LHS,
const ExecutorAddress &RHS) {
inline ExecutorAddrDiff operator-(const ExecutorAddr &LHS,
const ExecutorAddr &RHS) {
return ExecutorAddrDiff(LHS.getValue() - RHS.getValue());
}
/// Adding an offset and an address yields an address.
inline ExecutorAddress operator+(const ExecutorAddress &LHS,
const ExecutorAddrDiff &RHS) {
return ExecutorAddress(LHS.getValue() + RHS.getValue());
inline ExecutorAddr operator+(const ExecutorAddr &LHS,
const ExecutorAddrDiff &RHS) {
return ExecutorAddr(LHS.getValue() + RHS.getValue());
}
/// Adding an address and an offset yields an address.
inline ExecutorAddress operator+(const ExecutorAddrDiff &LHS,
const ExecutorAddress &RHS) {
return ExecutorAddress(LHS.getValue() + RHS.getValue());
inline ExecutorAddr operator+(const ExecutorAddrDiff &LHS,
const ExecutorAddr &RHS) {
return ExecutorAddr(LHS.getValue() + RHS.getValue());
}
/// Represents an address range in the exceutor process.
struct ExecutorAddressRange {
ExecutorAddressRange() = default;
ExecutorAddressRange(ExecutorAddress StartAddress, ExecutorAddress EndAddress)
: StartAddress(StartAddress), EndAddress(EndAddress) {}
struct ExecutorAddrRange {
ExecutorAddrRange() = default;
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
: Start(Start), End(End) {}
bool empty() const { return StartAddress == EndAddress; }
ExecutorAddrDiff size() const { return EndAddress - StartAddress; }
bool empty() const { return Start == End; }
ExecutorAddrDiff size() const { return End - Start; }
ExecutorAddress StartAddress;
ExecutorAddress EndAddress;
ExecutorAddr Start;
ExecutorAddr End;
};
namespace shared {
/// SPS serializatior for ExecutorAddress.
template <> class SPSSerializationTraits<SPSExecutorAddress, ExecutorAddress> {
/// SPS serializatior for ExecutorAddr.
template <> class SPSSerializationTraits<SPSExecutorAddr, ExecutorAddr> {
public:
static size_t size(const ExecutorAddress &EA) {
static size_t size(const ExecutorAddr &EA) {
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());
}
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddress &EA) {
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddr &EA) {
uint64_t Tmp;
if (!SPSArgList<uint64_t>::deserialize(BIB, Tmp))
return false;
EA = ExecutorAddress(Tmp);
EA = ExecutorAddr(Tmp);
return true;
}
};
using SPSExecutorAddressRange =
SPSTuple<SPSExecutorAddress, SPSExecutorAddress>;
using SPSExecutorAddrRange = SPSTuple<SPSExecutorAddr, SPSExecutorAddr>;
/// Serialization traits for address ranges.
template <>
class SPSSerializationTraits<SPSExecutorAddressRange, ExecutorAddressRange> {
class SPSSerializationTraits<SPSExecutorAddrRange, ExecutorAddrRange> {
public:
static size_t size(const ExecutorAddressRange &Value) {
return SPSArgList<SPSExecutorAddress, SPSExecutorAddress>::size(
Value.StartAddress, Value.EndAddress);
static size_t size(const ExecutorAddrRange &Value) {
return SPSArgList<SPSExecutorAddr, SPSExecutorAddr>::size(Value.Start,
Value.End);
}
static bool serialize(SPSOutputBuffer &BOB,
const ExecutorAddressRange &Value) {
return SPSArgList<SPSExecutorAddress, SPSExecutorAddress>::serialize(
BOB, Value.StartAddress, Value.EndAddress);
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddrRange &Value) {
return SPSArgList<SPSExecutorAddr, SPSExecutorAddr>::serialize(
BOB, Value.Start, Value.End);
}
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddressRange &Value) {
return SPSArgList<SPSExecutorAddress, SPSExecutorAddress>::deserialize(
BIB, Value.StartAddress, Value.EndAddress);
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddrRange &Value) {
return SPSArgList<SPSExecutorAddr, SPSExecutorAddr>::deserialize(
BIB, Value.Start, Value.End);
}
};
using SPSExecutorAddressRangeSequence = SPSSequence<SPSExecutorAddressRange>;
using SPSExecutorAddrRangeSequence = SPSSequence<SPSExecutorAddrRange>;
} // End namespace shared.
} // End namespace orc.

View File

@ -40,23 +40,22 @@ extern const char *MemoryWriteBuffersWrapperName;
extern const char *RunAsMainWrapperName;
using SPSSimpleExecutorDylibManagerOpenSignature =
shared::SPSExpected<uint64_t>(shared::SPSExecutorAddress, shared::SPSString,
shared::SPSExpected<uint64_t>(shared::SPSExecutorAddr, shared::SPSString,
uint64_t);
using SPSSimpleExecutorDylibManagerLookupSignature =
shared::SPSExpected<shared::SPSSequence<shared::SPSExecutorAddress>>(
shared::SPSExecutorAddress, uint64_t, shared::SPSRemoteSymbolLookupSet);
shared::SPSExpected<shared::SPSSequence<shared::SPSExecutorAddr>>(
shared::SPSExecutorAddr, uint64_t, shared::SPSRemoteSymbolLookupSet);
using SPSSimpleExecutorMemoryManagerReserveSignature =
shared::SPSExpected<shared::SPSExecutorAddress>(shared::SPSExecutorAddress,
uint64_t);
shared::SPSExpected<shared::SPSExecutorAddr>(shared::SPSExecutorAddr,
uint64_t);
using SPSSimpleExecutorMemoryManagerFinalizeSignature =
shared::SPSError(shared::SPSExecutorAddress, shared::SPSFinalizeRequest);
using SPSSimpleExecutorMemoryManagerDeallocateSignature =
shared::SPSError(shared::SPSExecutorAddress,
shared::SPSSequence<shared::SPSExecutorAddress>);
shared::SPSError(shared::SPSExecutorAddr, shared::SPSFinalizeRequest);
using SPSSimpleExecutorMemoryManagerDeallocateSignature = shared::SPSError(
shared::SPSExecutorAddr, shared::SPSSequence<shared::SPSExecutorAddr>);
using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddress,
using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddr,
shared::SPSSequence<shared::SPSString>);
} // end namespace rt

View File

@ -196,10 +196,10 @@ template <typename SPSElementTagT> class SPSSequence;
using SPSString = SPSSequence<char>;
/// SPS tag type for executor addresseses.
class SPSExecutorAddress {};
class SPSExecutorAddr {};
template <>
class SPSSerializationTraits<SPSExecutorAddress, uint64_t>
class SPSSerializationTraits<SPSExecutorAddr, uint64_t>
: public SPSSerializationTraits<uint64_t, uint64_t> {};
/// SPS tag type for maps.

View File

@ -44,7 +44,7 @@ enum class SimpleRemoteEPCOpcode : uint8_t {
struct SimpleRemoteEPCExecutorInfo {
std::string TargetTriple;
uint64_t PageSize;
StringMap<ExecutorAddress> BootstrapSymbols;
StringMap<ExecutorAddr> BootstrapSymbols;
};
using SimpleRemoteEPCArgBytesVector = SmallVector<char, 128>;
@ -61,8 +61,7 @@ public:
/// client will not accept any further messages, and 'ContinueSession'
/// otherwise.
virtual Expected<HandleMessageAction>
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr,
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) = 0;
/// Handle a disconnection from the underlying transport. No further messages
@ -83,8 +82,7 @@ public:
/// This function may be called concurrently. Subclasses should implement
/// locking if required for the underlying transport.
virtual Error sendMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr,
ArrayRef<char> ArgBytes) = 0;
ExecutorAddr TagAddr, ArrayRef<char> ArgBytes) = 0;
/// Trigger disconnection from the transport. The implementation should
/// respond by calling handleDisconnect on the client once disconnection
@ -110,7 +108,7 @@ public:
~FDSimpleRemoteEPCTransport() override;
Error sendMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr, ArrayRef<char> ArgBytes) override;
ExecutorAddr TagAddr, ArrayRef<char> ArgBytes) override;
void disconnect() override;
@ -151,7 +149,7 @@ using SPSRemoteSymbolLookup = SPSTuple<uint64_t, SPSRemoteSymbolLookupSet>;
/// Tuple containing target triple, page size, and bootstrap symbols.
using SPSSimpleRemoteEPCExecutorInfo =
SPSTuple<SPSString, uint64_t,
SPSSequence<SPSTuple<SPSString, SPSExecutorAddress>>>;
SPSSequence<SPSTuple<SPSString, SPSExecutorAddr>>>;
template <>
class SPSSerializationTraits<SPSRemoteSymbolLookupSetElement,
@ -211,12 +209,12 @@ public:
}
};
using SPSLoadDylibSignature =
SPSExpected<SPSExecutorAddress>(SPSExecutorAddress, SPSString, uint64_t);
using SPSLoadDylibSignature = SPSExpected<SPSExecutorAddr>(SPSExecutorAddr,
SPSString, uint64_t);
using SPSLookupSymbolsSignature =
SPSExpected<SPSSequence<SPSSequence<SPSExecutorAddress>>>(
SPSExecutorAddress, SPSSequence<SPSRemoteSymbolLookup>);
SPSExpected<SPSSequence<SPSSequence<SPSExecutorAddr>>>(
SPSExecutorAddr, SPSSequence<SPSRemoteSymbolLookup>);
} // end namespace shared
} // end namespace orc

View File

@ -72,8 +72,8 @@ inline std::string getWireProtectionFlagsStr(WireProtectionFlags WPF) {
struct SupportFunctionCall {
using FnTy = shared::detail::CWrapperFunctionResult(const char *ArgData,
size_t ArgSize);
ExecutorAddress Func;
ExecutorAddress ArgData;
ExecutorAddr Func;
ExecutorAddr ArgData;
uint64_t ArgSize;
Error run() {
@ -96,7 +96,7 @@ struct AllocationActionsPair {
struct SegFinalizeRequest {
WireProtectionFlags Prot;
ExecutorAddress Addr;
ExecutorAddr Addr;
uint64_t Size;
ArrayRef<char> Content;
};
@ -150,10 +150,10 @@ namespace shared {
class SPSMemoryProtectionFlags {};
using SPSSupportFunctionCall =
SPSTuple<SPSExecutorAddress, SPSExecutorAddress, uint64_t>;
SPSTuple<SPSExecutorAddr, SPSExecutorAddr, uint64_t>;
using SPSSegFinalizeRequest =
SPSTuple<SPSMemoryProtectionFlags, SPSExecutorAddress, uint64_t,
SPSTuple<SPSMemoryProtectionFlags, SPSExecutorAddr, uint64_t,
SPSSequence<char>>;
using SPSAllocationActionsPair =
@ -163,15 +163,14 @@ using SPSFinalizeRequest = SPSTuple<SPSSequence<SPSSegFinalizeRequest>,
SPSSequence<SPSAllocationActionsPair>>;
template <typename T>
using SPSMemoryAccessUIntWrite = SPSTuple<SPSExecutorAddress, T>;
using SPSMemoryAccessUIntWrite = SPSTuple<SPSExecutorAddr, T>;
using SPSMemoryAccessUInt8Write = SPSMemoryAccessUIntWrite<uint8_t>;
using SPSMemoryAccessUInt16Write = SPSMemoryAccessUIntWrite<uint16_t>;
using SPSMemoryAccessUInt32Write = SPSMemoryAccessUIntWrite<uint32_t>;
using SPSMemoryAccessUInt64Write = SPSMemoryAccessUIntWrite<uint64_t>;
using SPSMemoryAccessBufferWrite =
SPSTuple<SPSExecutorAddress, SPSSequence<char>>;
using SPSMemoryAccessBufferWrite = SPSTuple<SPSExecutorAddr, SPSSequence<char>>;
template <>
class SPSSerializationTraits<SPSMemoryProtectionFlags,
@ -283,17 +282,17 @@ class SPSSerializationTraits<SPSMemoryAccessUIntWrite<T>,
tpctypes::UIntWrite<T>> {
public:
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) {
return SPSTuple<SPSExecutorAddress, T>::AsArgList::serialize(OB, W.Address,
W.Value);
return SPSTuple<SPSExecutorAddr, T>::AsArgList::serialize(OB, W.Address,
W.Value);
}
static bool deserialize(SPSInputBuffer &IB, tpctypes::UIntWrite<T> &W) {
return SPSTuple<SPSExecutorAddress, T>::AsArgList::deserialize(
IB, W.Address, W.Value);
return SPSTuple<SPSExecutorAddr, T>::AsArgList::deserialize(IB, W.Address,
W.Value);
}
};
@ -302,18 +301,17 @@ class SPSSerializationTraits<SPSMemoryAccessBufferWrite,
tpctypes::BufferWrite> {
public:
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);
}
static bool serialize(SPSOutputBuffer &OB, const tpctypes::BufferWrite &W) {
return SPSTuple<SPSExecutorAddress,
SPSSequence<char>>::AsArgList ::serialize(OB, W.Address,
W.Buffer);
return SPSTuple<SPSExecutorAddr, SPSSequence<char>>::AsArgList ::serialize(
OB, W.Address, W.Buffer);
}
static bool deserialize(SPSInputBuffer &IB, tpctypes::BufferWrite &W) {
return SPSTuple<SPSExecutorAddress,
return SPSTuple<SPSExecutorAddr,
SPSSequence<char>>::AsArgList ::deserialize(IB, W.Address,
W.Buffer);
}

View File

@ -567,7 +567,7 @@ public:
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
/// pointer passing in the remaining function arguments. This utility
/// 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.
/// using SPSMyMethodWrapperSignature =
/// SPSTuple<SPSExecutorAddress, uint32_t, bool>;
/// SPSTuple<SPSExecutorAddr, uint32_t, bool>;
///
/// WrapperFunctionResult
/// myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
@ -594,9 +594,10 @@ class MethodWrapperHandler {
public:
using MethodT = RetT (ClassT::*)(ArgTs...);
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)...);
}
private:
MethodT M;
};

View File

@ -77,8 +77,7 @@ public:
Error disconnect() override;
Expected<HandleMessageAction>
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr,
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) override;
void handleDisconnect(Error Err) override;
@ -92,16 +91,16 @@ private:
SimpleRemoteEPC(std::shared_ptr<SymbolStringPool> SSP)
: ExecutorProcessControl(std::move(SSP)) {}
Error handleSetup(uint64_t SeqNo, ExecutorAddress TagAddr,
Error handleSetup(uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes);
void prepareToReceiveSetupMessage(
std::promise<MSVCPExpected<SimpleRemoteEPCExecutorInfo>> &ExecInfoP);
Error setup(std::unique_ptr<SimpleRemoteEPCTransport> T,
SimpleRemoteEPCExecutorInfo EI);
Error handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
Error handleResult(uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes);
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes);
uint64_t getNextSeqNo() { return NextSeqNo++; }
@ -116,7 +115,7 @@ private:
std::unique_ptr<MemoryAccess> OwnedMemAccess;
std::unique_ptr<EPCGenericDylibManager> DylibMgr;
ExecutorAddress RunAsMainAddr;
ExecutorAddr RunAsMainAddr;
uint64_t NextSeqNo = 0;
PendingCallWrapperResultsMap PendingCallWrapperResults;

View File

@ -26,7 +26,7 @@ public:
virtual ~ExecutorBootstrapService();
virtual void
addBootstrapSymbols(StringMap<ExecutorAddress> &BootstrapSymbols) = 0;
addBootstrapSymbols(StringMap<ExecutorAddr> &BootstrapSymbols) = 0;
virtual Error shutdown() = 0;
};

View File

@ -37,11 +37,11 @@ public:
virtual ~SimpleExecutorDylibManager();
Expected<tpctypes::DylibHandle> open(const std::string &Path, uint64_t Mode);
Expected<std::vector<ExecutorAddress>> lookup(tpctypes::DylibHandle H,
const RemoteSymbolLookupSet &L);
Expected<std::vector<ExecutorAddr>> lookup(tpctypes::DylibHandle H,
const RemoteSymbolLookupSet &L);
Error shutdown() override;
void addBootstrapSymbols(StringMap<ExecutorAddress> &M) override;
void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override;
private:
using DylibsMap = DenseMap<uint64_t, sys::DynamicLibrary>;

View File

@ -33,12 +33,12 @@ class SimpleExecutorMemoryManager : public ExecutorBootstrapService {
public:
virtual ~SimpleExecutorMemoryManager();
Expected<ExecutorAddress> allocate(uint64_t Size);
Expected<ExecutorAddr> allocate(uint64_t Size);
Error finalize(tpctypes::FinalizeRequest &FR);
Error deallocate(const std::vector<ExecutorAddress> &Bases);
Error deallocate(const std::vector<ExecutorAddr> &Bases);
Error shutdown() override;
void addBootstrapSymbols(StringMap<ExecutorAddress> &M) override;
void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override;
private:
struct Allocation {

View File

@ -64,7 +64,7 @@ public:
public:
SimpleRemoteEPCServer &server();
StringMap<ExecutorAddress> &bootstrapSymbols() { return BootstrapSymbols; }
StringMap<ExecutorAddr> &bootstrapSymbols() { return BootstrapSymbols; }
std::vector<std::unique_ptr<ExecutorBootstrapService>> &services() {
return Services;
}
@ -76,11 +76,11 @@ public:
private:
Setup(SimpleRemoteEPCServer &S) : S(S) {}
SimpleRemoteEPCServer &S;
StringMap<ExecutorAddress> BootstrapSymbols;
StringMap<ExecutorAddr> BootstrapSymbols;
std::vector<std::unique_ptr<ExecutorBootstrapService>> Services;
};
static StringMap<ExecutorAddress> defaultBootstrapSymbols();
static StringMap<ExecutorAddr> defaultBootstrapSymbols();
template <typename TransportT, typename... TransportTCtorArgTs>
static Expected<std::unique_ptr<SimpleRemoteEPCServer>>
@ -128,8 +128,7 @@ public:
/// otherwise returns 'Continue'. If the server has moved to an error state,
/// returns an error, which should be reported and treated as a 'Disconnect'.
Expected<HandleMessageAction>
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr,
handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) override;
Error waitForDisconnect();
@ -137,11 +136,11 @@ public:
void handleDisconnect(Error Err) override;
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);
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes);
shared::WrapperFunctionResult

View File

@ -125,10 +125,10 @@ ELFNixPlatform::Create(ExecutionSession &ES,
// Add JIT-dispatch function support symbols.
if (auto Err = PlatformJD.define(absoluteSymbols(
{{ES.intern("__orc_rt_jit_dispatch"),
{EPC.getJITDispatchInfo().JITDispatchFunctionAddress.getValue(),
{EPC.getJITDispatchInfo().JITDispatchFunction.getValue(),
JITSymbolFlags::Exported}},
{ES.intern("__orc_rt_jit_dispatch_ctx"),
{EPC.getJITDispatchInfo().JITDispatchContextAddress.getValue(),
{EPC.getJITDispatchInfo().JITDispatchContext.getValue(),
JITSymbolFlags::Exported}}})))
return std::move(Err);
@ -274,13 +274,13 @@ Error ELFNixPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) {
this, &ELFNixPlatform::rt_getInitializers);
using GetDeinitializersSPSSig =
SPSExpected<SPSELFJITDylibDeinitializerSequence>(SPSExecutorAddress);
SPSExpected<SPSELFJITDylibDeinitializerSequence>(SPSExecutorAddr);
WFs[ES.intern("__orc_rt_elfnix_get_deinitializers_tag")] =
ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
this, &ELFNixPlatform::rt_getDeinitializers);
using LookupSymbolSPSSig =
SPSExpected<SPSExecutorAddress>(SPSExecutorAddress, SPSString);
SPSExpected<SPSExecutorAddr>(SPSExecutorAddr, SPSString);
WFs[ES.intern("__orc_rt_elfnix_symbol_lookup_tag")] =
ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
&ELFNixPlatform::rt_lookupSymbol);
@ -364,7 +364,7 @@ void ELFNixPlatform::rt_getInitializers(SendInitializerSequenceFn SendResult,
}
void ELFNixPlatform::rt_getDeinitializers(
SendDeinitializerSequenceFn SendResult, ExecutorAddress Handle) {
SendDeinitializerSequenceFn SendResult, ExecutorAddr Handle) {
LLVM_DEBUG({
dbgs() << "ELFNixPlatform::rt_getDeinitializers(\""
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
@ -394,7 +394,7 @@ void ELFNixPlatform::rt_getDeinitializers(
}
void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
ExecutorAddress Handle,
ExecutorAddr Handle,
StringRef SymbolName) {
LLVM_DEBUG({
dbgs() << "ELFNixPlatform::rt_lookupSymbol(\""
@ -429,7 +429,7 @@ void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
void operator()(Expected<SymbolMap> Result) {
if (Result) {
assert(Result->size() == 1 && "Unexpected result map count");
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
SendResult(ExecutorAddr(Result->begin()->second.getAddress()));
} else {
SendResult(Result.takeError());
}
@ -447,7 +447,7 @@ void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
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_shutdown", &orc_rt_elfnix_platform_shutdown},
{"__orc_rt_elfnix_register_object_sections",
@ -456,7 +456,7 @@ Error ELFNixPlatform::bootstrapELFNixRuntime(JITDylib &PlatformJD) {
&orc_rt_elfnix_create_pthread_key}};
SymbolLookupSet RuntimeSymbols;
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> AddrsToRecord;
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> AddrsToRecord;
for (const auto &KV : Symbols) {
auto Name = ES.intern(KV.first);
RuntimeSymbols.add(Name);
@ -525,7 +525,7 @@ Error ELFNixPlatform::registerInitInfo(
// FIXME: Avoid copy here.
jitlink::SectionRange R(*Sec);
InitSeq->InitSections[Sec->getName()].push_back(
{ExecutorAddress(R.getStart()), ExecutorAddress(R.getEnd())});
{ExecutorAddr(R.getStart()), ExecutorAddr(R.getEnd())});
}
return Error::success();
@ -627,9 +627,9 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addDSOHandleSupportPasses(
JITTargetAddress HandleAddr = (*I)->getAddress();
MP.HandleAddrToJITDylib[HandleAddr] = &JD;
assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
MP.InitSeqs.insert(
std::make_pair(&JD, ELFNixJITDylibInitializers(
JD.getName(), ExecutorAddress(HandleAddr))));
MP.InitSeqs.insert(std::make_pair(
&JD,
ELFNixJITDylibInitializers(JD.getName(), ExecutorAddr(HandleAddr))));
}
return Error::success();
});
@ -656,8 +656,8 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
jitlink::SectionRange R(*EHFrameSection);
if (!R.empty())
POSR.EHFrameSection = {ExecutorAddress(R.getStart()),
ExecutorAddress(R.getEnd())};
POSR.EHFrameSection = {ExecutorAddr(R.getStart()),
ExecutorAddr(R.getEnd())};
}
// 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) {
jitlink::SectionRange R(*ThreadDataSection);
if (!R.empty())
POSR.ThreadDataSection = {ExecutorAddress(R.getStart()),
ExecutorAddress(R.getEnd())};
POSR.ThreadDataSection = {ExecutorAddr(R.getStart()),
ExecutorAddr(R.getEnd())};
}
if (POSR.EHFrameSection.StartAddress ||
POSR.ThreadDataSection.StartAddress) {
if (POSR.EHFrameSection.Start || POSR.ThreadDataSection.Start) {
// If we're still bootstrapping the runtime then just record this
// frame for now.

View File

@ -43,8 +43,8 @@ createJITLoaderGDBRegistrar(ExecutionSession &ES) {
}
Error EPCDebugObjectRegistrar::registerDebugObject(sys::MemoryBlock TargetMem) {
return ES.callSPSWrapper<void(SPSExecutorAddress, uint64_t)>(
RegisterFn, ExecutorAddress::fromPtr(TargetMem.base()),
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
RegisterFn, ExecutorAddr::fromPtr(TargetMem.base()),
static_cast<uint64_t>(TargetMem.allocatedSize()));
}

View File

@ -57,14 +57,14 @@ EPCEHFrameRegistrar::Create(ExecutionSession &ES) {
Error EPCEHFrameRegistrar::registerEHFrames(JITTargetAddress EHFrameSectionAddr,
size_t EHFrameSectionSize) {
return ES.callSPSWrapper<void(SPSExecutorAddress, uint64_t)>(
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
RegisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
static_cast<uint64_t>(EHFrameSectionSize));
}
Error EPCEHFrameRegistrar::deregisterEHFrames(
JITTargetAddress EHFrameSectionAddr, size_t EHFrameSectionSize) {
return ES.callSPSWrapper<void(SPSExecutorAddress, uint64_t)>(
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
DeregisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
static_cast<uint64_t>(EHFrameSectionSize));
}

View File

@ -43,16 +43,16 @@ template <>
class SPSSerializationTraits<SPSRemoteSymbolLookup,
ExecutorProcessControl::LookupRequest> {
using MemberSerialization =
SPSArgList<SPSExecutorAddress, SPSRemoteSymbolLookupSet>;
SPSArgList<SPSExecutorAddr, SPSRemoteSymbolLookupSet>;
public:
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,
const ExecutorProcessControl::LookupRequest &LR) {
return MemberSerialization::serialize(OB, ExecutorAddress(LR.Handle),
return MemberSerialization::serialize(OB, ExecutorAddr(LR.Handle),
LR.Symbols);
}
};
@ -81,11 +81,10 @@ Expected<tpctypes::DylibHandle> EPCGenericDylibManager::open(StringRef Path,
return H;
}
Expected<std::vector<ExecutorAddress>>
Expected<std::vector<ExecutorAddr>>
EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
const SymbolLookupSet &Lookup) {
Expected<std::vector<ExecutorAddress>> Result(
(std::vector<ExecutorAddress>()));
Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
if (auto Err =
EPC.callSPSWrapper<rt::SPSSimpleExecutorDylibManagerLookupSignature>(
SAs.Lookup.getValue(), Result, SAs.Instance, H, Lookup))
@ -93,11 +92,10 @@ EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
return Result;
}
Expected<std::vector<ExecutorAddress>>
Expected<std::vector<ExecutorAddr>>
EPCGenericDylibManager::lookup(tpctypes::DylibHandle H,
const RemoteSymbolLookupSet &Lookup) {
Expected<std::vector<ExecutorAddress>> Result(
(std::vector<ExecutorAddress>()));
Expected<std::vector<ExecutorAddr>> Result((std::vector<ExecutorAddr>()));
if (auto Err =
EPC.callSPSWrapper<rt::SPSSimpleExecutorDylibManagerLookupSignature>(
SAs.Lookup.getValue(), Result, SAs.Instance, H, Lookup))

View File

@ -20,13 +20,13 @@ class EPCGenericJITLinkMemoryManager::Alloc
public:
struct SegInfo {
char *WorkingMem = nullptr;
ExecutorAddress TargetAddr;
ExecutorAddr TargetAddr;
uint64_t ContentSize = 0;
uint64_t ZeroFillSize = 0;
};
using SegInfoMap = DenseMap<unsigned, SegInfo>;
Alloc(EPCGenericJITLinkMemoryManager &Parent, ExecutorAddress TargetAddr,
Alloc(EPCGenericJITLinkMemoryManager &Parent, ExecutorAddr TargetAddr,
std::unique_ptr<char[]> WorkingBuffer, SegInfoMap Segs)
: Parent(Parent), TargetAddr(TargetAddr),
WorkingBuffer(std::move(WorkingBuffer)), Segs(std::move(Segs)) {}
@ -75,14 +75,14 @@ public:
if (auto E2 = Parent.EPC.callSPSWrapper<
rt::SPSSimpleExecutorMemoryManagerDeallocateSignature>(
Parent.SAs.Deallocate.getValue(), Err, Parent.SAs.Allocator,
ArrayRef<ExecutorAddress>(TargetAddr)))
ArrayRef<ExecutorAddr>(TargetAddr)))
return E2;
return Err;
}
private:
EPCGenericJITLinkMemoryManager &Parent;
ExecutorAddress TargetAddr;
ExecutorAddr TargetAddr;
std::unique_ptr<char[]> WorkingBuffer;
SegInfoMap Segs;
};
@ -111,7 +111,7 @@ EPCGenericJITLinkMemoryManager::allocate(const jitlink::JITLinkDylib *JD,
std::unique_ptr<char[]> WorkingBuffer;
if (WorkingSize > 0)
WorkingBuffer = std::make_unique<char[]>(WorkingSize);
Expected<ExecutorAddress> TargetAllocAddr((ExecutorAddress()));
Expected<ExecutorAddr> TargetAllocAddr((ExecutorAddr()));
if (auto Err = EPC.callSPSWrapper<
rt::SPSSimpleExecutorMemoryManagerReserveSignature>(
SAs.Reserve.getValue(), TargetAllocAddr, SAs.Allocator, AllocSize))

View File

@ -36,8 +36,8 @@ SelfExecutorProcessControl::SelfExecutorProcessControl(
this->PageSize = PageSize;
this->MemMgr = OwnedMemMgr.get();
this->MemAccess = this;
this->JDI = {ExecutorAddress::fromPtr(jitDispatchViaWrapperFunctionManager),
ExecutorAddress::fromPtr(this)};
this->JDI = {ExecutorAddr::fromPtr(jitDispatchViaWrapperFunctionManager),
ExecutorAddr::fromPtr(this)};
if (this->TargetTriple.isOSBinFormatMachO())
GlobalManglingPrefix = '_';
}

View File

@ -16,7 +16,7 @@ namespace orc {
void lookupAndRecordAddrs(
unique_function<void(Error)> OnRecorded, ExecutionSession &ES, LookupKind K,
const JITDylibSearchOrder &SearchOrder,
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
SymbolLookupFlags LookupFlags) {
SymbolLookupSet Symbols;
@ -41,7 +41,7 @@ void lookupAndRecordAddrs(
Error lookupAndRecordAddrs(
ExecutionSession &ES, LookupKind K, const JITDylibSearchOrder &SearchOrder,
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
SymbolLookupFlags LookupFlags) {
std::promise<MSVCPError> ResultP;
@ -53,7 +53,7 @@ Error lookupAndRecordAddrs(
Error lookupAndRecordAddrs(
ExecutorProcessControl &EPC, tpctypes::DylibHandle H,
std::vector<std::pair<SymbolStringPtr, ExecutorAddress *>> Pairs,
std::vector<std::pair<SymbolStringPtr, ExecutorAddr *>> Pairs,
SymbolLookupFlags LookupFlags) {
SymbolLookupSet Symbols;

View File

@ -173,10 +173,10 @@ MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
// Add JIT-dispatch function support symbols.
if (auto Err = PlatformJD.define(absoluteSymbols(
{{ES.intern("___orc_rt_jit_dispatch"),
{EPC.getJITDispatchInfo().JITDispatchFunctionAddress.getValue(),
{EPC.getJITDispatchInfo().JITDispatchFunction.getValue(),
JITSymbolFlags::Exported}},
{ES.intern("___orc_rt_jit_dispatch_ctx"),
{EPC.getJITDispatchInfo().JITDispatchContextAddress.getValue(),
{EPC.getJITDispatchInfo().JITDispatchContext.getValue(),
JITSymbolFlags::Exported}}})))
return std::move(Err);
@ -322,13 +322,13 @@ Error MachOPlatform::associateRuntimeSupportFunctions(JITDylib &PlatformJD) {
this, &MachOPlatform::rt_getInitializers);
using GetDeinitializersSPSSig =
SPSExpected<SPSMachOJITDylibDeinitializerSequence>(SPSExecutorAddress);
SPSExpected<SPSMachOJITDylibDeinitializerSequence>(SPSExecutorAddr);
WFs[ES.intern("___orc_rt_macho_get_deinitializers_tag")] =
ES.wrapAsyncWithSPS<GetDeinitializersSPSSig>(
this, &MachOPlatform::rt_getDeinitializers);
using LookupSymbolSPSSig =
SPSExpected<SPSExecutorAddress>(SPSExecutorAddress, SPSString);
SPSExpected<SPSExecutorAddr>(SPSExecutorAddr, SPSString);
WFs[ES.intern("___orc_rt_macho_symbol_lookup_tag")] =
ES.wrapAsyncWithSPS<LookupSymbolSPSSig>(this,
&MachOPlatform::rt_lookupSymbol);
@ -412,7 +412,7 @@ void MachOPlatform::rt_getInitializers(SendInitializerSequenceFn SendResult,
}
void MachOPlatform::rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
ExecutorAddress Handle) {
ExecutorAddr Handle) {
LLVM_DEBUG({
dbgs() << "MachOPlatform::rt_getDeinitializers(\""
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
@ -442,8 +442,7 @@ void MachOPlatform::rt_getDeinitializers(SendDeinitializerSequenceFn SendResult,
}
void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
ExecutorAddress Handle,
StringRef SymbolName) {
ExecutorAddr Handle, StringRef SymbolName) {
LLVM_DEBUG({
dbgs() << "MachOPlatform::rt_lookupSymbol(\""
<< formatv("{0:x}", Handle.getValue()) << "\")\n";
@ -477,7 +476,7 @@ void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
void operator()(Expected<SymbolMap> Result) {
if (Result) {
assert(Result->size() == 1 && "Unexpected result map count");
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
SendResult(ExecutorAddr(Result->begin()->second.getAddress()));
} else {
SendResult(Result.takeError());
}
@ -531,7 +530,7 @@ Error MachOPlatform::bootstrapMachORuntime(JITDylib &PlatformJD) {
}
Error MachOPlatform::registerInitInfo(
JITDylib &JD, ExecutorAddress ObjCImageInfoAddr,
JITDylib &JD, ExecutorAddr ObjCImageInfoAddr,
ArrayRef<jitlink::Section *> InitSections) {
std::unique_lock<std::mutex> Lock(PlatformMutex);
@ -563,7 +562,7 @@ Error MachOPlatform::registerInitInfo(
// FIXME: Avoid copy here.
jitlink::SectionRange R(*Sec);
InitSeq->InitSections[Sec->getName()].push_back(
{ExecutorAddress(R.getStart()), ExecutorAddress(R.getEnd())});
{ExecutorAddr(R.getStart()), ExecutorAddr(R.getEnd())});
}
return Error::success();
@ -666,9 +665,9 @@ void MachOPlatform::MachOPlatformPlugin::addMachOHeaderSupportPasses(
JITTargetAddress HeaderAddr = (*I)->getAddress();
MP.HeaderAddrToJITDylib[HeaderAddr] = &JD;
assert(!MP.InitSeqs.count(&JD) && "InitSeq entry for JD already exists");
MP.InitSeqs.insert(
std::make_pair(&JD, MachOJITDylibInitializers(
JD.getName(), ExecutorAddress(HeaderAddr))));
MP.InitSeqs.insert(std::make_pair(
&JD,
MachOJITDylibInitializers(JD.getName(), ExecutorAddr(HeaderAddr))));
}
return Error::success();
});
@ -693,8 +692,8 @@ void MachOPlatform::MachOPlatformPlugin::addEHAndTLVSupportPasses(
if (auto *EHFrameSection = G.findSectionByName(EHFrameSectionName)) {
jitlink::SectionRange R(*EHFrameSection);
if (!R.empty())
POSR.EHFrameSection = {ExecutorAddress(R.getStart()),
ExecutorAddress(R.getEnd())};
POSR.EHFrameSection = {ExecutorAddr(R.getStart()),
ExecutorAddr(R.getEnd())};
}
// 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) {
jitlink::SectionRange R(*ThreadDataSection);
if (!R.empty())
POSR.ThreadDataSection = {ExecutorAddress(R.getStart()),
ExecutorAddress(R.getEnd())};
POSR.ThreadDataSection = {ExecutorAddr(R.getStart()),
ExecutorAddr(R.getEnd())};
}
if (POSR.EHFrameSection.StartAddress ||
POSR.ThreadDataSection.StartAddress) {
if (POSR.EHFrameSection.Start || POSR.ThreadDataSection.Start) {
// If we're still bootstrapping the runtime then just record this
// frame for now.
@ -860,7 +858,7 @@ Error MachOPlatform::MachOPlatformPlugin::processObjCImageInfo(
Error MachOPlatform::MachOPlatformPlugin::registerInitSections(
jitlink::LinkGraph &G, JITDylib &JD) {
ExecutorAddress ObjCImageInfoAddr;
ExecutorAddr ObjCImageInfoAddr;
SmallVector<jitlink::Section *> InitSections;
if (auto *ObjCImageInfoSec = G.findSectionByName(ObjCImageInfoSectionName)) {

View File

@ -85,7 +85,7 @@ FDSimpleRemoteEPCTransport::~FDSimpleRemoteEPCTransport() {
Error FDSimpleRemoteEPCTransport::sendMessage(SimpleRemoteEPCOpcode OpC,
uint64_t SeqNo,
ExecutorAddress TagAddr,
ExecutorAddr TagAddr,
ArrayRef<char> ArgBytes) {
char HeaderBuffer[FDMsgHeader::Size];
@ -210,7 +210,7 @@ void FDSimpleRemoteEPCTransport::listenLoop() {
uint64_t MsgSize;
SimpleRemoteEPCOpcode OpC;
uint64_t SeqNo;
ExecutorAddress TagAddr;
ExecutorAddr TagAddr;
MsgSize =
*((support::ulittle64_t *)(HeaderBuffer + FDMsgHeader::MsgSizeOffset));

View File

@ -46,7 +46,7 @@ Expected<int32_t> SimpleRemoteEPC::runAsMain(JITTargetAddress MainFnAddr,
ArrayRef<std::string> Args) {
int64_t Result = 0;
if (auto Err = callSPSWrapper<rt::SPSRunAsMainSignature>(
RunAsMainAddr.getValue(), Result, ExecutorAddress(MainFnAddr), Args))
RunAsMainAddr.getValue(), Result, ExecutorAddr(MainFnAddr), Args))
return std::move(Err);
return Result;
}
@ -63,7 +63,7 @@ void SimpleRemoteEPC::callWrapperAsync(SendResultFunction OnComplete,
}
if (auto Err = T->sendMessage(SimpleRemoteEPCOpcode::CallWrapper, SeqNo,
ExecutorAddress(WrapperFnAddr), ArgBuffer)) {
ExecutorAddr(WrapperFnAddr), ArgBuffer)) {
getExecutionSession().reportError(std::move(Err));
}
}
@ -76,7 +76,7 @@ Error SimpleRemoteEPC::disconnect() {
Expected<SimpleRemoteEPCTransportClient::HandleMessageAction>
SimpleRemoteEPC::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr,
ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
@ -143,7 +143,7 @@ SimpleRemoteEPC::createMemoryAccess() {
return nullptr;
}
Error SimpleRemoteEPC::handleSetup(uint64_t SeqNo, ExecutorAddress TagAddr,
Error SimpleRemoteEPC::handleSetup(uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
if (SeqNo != 0)
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);
if (auto Err = getBootstrapSymbols(
{{JDI.JITDispatchContextAddress, ExecutorSessionObjectName},
{JDI.JITDispatchFunctionAddress, DispatchFnName},
{{JDI.JITDispatchContext, ExecutorSessionObjectName},
{JDI.JITDispatchFunction, DispatchFnName},
{RunAsMainAddr, rt::RunAsMainWrapperName}}))
return Err;
@ -232,7 +232,7 @@ Error SimpleRemoteEPC::setup(std::unique_ptr<SimpleRemoteEPCTransport> T,
return Error::success();
}
Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
SendResultFunction SendResult;
@ -259,14 +259,14 @@ Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddress TagAddr,
}
void SimpleRemoteEPC::handleCallWrapper(
uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
assert(ES && "No ExecutionSession attached");
ES->runJITDispatchHandler(
[this, RemoteSeqNo](shared::WrapperFunctionResult WFR) {
if (auto Err =
T->sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
ExecutorAddress(), {WFR.data(), WFR.size()}))
ExecutorAddr(), {WFR.data(), WFR.size()}))
getExecutionSession().reportError(std::move(Err));
},
TagAddr.getValue(), ArgBytes);

View File

@ -95,7 +95,7 @@ static void registerJITLoaderGDBImpl(JITTargetAddress Addr, uint64_t Size) {
extern "C" orc::shared::detail::CWrapperFunctionResult
llvm_orc_registerJITLoaderGDBWrapper(const char *Data, uint64_t Size) {
using namespace orc::shared;
return WrapperFunction<void(SPSExecutorAddress, uint64_t)>::handle(
return WrapperFunction<void(SPSExecutorAddr, uint64_t)>::handle(
Data, Size, registerJITLoaderGDBImpl)
.release();
}

View File

@ -49,29 +49,29 @@ static llvm::orc::shared::detail::CWrapperFunctionResult
runAsMainWrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<rt::SPSRunAsMainSignature>::handle(
ArgData, ArgSize,
[](ExecutorAddress MainAddr,
[](ExecutorAddr MainAddr,
std::vector<std::string> Args) -> int64_t {
return runAsMain(MainAddr.toPtr<int (*)(int, char *[])>(), Args);
})
.release();
}
void addTo(StringMap<ExecutorAddress> &M) {
M[rt::MemoryWriteUInt8sWrapperName] = ExecutorAddress::fromPtr(
void addTo(StringMap<ExecutorAddr> &M) {
M[rt::MemoryWriteUInt8sWrapperName] = ExecutorAddr::fromPtr(
&writeUIntsWrapper<tpctypes::UInt8Write,
shared::SPSMemoryAccessUInt8Write>);
M[rt::MemoryWriteUInt16sWrapperName] = ExecutorAddress::fromPtr(
M[rt::MemoryWriteUInt16sWrapperName] = ExecutorAddr::fromPtr(
&writeUIntsWrapper<tpctypes::UInt16Write,
shared::SPSMemoryAccessUInt16Write>);
M[rt::MemoryWriteUInt32sWrapperName] = ExecutorAddress::fromPtr(
M[rt::MemoryWriteUInt32sWrapperName] = ExecutorAddr::fromPtr(
&writeUIntsWrapper<tpctypes::UInt32Write,
shared::SPSMemoryAccessUInt32Write>);
M[rt::MemoryWriteUInt64sWrapperName] = ExecutorAddress::fromPtr(
M[rt::MemoryWriteUInt64sWrapperName] = ExecutorAddr::fromPtr(
&writeUIntsWrapper<tpctypes::UInt64Write,
shared::SPSMemoryAccessUInt64Write>);
M[rt::MemoryWriteBuffersWrapperName] =
ExecutorAddress::fromPtr(&writeBuffersWrapper);
M[rt::RunAsMainWrapperName] = ExecutorAddress::fromPtr(&runAsMainWrapper);
ExecutorAddr::fromPtr(&writeBuffersWrapper);
M[rt::RunAsMainWrapperName] = ExecutorAddr::fromPtr(&runAsMainWrapper);
}
} // end namespace rt_bootstrap

View File

@ -27,7 +27,7 @@ namespace llvm {
namespace orc {
namespace rt_bootstrap {
void addTo(StringMap<ExecutorAddress> &M);
void addTo(StringMap<ExecutorAddr> &M);
} // namespace rt_bootstrap
} // end namespace orc

View File

@ -170,14 +170,14 @@ static Error deregisterEHFrameWrapper(JITTargetAddress Addr, uint64_t Size) {
extern "C" orc::shared::detail::CWrapperFunctionResult
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)
.release();
}
extern "C" orc::shared::detail::CWrapperFunctionResult
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)
.release();
}

View File

@ -39,10 +39,10 @@ SimpleExecutorDylibManager::open(const std::string &Path, uint64_t Mode) {
return NextId++;
}
Expected<std::vector<ExecutorAddress>>
Expected<std::vector<ExecutorAddr>>
SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
const RemoteSymbolLookupSet &L) {
std::vector<ExecutorAddress> Result;
std::vector<ExecutorAddr> Result;
std::lock_guard<std::mutex> Lock(M);
auto I = Dylibs.find(H);
@ -58,7 +58,7 @@ SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
return make_error<StringError>("Required address for empty symbol \"\"",
inconvertibleErrorCode());
else
Result.push_back(ExecutorAddress());
Result.push_back(ExecutorAddr());
} else {
const char *DemangledSymName = E.Name.c_str();
@ -76,7 +76,7 @@ SimpleExecutorDylibManager::lookup(tpctypes::DylibHandle H,
DemangledSymName,
inconvertibleErrorCode());
Result.push_back(ExecutorAddress::fromPtr(Addr));
Result.push_back(ExecutorAddr::fromPtr(Addr));
}
}
@ -96,13 +96,12 @@ Error SimpleExecutorDylibManager::shutdown() {
}
void SimpleExecutorDylibManager::addBootstrapSymbols(
StringMap<ExecutorAddress> &M) {
M[rt::SimpleExecutorDylibManagerInstanceName] =
ExecutorAddress::fromPtr(this);
StringMap<ExecutorAddr> &M) {
M[rt::SimpleExecutorDylibManagerInstanceName] = ExecutorAddr::fromPtr(this);
M[rt::SimpleExecutorDylibManagerOpenWrapperName] =
ExecutorAddress::fromPtr(&openWrapper);
ExecutorAddr::fromPtr(&openWrapper);
M[rt::SimpleExecutorDylibManagerLookupWrapperName] =
ExecutorAddress::fromPtr(&lookupWrapper);
ExecutorAddr::fromPtr(&lookupWrapper);
}
llvm::orc::shared::detail::CWrapperFunctionResult

View File

@ -21,7 +21,7 @@ SimpleExecutorMemoryManager::~SimpleExecutorMemoryManager() {
assert(Allocations.empty() && "shutdown not called?");
}
Expected<ExecutorAddress> SimpleExecutorMemoryManager::allocate(uint64_t Size) {
Expected<ExecutorAddr> SimpleExecutorMemoryManager::allocate(uint64_t Size) {
std::error_code EC;
auto MB = sys::Memory::allocateMappedMemory(
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);
assert(!Allocations.count(MB.base()) && "Duplicate allocation addr");
Allocations[MB.base()].Size = Size;
return ExecutorAddress::fromPtr(MB.base());
return ExecutorAddr::fromPtr(MB.base());
}
Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
ExecutorAddress Base(~0ULL);
ExecutorAddr Base(~0ULL);
std::vector<tpctypes::SupportFunctionCall> DeallocationActions;
size_t SuccessfulFinalizationActions = 0;
@ -58,7 +58,7 @@ Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
AllocSize = I->second.Size;
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
// completed finalization actions, then deallocate memory.
@ -106,7 +106,7 @@ Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
"exceeds segment size ({2:x} bytes)",
Seg.Addr.getValue(), Seg.Content.size(), Seg.Size),
inconvertibleErrorCode()));
ExecutorAddress SegEnd = Seg.Addr + ExecutorAddrDiff(Seg.Size);
ExecutorAddr SegEnd = Seg.Addr + ExecutorAddrDiff(Seg.Size);
if (LLVM_UNLIKELY(Seg.Addr < Base || SegEnd > AllocEnd))
return BailOut(make_error<StringError>(
formatv("Segment {0:x} -- {1:x} crosses boundary of "
@ -138,7 +138,7 @@ Error SimpleExecutorMemoryManager::finalize(tpctypes::FinalizeRequest &FR) {
}
Error SimpleExecutorMemoryManager::deallocate(
const std::vector<ExecutorAddress> &Bases) {
const std::vector<ExecutorAddr> &Bases) {
std::vector<std::pair<void *, Allocation>> AllocPairs;
AllocPairs.reserve(Bases.size());
@ -187,15 +187,14 @@ Error SimpleExecutorMemoryManager::shutdown() {
}
void SimpleExecutorMemoryManager::addBootstrapSymbols(
StringMap<ExecutorAddress> &M) {
M[rt::SimpleExecutorMemoryManagerInstanceName] =
ExecutorAddress::fromPtr(this);
StringMap<ExecutorAddr> &M) {
M[rt::SimpleExecutorMemoryManagerInstanceName] = ExecutorAddr::fromPtr(this);
M[rt::SimpleExecutorMemoryManagerReserveWrapperName] =
ExecutorAddress::fromPtr(&reserveWrapper);
ExecutorAddr::fromPtr(&reserveWrapper);
M[rt::SimpleExecutorMemoryManagerFinalizeWrapperName] =
ExecutorAddress::fromPtr(&finalizeWrapper);
ExecutorAddr::fromPtr(&finalizeWrapper);
M[rt::SimpleExecutorMemoryManagerDeallocateWrapperName] =
ExecutorAddress::fromPtr(&deallocateWrapper);
ExecutorAddr::fromPtr(&deallocateWrapper);
}
Error SimpleExecutorMemoryManager::deallocateImpl(void *Base, Allocation &A) {

View File

@ -51,15 +51,15 @@ void SimpleRemoteEPCServer::ThreadDispatcher::shutdown() {
}
#endif
StringMap<ExecutorAddress> SimpleRemoteEPCServer::defaultBootstrapSymbols() {
StringMap<ExecutorAddress> DBS;
StringMap<ExecutorAddr> SimpleRemoteEPCServer::defaultBootstrapSymbols() {
StringMap<ExecutorAddr> DBS;
rt_bootstrap::addTo(DBS);
return DBS;
}
Expected<SimpleRemoteEPCTransportClient::HandleMessageAction>
SimpleRemoteEPCServer::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo,
ExecutorAddress TagAddr,
ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
using UT = std::underlying_type_t<SimpleRemoteEPCOpcode>;
if (static_cast<UT>(OpC) > static_cast<UT>(SimpleRemoteEPCOpcode::LastOpC))
@ -124,7 +124,7 @@ void SimpleRemoteEPCServer::handleDisconnect(Error Err) {
}
Error SimpleRemoteEPCServer::sendSetupMessage(
StringMap<ExecutorAddress> BootstrapSymbols) {
StringMap<ExecutorAddr> BootstrapSymbols) {
using namespace SimpleRemoteEPCDefaultBootstrapSymbolNames;
@ -141,10 +141,8 @@ Error SimpleRemoteEPCServer::sendSetupMessage(
"Dispatch context name should not be set");
assert(!EI.BootstrapSymbols.count(DispatchFnName) &&
"Dispatch function name should not be set");
EI.BootstrapSymbols[ExecutorSessionObjectName] =
ExecutorAddress::fromPtr(this);
EI.BootstrapSymbols[DispatchFnName] =
ExecutorAddress::fromPtr(jitDispatchEntry);
EI.BootstrapSymbols[ExecutorSessionObjectName] = ExecutorAddr::fromPtr(this);
EI.BootstrapSymbols[DispatchFnName] = ExecutorAddr::fromPtr(jitDispatchEntry);
using SPSSerialize =
shared::SPSArgList<shared::SPSSimpleRemoteEPCExecutorInfo>;
@ -155,12 +153,12 @@ Error SimpleRemoteEPCServer::sendSetupMessage(
return make_error<StringError>("Could not send setup packet",
inconvertibleErrorCode());
return T->sendMessage(SimpleRemoteEPCOpcode::Setup, 0, ExecutorAddress(),
return T->sendMessage(SimpleRemoteEPCOpcode::Setup, 0, ExecutorAddr(),
{SetupPacketBytes.data(), SetupPacketBytes.size()});
}
Error SimpleRemoteEPCServer::handleResult(
uint64_t SeqNo, ExecutorAddress TagAddr,
uint64_t SeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
std::promise<shared::WrapperFunctionResult> *P = nullptr;
{
@ -181,7 +179,7 @@ Error SimpleRemoteEPCServer::handleResult(
}
void SimpleRemoteEPCServer::handleCallWrapper(
uint64_t RemoteSeqNo, ExecutorAddress TagAddr,
uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
SimpleRemoteEPCArgBytesVector ArgBytes) {
D->dispatch([this, RemoteSeqNo, TagAddr, ArgBytes = std::move(ArgBytes)]() {
using WrapperFnTy =
@ -190,7 +188,7 @@ void SimpleRemoteEPCServer::handleCallWrapper(
shared::WrapperFunctionResult ResultBytes(
Fn(ArgBytes.data(), ArgBytes.size()));
if (auto Err = T->sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
ExecutorAddress(),
ExecutorAddr(),
{ResultBytes.data(), ResultBytes.size()}))
ReportError(std::move(Err));
});
@ -215,7 +213,7 @@ SimpleRemoteEPCServer::doJITDispatch(const void *FnTag, const char *ArgData,
if (auto Err =
T->sendMessage(SimpleRemoteEPCOpcode::CallWrapper, SeqNo,
ExecutorAddress::fromPtr(FnTag), {ArgData, ArgSize}))
ExecutorAddr::fromPtr(FnTag), {ArgData, ArgSize}))
ReportError(std::move(Err));
return ResultF.get();

View File

@ -28,14 +28,14 @@ namespace {
class SimpleAllocator {
public:
Expected<ExecutorAddress> reserve(uint64_t Size) {
Expected<ExecutorAddr> reserve(uint64_t Size) {
std::error_code EC;
auto MB = sys::Memory::allocateMappedMemory(
Size, 0, sys::Memory::MF_READ | sys::Memory::MF_WRITE, EC);
if (EC)
return errorCodeToError(EC);
Blocks[MB.base()] = sys::OwningMemoryBlock(std::move(MB));
return ExecutorAddress::fromPtr(MB.base());
return ExecutorAddr::fromPtr(MB.base());
}
Error finalize(tpctypes::FinalizeRequest FR) {
@ -54,7 +54,7 @@ public:
return Error::success();
}
Error deallocate(std::vector<ExecutorAddress> &Bases) {
Error deallocate(std::vector<ExecutorAddr> &Bases) {
Error Err = Error::success();
for (auto &Base : Bases) {
auto I = Blocks.find(Base.toPtr<void *>());
@ -109,10 +109,10 @@ TEST(EPCGenericJITLinkMemoryManagerTest, AllocFinalizeFree) {
SimpleAllocator SA;
EPCGenericJITLinkMemoryManager::SymbolAddrs SAs;
SAs.Allocator = ExecutorAddress::fromPtr(&SA);
SAs.Reserve = ExecutorAddress::fromPtr(&testReserve);
SAs.Finalize = ExecutorAddress::fromPtr(&testFinalize);
SAs.Deallocate = ExecutorAddress::fromPtr(&testDeallocate);
SAs.Allocator = ExecutorAddr::fromPtr(&SA);
SAs.Reserve = ExecutorAddr::fromPtr(&testReserve);
SAs.Finalize = ExecutorAddr::fromPtr(&testFinalize);
SAs.Deallocate = ExecutorAddr::fromPtr(&testDeallocate);
auto MemMgr = std::make_unique<EPCGenericJITLinkMemoryManager>(*SelfEPC, SAs);
@ -129,7 +129,7 @@ TEST(EPCGenericJITLinkMemoryManagerTest, AllocFinalizeFree) {
auto Err = (*Alloc)->finalize();
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 *>();
EXPECT_NE(TargetMem, WorkingMem.data());

View File

@ -46,15 +46,15 @@ TEST(EPCGenericMemoryAccessTest, MemWrites) {
auto SelfEPC = cantFail(SelfExecutorProcessControl::Create());
EPCGenericMemoryAccess::FuncAddrs FAs;
FAs.WriteUInt8s = ExecutorAddress::fromPtr(
FAs.WriteUInt8s = ExecutorAddr::fromPtr(
&testWriteUInts<tpctypes::UInt8Write, SPSMemoryAccessUInt8Write>);
FAs.WriteUInt16s = ExecutorAddress::fromPtr(
FAs.WriteUInt16s = ExecutorAddr::fromPtr(
&testWriteUInts<tpctypes::UInt16Write, SPSMemoryAccessUInt16Write>);
FAs.WriteUInt32s = ExecutorAddress::fromPtr(
FAs.WriteUInt32s = ExecutorAddr::fromPtr(
&testWriteUInts<tpctypes::UInt32Write, SPSMemoryAccessUInt32Write>);
FAs.WriteUInt64s = ExecutorAddress::fromPtr(
FAs.WriteUInt64s = ExecutorAddr::fromPtr(
&testWriteUInts<tpctypes::UInt64Write, SPSMemoryAccessUInt64Write>);
FAs.WriteBuffers = ExecutorAddress::fromPtr(&testWriteBuffers);
FAs.WriteBuffers = ExecutorAddr::fromPtr(&testWriteBuffers);
auto MemAccess = std::make_unique<EPCGenericMemoryAccess>(*SelfEPC, FAs);

View File

@ -24,7 +24,7 @@ namespace {
TEST_F(LookupAndRecordAddrsTest, AsyncRequiredSuccess) {
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarSym}})));
ExecutorAddress FooAddress, BarAddress;
ExecutorAddr FooAddress, BarAddress;
std::promise<MSVCPError> ErrP;
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
@ -39,7 +39,7 @@ TEST_F(LookupAndRecordAddrsTest, AsyncRequiredSuccess) {
}
TEST_F(LookupAndRecordAddrsTest, AsyncRequiredFailure) {
ExecutorAddress FooAddress, BarAddress;
ExecutorAddr FooAddress, BarAddress;
std::promise<MSVCPError> ErrP;
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
@ -54,7 +54,7 @@ TEST_F(LookupAndRecordAddrsTest, AsyncRequiredFailure) {
TEST_F(LookupAndRecordAddrsTest, AsyncWeakReference) {
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
ExecutorAddress FooAddress, BarAddress;
ExecutorAddr FooAddress, BarAddress;
std::promise<MSVCPError> ErrP;
lookupAndRecordAddrs([&](Error Err) { ErrP.set_value(std::move(Err)); }, ES,
@ -72,7 +72,7 @@ TEST_F(LookupAndRecordAddrsTest, AsyncWeakReference) {
TEST_F(LookupAndRecordAddrsTest, BlockingRequiredSuccess) {
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}, {Bar, BarSym}})));
ExecutorAddress FooAddress, BarAddress;
ExecutorAddr FooAddress, BarAddress;
auto Err =
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
{{Foo, &FooAddress}, {Bar, &BarAddress}});
@ -83,7 +83,7 @@ TEST_F(LookupAndRecordAddrsTest, BlockingRequiredSuccess) {
}
TEST_F(LookupAndRecordAddrsTest, BlockingRequiredFailure) {
ExecutorAddress FooAddress, BarAddress;
ExecutorAddr FooAddress, BarAddress;
auto Err =
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
{{Foo, &FooAddress}, {Bar, &BarAddress}});
@ -94,7 +94,7 @@ TEST_F(LookupAndRecordAddrsTest, BlockingRequiredFailure) {
TEST_F(LookupAndRecordAddrsTest, BlockingWeakReference) {
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
ExecutorAddress FooAddress, BarAddress;
ExecutorAddr FooAddress, BarAddress;
auto Err =
lookupAndRecordAddrs(ES, LookupKind::Static, makeJITDylibSearchOrder(&JD),
{{Foo, &FooAddress}, {Bar, &BarAddress}},

View File

@ -22,9 +22,8 @@ namespace {
orc::shared::detail::CWrapperFunctionResult
incrementWrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<void(SPSExecutorAddress)>::handle(
ArgData, ArgSize,
[](ExecutorAddress A) { *A.toPtr<int *>() += 1; })
return WrapperFunction<void(SPSExecutorAddr)>::handle(
ArgData, ArgSize, [](ExecutorAddr A) { *A.toPtr<int *>() += 1; })
.release();
}
@ -40,14 +39,13 @@ TEST(SimpleExecutorMemoryManagerTest, AllocFinalizeFree) {
int FinalizeCounter = 0;
auto FinalizeCounterAddrArgBuffer =
orc::shared::detail::serializeViaSPSToWrapperFunctionResult<
SPSArgList<SPSExecutorAddress>>(
ExecutorAddress::fromPtr(&FinalizeCounter));
SPSArgList<SPSExecutorAddr>>(ExecutorAddr::fromPtr(&FinalizeCounter));
int DeallocateCounter = 0;
auto DeallocateCounterAddrArgBuffer =
orc::shared::detail::serializeViaSPSToWrapperFunctionResult<
SPSArgList<SPSExecutorAddress>>(
ExecutorAddress::fromPtr(&DeallocateCounter));
SPSArgList<SPSExecutorAddr>>(
ExecutorAddr::fromPtr(&DeallocateCounter));
tpctypes::FinalizeRequest FR;
FR.Segments.push_back(
@ -57,12 +55,12 @@ TEST(SimpleExecutorMemoryManagerTest, AllocFinalizeFree) {
{HW.data(), HW.size() + 1}});
FR.Actions.push_back(
{/* Finalize: */
{ExecutorAddress::fromPtr(incrementWrapper),
ExecutorAddress::fromPtr(FinalizeCounterAddrArgBuffer.data()),
{ExecutorAddr::fromPtr(incrementWrapper),
ExecutorAddr::fromPtr(FinalizeCounterAddrArgBuffer.data()),
FinalizeCounterAddrArgBuffer.size()},
/* Deallocate: */
{ExecutorAddress::fromPtr(incrementWrapper),
ExecutorAddress::fromPtr(DeallocateCounterAddrArgBuffer.data()),
{ExecutorAddr::fromPtr(incrementWrapper),
ExecutorAddr::fromPtr(DeallocateCounterAddrArgBuffer.data()),
DeallocateCounterAddrArgBuffer.size()}});
EXPECT_EQ(FinalizeCounter, 0);

View File

@ -79,7 +79,7 @@ static WrapperFunctionResult addWrapper(const char *ArgData, size_t ArgSize) {
static WrapperFunctionResult addMethodWrapper(const char *ArgData,
size_t ArgSize) {
return WrapperFunction<int32_t(SPSExecutorAddress, int32_t)>::handle(
return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
ArgData, ArgSize, makeMethodWrapperHandler(&AddClass::addMethod));
}
@ -97,8 +97,8 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionCallAndHandleRet) {
TEST(WrapperFunctionUtilsTest, WrapperFunctionMethodCallAndHandleRet) {
int32_t Result;
AddClass AddObj(1);
EXPECT_FALSE(!!WrapperFunction<int32_t(SPSExecutorAddress, int32_t)>::call(
addMethodWrapper, Result, ExecutorAddress::fromPtr(&AddObj), 2));
EXPECT_FALSE(!!WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::call(
addMethodWrapper, Result, ExecutorAddr::fromPtr(&AddObj), 2));
EXPECT_EQ(Result, (int32_t)3);
}