[compiler-rt] 8e0c1aa - [msan] Use SizeClassAllocator64 for AArch64
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 11:49:15 PST 2023
Author: Fangrui Song
Date: 2023-01-09T19:49:08Z
New Revision: 8e0c1aaf6ba315420e8dc136da3f7abd10f5c4ed
URL: https://github.com/llvm/llvm-project/commit/8e0c1aaf6ba315420e8dc136da3f7abd10f5c4ed
DIFF: https://github.com/llvm/llvm-project/commit/8e0c1aaf6ba315420e8dc136da3f7abd10f5c4ed.diff
LOG: [msan] Use SizeClassAllocator64 for AArch64
Now that D137666 requires 48-bit VMA for AArch64, we can switch to
SizeClassAllocator64 for a slightly more efficient allocator
(asan/lsan already switched by default).
It seems that we can pick kSpaceBeg = 0xE00000000000ULL to support both Linux
("app-15") and FreeBSD ("high memory").
Reviewed By: #sanitizers, vitalybuka
Differential Revision: https://reviews.llvm.org/D140792
Added:
Modified:
compiler-rt/lib/msan/msan_allocator.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/msan/msan_allocator.cpp b/compiler-rt/lib/msan/msan_allocator.cpp
index 53f47bde67f3..3308ee7053a6 100644
--- a/compiler-rt/lib/msan/msan_allocator.cpp
+++ b/compiler-rt/lib/msan/msan_allocator.cpp
@@ -109,17 +109,16 @@ typedef SizeClassAllocator64<AP64> PrimaryAllocator;
#elif defined(__aarch64__)
static const uptr kMaxAllowedMallocSize = 8UL << 30;
-struct AP32 {
- static const uptr kSpaceBeg = 0;
- static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
+struct AP64 {
+ static const uptr kSpaceBeg = 0xE00000000000ULL;
+ static const uptr kSpaceSize = 0x40000000000; // 4T.
static const uptr kMetadataSize = sizeof(Metadata);
- typedef __sanitizer::CompactSizeClassMap SizeClassMap;
- static const uptr kRegionSizeLog = 20;
- using AddressSpaceView = LocalAddressSpaceView;
+ typedef DefaultSizeClassMap SizeClassMap;
typedef MsanMapUnmapCallback MapUnmapCallback;
static const uptr kFlags = 0;
+ using AddressSpaceView = LocalAddressSpaceView;
};
-typedef SizeClassAllocator32<AP32> PrimaryAllocator;
+typedef SizeClassAllocator64<AP64> PrimaryAllocator;
#endif
typedef CombinedAllocator<PrimaryAllocator> Allocator;
typedef Allocator::AllocatorCache AllocatorCache;
More information about the llvm-commits
mailing list