[compiler-rt] [NFC][Sanitizer] Refine the restriction on SizeClassAllocator64::kRegionSize (PR #86270)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 04:17:17 PDT 2024
https://github.com/Enna1 created https://github.com/llvm/llvm-project/pull/86270
This patch replaces the `SANITIZER_WORDSIZE / 2` with `sizeof(CompactPtrT) * 8`, replaces hardcoded `4` with `kCompactPtrScale` in assertion.
>From 317684b4fa139ca07a6642b813b7e67b0c53b6f2 Mon Sep 17 00:00:00 2001
From: "xumingjie.enna1" <xumingjie.enna1 at bytedance.com>
Date: Fri, 22 Mar 2024 17:59:59 +0800
Subject: [PATCH] [NFC][Sanitizer] Refine the restriction on
SizeClassAllocator64::kRegionSize
---
.../lib/sanitizer_common/sanitizer_allocator_primary64.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index 34a64f26478fd5..6e73065d7f53c5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -639,7 +639,8 @@ class SizeClassAllocator64 {
static_assert(kRegionSize >= SizeClassMap::kMaxSize,
"Region size exceed largest size");
// kRegionSize must be <= 2^36, see CompactPtrT.
- COMPILER_CHECK((kRegionSize) <= (1ULL << (SANITIZER_WORDSIZE / 2 + 4)));
+ COMPILER_CHECK((kRegionSize) <=
+ (1ULL << (sizeof(CompactPtrT) * 8 + kCompactPtrScale)));
// Call mmap for user memory with at least this size.
static const uptr kUserMapSize = 1 << 18;
// Call mmap for metadata memory with at least this size.
More information about the llvm-commits
mailing list