[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:

If this reserve fails, nothing appears to remove the PooKey entry in ReservedKeys. 

https://github.com/llvm/llvm-project/pull/207970


More information about the llvm-commits mailing list