[compiler-rt] a52868a - Revert "[scudo] Use template specialization on Quarantine to avoid zero-length array"

Dominic Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 19:09:03 PDT 2022


Author: Dominic Chen
Date: 2022-03-28T19:08:55-07:00
New Revision: a52868a55c45b9f67b8efb54e18a6275aff2b39e

URL: https://github.com/llvm/llvm-project/commit/a52868a55c45b9f67b8efb54e18a6275aff2b39e
DIFF: https://github.com/llvm/llvm-project/commit/a52868a55c45b9f67b8efb54e18a6275aff2b39e.diff

LOG: Revert "[scudo] Use template specialization on Quarantine to avoid zero-length array"

This reverts commit 7dda44c189d74ec0a1bbe7dfff7c4d5f6b0e96d4.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/secondary.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index 0f8fafe0a6b90..abb58a2882aff 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -362,18 +362,6 @@ template <typename Config> class MapAllocatorCache {
     u64 Time;
   };
 
-  // Template specialization to avoid producing zero-length array
-  template <size_t Size> class QuarantineBlocks {
-  public:
-    CachedBlock &operator[](uptr Idx) { return Blocks[Idx]; }
-  private:
-    CachedBlock Blocks[Size];
-  };
-  template <> class QuarantineBlocks<0> {
-  public:
-    CachedBlock &operator[](uptr UNUSED Idx) { UNREACHABLE("Unsupported!"); }
-  };
-
   void releaseIfOlderThan(CachedBlock &Entry, u64 Time) {
     if (!Entry.CommitBase || !Entry.Time)
       return;
@@ -407,7 +395,7 @@ template <typename Config> class MapAllocatorCache {
   atomic_s32 ReleaseToOsIntervalMs = {};
 
   CachedBlock Entries[Config::SecondaryCacheEntriesArraySize] = {};
-  QuarantineBlocks<Config::SecondaryCacheQuarantineSize> Quarantine = {};
+  CachedBlock Quarantine[Config::SecondaryCacheQuarantineSize] = {};
 };
 
 template <typename Config> class MapAllocator {


        


More information about the llvm-commits mailing list