[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:25:42 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Enna1 (Enna1)
<details>
<summary>Changes</summary>
This patch replaces the `SANITIZER_WORDSIZE / 2` with `sizeof(CompactPtrT) * 8`, replaces hardcoded `4` with `kCompactPtrScale` in assertion.
---
Full diff: https://github.com/llvm/llvm-project/pull/86270.diff
1 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h (+2-1)
``````````diff
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/86270
More information about the llvm-commits
mailing list