[compiler-rt] [scudo] Refactor store() and retrieve(). (PR #102024)
Christopher Ferris via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 17:59:48 PDT 2024
================
@@ -665,6 +646,61 @@ template <typename Config> class MapAllocator {
LocalStats Stats GUARDED_BY(Mutex);
};
+template <typename Config>
+void *
+MapAllocator<Config>::tryAllocateFromCache(const Options &Options, uptr Size,
+ uptr Alignment, uptr *BlockEndPtr,
+ FillContentsMode FillContents) {
+ CachedBlock Entry;
+ uptr EntryHeaderPos;
+
+ Entry = Cache.retrieve(Size, Alignment, getHeadersSize(), EntryHeaderPos);
+ if (!Entry.isValid())
+ return nullptr;
+
+ LargeBlock::Header *H = reinterpret_cast<LargeBlock::Header *>(
+ LargeBlock::addHeaderTag<Config>(EntryHeaderPos));
+ bool Zeroed = Entry.Time == 0;
+ if (useMemoryTagging<Config>(Options))
----------------
cferris1000 wrote:
I know you inherited this from the previous version of the code, but I believe you can move the call below to the useMemoryTagging check below this and also, the NewBlockBegin is only used in that block, so it can be moved in their too.
https://github.com/llvm/llvm-project/pull/102024
More information about the llvm-commits
mailing list