Skip to content

Commit 4720e38

Browse files
authored
[NFC][Sanitizer] Refine the restriction on SizeClassAllocator64::kRegionSize (#86270)
This patch replaces the `SANITIZER_WORDSIZE / 2` with `sizeof(CompactPtrT) * 8`, replaces hardcoded `4` with `kCompactPtrScale` in assertion.
1 parent d023995 commit 4720e38

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ class SizeClassAllocator64 {
639639
static_assert(kRegionSize >= SizeClassMap::kMaxSize,
640640
"Region size exceed largest size");
641641
// kRegionSize must be <= 2^36, see CompactPtrT.
642-
COMPILER_CHECK((kRegionSize) <= (1ULL << (SANITIZER_WORDSIZE / 2 + 4)));
642+
COMPILER_CHECK((kRegionSize) <=
643+
(1ULL << (sizeof(CompactPtrT) * 8 + kCompactPtrScale)));
643644
// Call mmap for user memory with at least this size.
644645
static const uptr kUserMapSize = 1 << 18;
645646
// Call mmap for metadata memory with at least this size.

0 commit comments

Comments
 (0)