Skip to content

Commit 349e5bd

Browse files
committed
[ORC] Update mapper deinitialize functions to deinitialize in reverse order.
This updates the ExecutorSharedMemoryMapperService::deinitialize and InProcessMemoryMapper::deinitialize methods to deinitialize in reverse order, bringing them into alignment with the behavior of InProcessMemoryManager::deallocate and SimpleExecutorMemoryManager::deallocate. Reverse deinitialization is required because later allocations can depend on earlier ones. This fixes failures in the ORC runtime test suite.
1 parent c173c04 commit 349e5bd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void InProcessMemoryMapper::deinitialize(
110110
{
111111
std::lock_guard<std::mutex> Lock(Mutex);
112112

113-
for (auto Base : Bases) {
113+
for (auto Base : llvm::reverse(Bases)) {
114114

115115
if (Error Err = shared::runDeallocActions(
116116
Allocations[Base].DeinitializationActions)) {

llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Error ExecutorSharedMemoryMapperService::deinitialize(
192192
{
193193
std::lock_guard<std::mutex> Lock(Mutex);
194194

195-
for (auto Base : Bases) {
195+
for (auto Base : llvm::reverse(Bases)) {
196196
if (Error Err = shared::runDeallocActions(
197197
Allocations[Base].DeinitializationActions)) {
198198
AllErr = joinErrors(std::move(AllErr), std::move(Err));

0 commit comments

Comments
 (0)