[llvm] [ORC] Add opt-in per-JITDylib colocating slab allocator (PR #207970)
Jared Wyles via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 20:09:42 PDT 2026
================
@@ -136,6 +193,13 @@ void MapperJITLinkMemoryManager::allocate(const JITLinkDylib *JD, LinkGraph &G,
}
if (SelectedRange.empty()) { // no already reserved range was found
+ // A reservation is needed. If this pool already owns one, reserving another
+ // ("second slab") may place its objects out of range, so consult the
+ // growth policy first.
+ if (!ReservedKeys.insert(PoolKey).second) {
+ if (auto Err = OnSecondSlab())
+ return CompleteAllocation(std::move(Err));
+ }
auto TotalAllocation = alignTo(TotalSize, ReservationUnits);
Mapper->reserve(TotalAllocation, std::move(CompleteAllocation));
----------------
jaredwy wrote:
I also suspect that there is a race condition here but @lhames maybe better to answer that, as im not 100% sure on the threading involved here. However allocate takes a lock, but nothing prevents an update to the policy while under this lock.
https://github.com/llvm/llvm-project/pull/207970
More information about the llvm-commits
mailing list