[compiler-rt] [scudo] Refactor store() and retrieve(). (PR #102024)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 11:48:33 PDT 2024


================
@@ -692,8 +711,10 @@ void *MapAllocator<Config>::allocate(const Options &Options, uptr Size,
   if (Alignment < PageSize && Cache.canCache(MinNeededSizeForCache)) {
     LargeBlock::Header *H;
     bool Zeroed;
-    if (Cache.retrieve(Options, Size, Alignment, getHeadersSize(), &H,
-                       &Zeroed)) {
+
+    H = tryAllocateFromCache(Options, Size, Alignment, getHeadersSize(),
+                             Zeroed);
+    if (H != nullptr) {
----------------
ChiaHungDuan wrote:

Can we also do this in `tryAllocateFromCache`? 
```
void *Ptr = tryAllocateFromCache(...);
if (!Ptr)
  return Ptr;
 
// .. the remaining logic
```

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


More information about the llvm-commits mailing list