[llvm] 999c6a2 - Reapply e32b1eee6aa "[ORC] Change SPSExecutorAddr serialization,..." with fixes.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 28 16:54:46 PDT 2021
Author: Lang Hames
Date: 2021-10-28T16:40:25-07:00
New Revision: 999c6a235e1655239fde25c77ab4bdc9a8684c1b
URL: https://github.com/llvm/llvm-project/commit/999c6a235e1655239fde25c77ab4bdc9a8684c1b
DIFF: https://github.com/llvm/llvm-project/commit/999c6a235e1655239fde25c77ab4bdc9a8684c1b.diff
LOG: Reapply e32b1eee6aa "[ORC] Change SPSExecutorAddr serialization,..." with fixes.
This re-applies e32b1eee6aab52e2b7b75ee15e506b3e7dd30e68, which was reverted in
20675d8f7dab293172266fdde426c2173b5b3997 due to broken unit tests. This patch
includes fixes for the tests.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h
llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
llvm/lib/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.cpp
llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp
llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
index 6b795799a961f..3c0b2b9edd52e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
@@ -160,6 +160,8 @@ struct ExecutorAddrRange {
namespace shared {
+class SPSExecutorAddr {};
+
/// SPS serializatior for ExecutorAddr.
template <> class SPSSerializationTraits<SPSExecutorAddr, ExecutorAddr> {
public:
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
index 570c11e25897f..9ac13a493e9d2 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
@@ -195,13 +195,6 @@ template <typename SPSElementTagT> class SPSSequence;
/// SPS tag type for strings, which are equivalent to sequences of chars.
using SPSString = SPSSequence<char>;
-/// SPS tag type for executor addresseses.
-class SPSExecutorAddr {};
-
-template <>
-class SPSSerializationTraits<SPSExecutorAddr, uint64_t>
- : public SPSSerializationTraits<uint64_t, uint64_t> {};
-
/// SPS tag type for maps.
///
/// SPS maps are just sequences of (Key, Value) tuples.
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h
index a7de07cbeb99b..fc70c46df231f 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h
@@ -73,12 +73,19 @@ struct SupportFunctionCall {
using FnTy = shared::detail::CWrapperFunctionResult(const char *ArgData,
size_t ArgSize);
ExecutorAddr Func;
- ExecutorAddr ArgData;
- uint64_t ArgSize;
+ ExecutorAddrRange ArgDataRange;
+
+ SupportFunctionCall() = default;
+ SupportFunctionCall(ExecutorAddr Func, ExecutorAddr ArgData,
+ ExecutorAddrDiff ArgSize)
+ : Func(Func), ArgDataRange(ArgData, ArgSize) {}
+ SupportFunctionCall(ExecutorAddr Func, ExecutorAddrRange ArgDataRange)
+ : Func(Func), ArgDataRange(ArgDataRange) {}
Error run() {
- shared::WrapperFunctionResult WFR(
- Func.toPtr<FnTy *>()(ArgData.toPtr<const char *>(), ArgSize));
+ shared::WrapperFunctionResult WFR(Func.toPtr<FnTy *>()(
+ ArgDataRange.Start.toPtr<const char *>(),
+ static_cast<size_t>(ArgDataRange.size().getValue())));
if (const char *ErrMsg = WFR.getOutOfBandError())
return make_error<StringError>(ErrMsg, inconvertibleErrorCode());
if (!WFR.empty())
@@ -108,10 +115,9 @@ struct FinalizeRequest {
template <typename T> struct UIntWrite {
UIntWrite() = default;
- UIntWrite(JITTargetAddress Address, T Value)
- : Address(Address), Value(Value) {}
+ UIntWrite(ExecutorAddr Addr, T Value) : Addr(Addr), Value(Value) {}
- JITTargetAddress Address = 0;
+ ExecutorAddr Addr;
T Value = 0;
};
@@ -131,10 +137,10 @@ using UInt64Write = UIntWrite<uint64_t>;
/// For use with TargetProcessControl::MemoryAccess objects.
struct BufferWrite {
BufferWrite() = default;
- BufferWrite(JITTargetAddress Address, StringRef Buffer)
- : Address(Address), Buffer(Buffer) {}
+ BufferWrite(ExecutorAddr Addr, StringRef Buffer)
+ : Addr(Addr), Buffer(Buffer) {}
- JITTargetAddress Address = 0;
+ ExecutorAddr Addr;
StringRef Buffer;
};
@@ -149,8 +155,7 @@ namespace shared {
class SPSMemoryProtectionFlags {};
-using SPSSupportFunctionCall =
- SPSTuple<SPSExecutorAddr, SPSExecutorAddr, uint64_t>;
+using SPSSupportFunctionCall = SPSTuple<SPSExecutorAddr, SPSExecutorAddrRange>;
using SPSSegFinalizeRequest =
SPSTuple<SPSMemoryProtectionFlags, SPSExecutorAddr, uint64_t,
@@ -202,17 +207,17 @@ class SPSSerializationTraits<SPSSupportFunctionCall,
public:
static size_t size(const tpctypes::SupportFunctionCall &SFC) {
- return AL::size(SFC.Func, SFC.ArgData, SFC.ArgSize);
+ return AL::size(SFC.Func, SFC.ArgDataRange);
}
static bool serialize(SPSOutputBuffer &OB,
const tpctypes::SupportFunctionCall &SFC) {
- return AL::serialize(OB, SFC.Func, SFC.ArgData, SFC.ArgSize);
+ return AL::serialize(OB, SFC.Func, SFC.ArgDataRange);
}
static bool deserialize(SPSInputBuffer &IB,
tpctypes::SupportFunctionCall &SFC) {
- return AL::deserialize(IB, SFC.Func, SFC.ArgData, SFC.ArgSize);
+ return AL::deserialize(IB, SFC.Func, SFC.ArgDataRange);
}
};
@@ -282,16 +287,16 @@ class SPSSerializationTraits<SPSMemoryAccessUIntWrite<T>,
tpctypes::UIntWrite<T>> {
public:
static size_t size(const tpctypes::UIntWrite<T> &W) {
- return SPSTuple<SPSExecutorAddr, T>::AsArgList::size(W.Address, W.Value);
+ return SPSTuple<SPSExecutorAddr, T>::AsArgList::size(W.Addr, W.Value);
}
static bool serialize(SPSOutputBuffer &OB, const tpctypes::UIntWrite<T> &W) {
- return SPSTuple<SPSExecutorAddr, T>::AsArgList::serialize(OB, W.Address,
+ return SPSTuple<SPSExecutorAddr, T>::AsArgList::serialize(OB, W.Addr,
W.Value);
}
static bool deserialize(SPSInputBuffer &IB, tpctypes::UIntWrite<T> &W) {
- return SPSTuple<SPSExecutorAddr, T>::AsArgList::deserialize(IB, W.Address,
+ return SPSTuple<SPSExecutorAddr, T>::AsArgList::deserialize(IB, W.Addr,
W.Value);
}
};
@@ -302,17 +307,17 @@ class SPSSerializationTraits<SPSMemoryAccessBufferWrite,
public:
static size_t size(const tpctypes::BufferWrite &W) {
return SPSTuple<SPSExecutorAddr, SPSSequence<char>>::AsArgList::size(
- W.Address, W.Buffer);
+ W.Addr, W.Buffer);
}
static bool serialize(SPSOutputBuffer &OB, const tpctypes::BufferWrite &W) {
return SPSTuple<SPSExecutorAddr, SPSSequence<char>>::AsArgList ::serialize(
- OB, W.Address, W.Buffer);
+ OB, W.Addr, W.Buffer);
}
static bool deserialize(SPSInputBuffer &IB, tpctypes::BufferWrite &W) {
return SPSTuple<SPSExecutorAddr,
- SPSSequence<char>>::AsArgList ::deserialize(IB, W.Address,
+ SPSSequence<char>>::AsArgList ::deserialize(IB, W.Addr,
W.Buffer);
}
};
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
index 4e0323b9ca0d1..4c0fab8aa9fa5 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
@@ -59,14 +59,14 @@ EPCEHFrameRegistrar::Create(ExecutionSession &ES) {
Error EPCEHFrameRegistrar::registerEHFrames(JITTargetAddress EHFrameSectionAddr,
size_t EHFrameSectionSize) {
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
- RegisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
+ RegisterEHFrameWrapperFnAddr, ExecutorAddr(EHFrameSectionAddr),
static_cast<uint64_t>(EHFrameSectionSize));
}
Error EPCEHFrameRegistrar::deregisterEHFrames(
JITTargetAddress EHFrameSectionAddr, size_t EHFrameSectionSize) {
return ES.callSPSWrapper<void(SPSExecutorAddr, uint64_t)>(
- DeregisterEHFrameWrapperFnAddr, EHFrameSectionAddr,
+ DeregisterEHFrameWrapperFnAddr, ExecutorAddr(EHFrameSectionAddr),
static_cast<uint64_t>(EHFrameSectionSize));
}
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp b/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
index 005ba14794d1a..9b712cb8f7caf 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
@@ -60,11 +60,12 @@ class EPCGenericJITLinkMemoryManager::InFlightAlloc
// turn this into a std::swap.
FR.Actions.reserve(G.allocActions().size());
for (auto &ActPair : G.allocActions())
- FR.Actions.push_back(
- {{ExecutorAddr(ActPair.Finalize.FnAddr),
- ExecutorAddr(ActPair.Finalize.CtxAddr), ActPair.Finalize.CtxSize},
- {ExecutorAddr(ActPair.Dealloc.FnAddr),
- ExecutorAddr(ActPair.Dealloc.CtxAddr), ActPair.Dealloc.CtxSize}});
+ FR.Actions.push_back({{ExecutorAddr(ActPair.Finalize.FnAddr),
+ {ExecutorAddr(ActPair.Finalize.CtxAddr),
+ ExecutorAddrDiff(ActPair.Finalize.CtxSize)}},
+ {ExecutorAddr(ActPair.Dealloc.FnAddr),
+ {ExecutorAddr(ActPair.Dealloc.CtxAddr),
+ ExecutorAddrDiff(ActPair.Dealloc.CtxSize)}}});
G.allocActions().clear();
Parent.EPC.callSPSWrapperAsync<
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.cpp b/llvm/lib/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.cpp
index 944b66422a24f..1d98e104a4d77 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCGenericRTDyldMemoryManager.cpp
@@ -262,8 +262,11 @@ bool EPCGenericRTDyldMemoryManager::finalizeMemory(std::string *ErrMsg) {
}
for (auto &Frame : ObjAllocs.UnfinalizedEHFrames)
- FR.Actions.push_back({{SAs.RegisterEHFrame, Frame.Addr, Frame.Size},
- {SAs.DeregisterEHFrame, Frame.Addr, Frame.Size}});
+ FR.Actions.push_back(
+ {{SAs.RegisterEHFrame,
+ {ExecutorAddr(Frame.Addr), ExecutorAddrDiff(Frame.Size)}},
+ {SAs.DeregisterEHFrame,
+ {ExecutorAddr(Frame.Addr), ExecutorAddrDiff(Frame.Size)}}});
// We'll also need to make an extra allocation for the eh-frame wrapper call
// arguments.
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
index a08f29c29f2f0..818b6b52ff83d 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
@@ -161,16 +161,18 @@ Error EPCIndirectStubsManager::createStubs(const StubInitsMap &StubInits) {
unsigned ASIdx = 0;
std::vector<tpctypes::UInt32Write> PtrUpdates;
for (auto &SI : StubInits)
- PtrUpdates.push_back({(*AvailableStubInfos)[ASIdx++].PointerAddress,
- static_cast<uint32_t>(SI.second.first)});
+ PtrUpdates.push_back(
+ {ExecutorAddr((*AvailableStubInfos)[ASIdx++].PointerAddress),
+ static_cast<uint32_t>(SI.second.first)});
return MemAccess.writeUInt32s(PtrUpdates);
}
case 8: {
unsigned ASIdx = 0;
std::vector<tpctypes::UInt64Write> PtrUpdates;
for (auto &SI : StubInits)
- PtrUpdates.push_back({(*AvailableStubInfos)[ASIdx++].PointerAddress,
- static_cast<uint64_t>(SI.second.first)});
+ PtrUpdates.push_back(
+ {ExecutorAddr((*AvailableStubInfos)[ASIdx++].PointerAddress),
+ static_cast<uint64_t>(SI.second.first)});
return MemAccess.writeUInt64s(PtrUpdates);
}
default:
@@ -212,11 +214,11 @@ Error EPCIndirectStubsManager::updatePointer(StringRef Name,
auto &MemAccess = EPCIU.getExecutorProcessControl().getMemoryAccess();
switch (EPCIU.getABISupport().getPointerSize()) {
case 4: {
- tpctypes::UInt32Write PUpdate(PtrAddr, NewAddr);
+ tpctypes::UInt32Write PUpdate(ExecutorAddr(PtrAddr), NewAddr);
return MemAccess.writeUInt32s(PUpdate);
}
case 8: {
- tpctypes::UInt64Write PUpdate(PtrAddr, NewAddr);
+ tpctypes::UInt64Write PUpdate(ExecutorAddr(PtrAddr), NewAddr);
return MemAccess.writeUInt64s(PUpdate);
}
default:
diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp
index 1c3d728409fef..b5435293da13c 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp
@@ -138,36 +138,35 @@ Error SelfExecutorProcessControl::disconnect() {
void SelfExecutorProcessControl::writeUInt8sAsync(
ArrayRef<tpctypes::UInt8Write> Ws, WriteResultFn OnWriteComplete) {
for (auto &W : Ws)
- *jitTargetAddressToPointer<uint8_t *>(W.Address) = W.Value;
+ *W.Addr.toPtr<uint8_t *>() = W.Value;
OnWriteComplete(Error::success());
}
void SelfExecutorProcessControl::writeUInt16sAsync(
ArrayRef<tpctypes::UInt16Write> Ws, WriteResultFn OnWriteComplete) {
for (auto &W : Ws)
- *jitTargetAddressToPointer<uint16_t *>(W.Address) = W.Value;
+ *W.Addr.toPtr<uint16_t *>() = W.Value;
OnWriteComplete(Error::success());
}
void SelfExecutorProcessControl::writeUInt32sAsync(
ArrayRef<tpctypes::UInt32Write> Ws, WriteResultFn OnWriteComplete) {
for (auto &W : Ws)
- *jitTargetAddressToPointer<uint32_t *>(W.Address) = W.Value;
+ *W.Addr.toPtr<uint32_t *>() = W.Value;
OnWriteComplete(Error::success());
}
void SelfExecutorProcessControl::writeUInt64sAsync(
ArrayRef<tpctypes::UInt64Write> Ws, WriteResultFn OnWriteComplete) {
for (auto &W : Ws)
- *jitTargetAddressToPointer<uint64_t *>(W.Address) = W.Value;
+ *W.Addr.toPtr<uint64_t *>() = W.Value;
OnWriteComplete(Error::success());
}
void SelfExecutorProcessControl::writeBuffersAsync(
ArrayRef<tpctypes::BufferWrite> Ws, WriteResultFn OnWriteComplete) {
for (auto &W : Ws)
- memcpy(jitTargetAddressToPointer<char *>(W.Address), W.Buffer.data(),
- W.Buffer.size());
+ memcpy(W.Addr.toPtr<char *>(), W.Buffer.data(), W.Buffer.size());
OnWriteComplete(Error::success());
}
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
index 356bb0be33f0d..c74186b0fc2c0 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
@@ -28,8 +28,7 @@ writeUIntsWrapper(const char *ArgData, size_t ArgSize) {
ArgData, ArgSize,
[](std::vector<WriteT> Ws) {
for (auto &W : Ws)
- *jitTargetAddressToPointer<decltype(W.Value) *>(W.Address) =
- W.Value;
+ *W.Addr.template toPtr<decltype(W.Value) *>() = W.Value;
})
.release();
}
@@ -40,8 +39,8 @@ writeBuffersWrapper(const char *ArgData, size_t ArgSize) {
ArgData, ArgSize,
[](std::vector<tpctypes::BufferWrite> Ws) {
for (auto &W : Ws)
- memcpy(jitTargetAddressToPointer<char *>(W.Address),
- W.Buffer.data(), W.Buffer.size());
+ memcpy(W.Addr.template toPtr<char *>(), W.Buffer.data(),
+ W.Buffer.size());
})
.release();
}
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
index ee67e61358b24..89d2807e0a462 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
@@ -176,14 +176,12 @@ llvm_orc_deregisterEHFrameSectionCustomDirectWrapper(
return llvm::orc::shared::detail::CWrapperFunctionResult();
}
-static Error registerEHFrameWrapper(JITTargetAddress Addr, uint64_t Size) {
- return llvm::orc::registerEHFrameSection(
- jitTargetAddressToPointer<const void *>(Addr), Size);
+static Error registerEHFrameWrapper(ExecutorAddr Addr, uint64_t Size) {
+ return llvm::orc::registerEHFrameSection(Addr.toPtr<const void *>(), Size);
}
-static Error deregisterEHFrameWrapper(JITTargetAddress Addr, uint64_t Size) {
- return llvm::orc::deregisterEHFrameSection(
- jitTargetAddressToPointer<const void *>(Addr), Size);
+static Error deregisterEHFrameWrapper(ExecutorAddr Addr, uint64_t Size) {
+ return llvm::orc::deregisterEHFrameSection(Addr.toPtr<const void *>(), Size);
}
extern "C" orc::shared::detail::CWrapperFunctionResult
diff --git a/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp b/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
index beb0fefa094ae..ec594909b890a 100644
--- a/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
@@ -24,8 +24,7 @@ testWriteUInts(const char *ArgData, size_t ArgSize) {
ArgData, ArgSize,
[](std::vector<WriteT> Ws) {
for (auto &W : Ws)
- *jitTargetAddressToPointer<decltype(W.Value) *>(W.Address) =
- W.Value;
+ *W.Addr.template toPtr<decltype(W.Value) *>() = W.Value;
})
.release();
}
@@ -36,8 +35,8 @@ testWriteBuffers(const char *ArgData, size_t ArgSize) {
ArgData, ArgSize,
[](std::vector<tpctypes::BufferWrite> Ws) {
for (auto &W : Ws)
- memcpy(jitTargetAddressToPointer<char *>(W.Address),
- W.Buffer.data(), W.Buffer.size());
+ memcpy(W.Addr.template toPtr<char *>(), W.Buffer.data(),
+ W.Buffer.size());
})
.release();
}
@@ -65,32 +64,32 @@ TEST(EPCGenericMemoryAccessTest, MemWrites) {
uint64_t Test_UInt64 = 0;
char Test_Buffer[21];
- auto Err1 = MemAccess->writeUInt8s(
- {{pointerToJITTargetAddress(&Test_UInt8_1), 1},
- {pointerToJITTargetAddress(&Test_UInt8_2), 0xFE}});
+ auto Err1 =
+ MemAccess->writeUInt8s({{ExecutorAddr::fromPtr(&Test_UInt8_1), 1},
+ {ExecutorAddr::fromPtr(&Test_UInt8_2), 0xFE}});
EXPECT_THAT_ERROR(std::move(Err1), Succeeded());
EXPECT_EQ(Test_UInt8_1, 1U);
EXPECT_EQ(Test_UInt8_2, 0xFE);
auto Err2 =
- MemAccess->writeUInt16s({{pointerToJITTargetAddress(&Test_UInt16), 1}});
+ MemAccess->writeUInt16s({{ExecutorAddr::fromPtr(&Test_UInt16), 1}});
EXPECT_THAT_ERROR(std::move(Err2), Succeeded());
EXPECT_EQ(Test_UInt16, 1U);
auto Err3 =
- MemAccess->writeUInt32s({{pointerToJITTargetAddress(&Test_UInt32), 1}});
+ MemAccess->writeUInt32s({{ExecutorAddr::fromPtr(&Test_UInt32), 1}});
EXPECT_THAT_ERROR(std::move(Err3), Succeeded());
EXPECT_EQ(Test_UInt32, 1U);
auto Err4 =
- MemAccess->writeUInt64s({{pointerToJITTargetAddress(&Test_UInt64), 1}});
+ MemAccess->writeUInt64s({{ExecutorAddr::fromPtr(&Test_UInt64), 1}});
EXPECT_THAT_ERROR(std::move(Err4), Succeeded());
EXPECT_EQ(Test_UInt64, 1U);
StringRef TestMsg("test-message");
- auto Err5 = MemAccess->writeBuffers(
- {{pointerToJITTargetAddress(&Test_Buffer), TestMsg}});
+ auto Err5 =
+ MemAccess->writeBuffers({{ExecutorAddr::fromPtr(&Test_Buffer), TestMsg}});
EXPECT_THAT_ERROR(std::move(Err5), Succeeded());
EXPECT_EQ(StringRef(Test_Buffer, TestMsg.size()), TestMsg);
diff --git a/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
index 050b41c2f6b43..238592fa377d6 100644
--- a/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
@@ -56,12 +56,12 @@ TEST(SimpleExecutorMemoryManagerTest, AllocFinalizeFree) {
FR.Actions.push_back(
{/* Finalize: */
{ExecutorAddr::fromPtr(incrementWrapper),
- ExecutorAddr::fromPtr(FinalizeCounterAddrArgBuffer.data()),
- FinalizeCounterAddrArgBuffer.size()},
+ {ExecutorAddr::fromPtr(FinalizeCounterAddrArgBuffer.data()),
+ ExecutorAddrDiff(FinalizeCounterAddrArgBuffer.size())}},
/* Deallocate: */
{ExecutorAddr::fromPtr(incrementWrapper),
- ExecutorAddr::fromPtr(DeallocateCounterAddrArgBuffer.data()),
- DeallocateCounterAddrArgBuffer.size()}});
+ {ExecutorAddr::fromPtr(DeallocateCounterAddrArgBuffer.data()),
+ ExecutorAddrDiff(DeallocateCounterAddrArgBuffer.size())}}});
EXPECT_EQ(FinalizeCounter, 0);
EXPECT_EQ(DeallocateCounter, 0);
More information about the llvm-commits
mailing list