[compiler-rt] 4720e38 - [NFC][Sanitizer] Refine the restriction on SizeClassAllocator64::kRegionSize (#86270)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 18:06:49 PDT 2024
Author: Enna1
Date: 2024-03-27T09:06:45+08:00
New Revision: 4720e3831b814fdd2e8441ee0ac05b6934fdf533
URL: https://github.com/llvm/llvm-project/commit/4720e3831b814fdd2e8441ee0ac05b6934fdf533
DIFF: https://github.com/llvm/llvm-project/commit/4720e3831b814fdd2e8441ee0ac05b6934fdf533.diff
LOG: [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.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
Removed:
################################################################################
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