[PATCH] D129237: [scudo] Pass MapPlatformData in more calls

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 18:12:12 PDT 2022


ddcc updated this revision to Diff 442741.
ddcc added a comment.

Fix duplicate variable


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129237/new/

https://reviews.llvm.org/D129237

Files:
  compiler-rt/lib/scudo/standalone/release.h
  compiler-rt/lib/scudo/standalone/vector.h


Index: compiler-rt/lib/scudo/standalone/vector.h
===================================================================
--- compiler-rt/lib/scudo/standalone/vector.h
+++ compiler-rt/lib/scudo/standalone/vector.h
@@ -27,7 +27,7 @@
   }
   void destroy() {
     if (Data != &LocalData[0])
-      unmap(Data, CapacityBytes);
+      unmap(Data, CapacityBytes, 0, &PlatformData);
   }
   T &operator[](uptr I) {
     DCHECK_LT(I, Size);
@@ -83,8 +83,8 @@
     DCHECK_GT(NewCapacity, 0);
     DCHECK_LE(Size, NewCapacity);
     NewCapacity = roundUpTo(NewCapacity * sizeof(T), getPageSizeCached());
-    T *NewData =
-        reinterpret_cast<T *>(map(nullptr, NewCapacity, "scudo:vector"));
+    T *NewData = reinterpret_cast<T *>(
+        map(nullptr, NewCapacity, "scudo:vector", 0, &PlatformData));
     memcpy(NewData, Data, Size * sizeof(T));
     destroy();
     Data = NewData;
@@ -92,6 +92,7 @@
   }
 
   T *Data = nullptr;
+  MapPlatformData PlatformData = {};
   T LocalData[256 / sizeof(T)] = {};
   uptr CapacityBytes = 0;
   uptr Size = 0;
Index: compiler-rt/lib/scudo/standalone/release.h
===================================================================
--- compiler-rt/lib/scudo/standalone/release.h
+++ compiler-rt/lib/scudo/standalone/release.h
@@ -82,7 +82,7 @@
     } else {
       Buffer = reinterpret_cast<uptr *>(
           map(nullptr, roundUpTo(BufferSize, getPageSizeCached()),
-              "scudo:counters", MAP_ALLOWNOMEM));
+              "scudo:counters", MAP_ALLOWNOMEM, &Data));
     }
   }
   ~PackedCounterArray() {
@@ -92,7 +92,7 @@
       Mutex.unlock();
     else
       unmap(reinterpret_cast<void *>(Buffer),
-            roundUpTo(BufferSize, getPageSizeCached()));
+            roundUpTo(BufferSize, getPageSizeCached()), 0, &Data);
   }
 
   bool isAllocated() const { return !!Buffer; }
@@ -138,6 +138,7 @@
   uptr SizePerRegion;
   uptr BufferSize;
   uptr *Buffer;
+  MapPlatformData Data = {};
 
   static HybridMutex Mutex;
   static uptr StaticBuffer[StaticBufferCount];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129237.442741.patch
Type: text/x-patch
Size: 2017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220707/a5a1b205/attachment.bin>


More information about the llvm-commits mailing list