[compiler-rt] [scudo] Use MemMap in BufferPool and RegionPageMap (PR #66788)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 14:56:57 PDT 2023
================
@@ -130,53 +143,33 @@ class BufferPool {
if (index >= StaticBufferCount)
return getDynamicBuffer(NumElements);
- const uptr Offset = index * StaticBufferNumElements;
- memset(&RawBuffer[Offset], 0, StaticBufferNumElements * sizeof(uptr));
- return &RawBuffer[Offset];
+ Buffer Buf;
+ Buf.Data = &RawBuffer[index * StaticBufferNumElements];
+ Buf.BufferIndex = index;
+ memset(Buf.Data, 0, StaticBufferNumElements * sizeof(uptr));
+ return Buf;
}
- void releaseBuffer(uptr *Buffer, const uptr NumElements) {
- const uptr index = getStaticBufferIndex(Buffer, NumElements);
- if (index < StaticBufferCount) {
+ void releaseBuffer(Buffer Buf) {
+ DCHECK(Buf.Data != nullptr);
----------------
ChiaHungDuan wrote:
DCHECK_NE(Buf.Data, nullptr)
https://github.com/llvm/llvm-project/pull/66788
More information about the llvm-commits
mailing list