[PATCH] D132313: [Orc] Memory Mapper fixes

Anubhab Ghosh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 20 15:17:56 PDT 2022


argentite created this revision.
Herald added subscribers: hiraditya, krytarowski.
Herald added a project: All.
argentite retitled this revision from "[Orc] Actually save the callback" to "[Orc] Memory Mapper fixes".
argentite edited the summary of this revision.
argentite added reviewers: lhames, sgraenitz.
argentite published this revision for review.
Herald added subscribers: llvm-commits, StephenFan.
Herald added a project: LLVM.

[Orc] Actually save the callback

The callback function was captured by reference but it lived on the
stack and was in danger of being overwritten and could cause a crash.

[Orc] Only unmap shared memory in controller process destructor

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.

Deinitializers are called and mapped memory is released at the
executor side by ExecutorSharedMemoryMapperService::shutdown()
instead. Memory can also be released earlier by calling release()
earlier before RPC connection is closed.

[Orc] Provide correct Reservation address for slab allocations

When slab allocator is used, the MappingBase is not necessarily
the same as the original reservation base as the allocation could
be a part of the whole reservation.

In this case the original reservation address needs to be passed to
ExecutorSharedMemoryMapperService to associate the new allocation
with the original reservation.

[Orc] Improve deintialize and shutdown logic

When deinitializing, the allocation needs to be removed from the
allocation list of its associated reservation so that remaining
allocations can be deinitialized when releasing the reservation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132313

Files:
  llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp
  llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
  llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132313.454253.patch
Type: text/x-patch
Size: 4722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220820/cf006563/attachment.bin>


More information about the llvm-commits mailing list