[PATCH] D132313: [Orc] Memory Mapper fixes

Anubhab Ghosh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 20 20:27:50 PDT 2022


argentite added a comment.

In D132313#3737642 <https://reviews.llvm.org/D132313#3737642>, @lhames wrote:

>> By the time SharedMemoryMapper destructor is called, the RPC
>> connection is no longer available causing the release() call to
>> always fail. Instead at this point only shared memory regions
>> can be unmapped safely.
>
> I think that you can assert that there are no remaining allocations in the destructor -- these should all have been destroyed by a call to `endSession()`, which should happen before the allocator is destroyed.

We don't keep track of allocations in the controller process other than through the `FinalizedAlloc` class. That needs to be `release()`'d which is done only after deinitializing at `MapperJITLinkMemoryManager::deallocate()`. So I guess we are safe there.



================
Comment at: llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp:305-308
+  auto Reservation = std::lower_bound(
+      Reservations.rbegin(), Reservations.rend(), AI.MappingBase,
+      [](const auto &A, const auto &B) { return A.first > B; });
+  assert(Reservation != Reservations.rend() && "Attempt to initialize unreserved range");
----------------
lhames wrote:
> So `MappingBase` is the lowest allocated address for this allocation?
Yes it is actually the address that the slab allocator returns which may start at the middle of a reservation. We use this address as the identifier for this allocation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132313/new/

https://reviews.llvm.org/D132313



More information about the llvm-commits mailing list