[compiler-rt] 54fe7ef - [compiler-rt][lsan][Fuchsia] Adjust lsan allocator settings (#69401)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 11:53:19 PDT 2023
Author: PiJoules
Date: 2023-10-23T11:53:15-07:00
New Revision: 54fe7ef70069a48c252a7e1b0c6ed8efda0bc440
URL: https://github.com/llvm/llvm-project/commit/54fe7ef70069a48c252a7e1b0c6ed8efda0bc440
DIFF: https://github.com/llvm/llvm-project/commit/54fe7ef70069a48c252a7e1b0c6ed8efda0bc440.diff
LOG: [compiler-rt][lsan][Fuchsia] Adjust lsan allocator settings (#69401)
These now match the settings for the asan allocator on Fuchsia+RISCV.
Added:
Modified:
compiler-rt/lib/lsan/lsan_allocator.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/lsan/lsan_allocator.h b/compiler-rt/lib/lsan/lsan_allocator.h
index 7197e0a736298fb..5eed0cbdb309bbd 100644
--- a/compiler-rt/lib/lsan/lsan_allocator.h
+++ b/compiler-rt/lib/lsan/lsan_allocator.h
@@ -68,8 +68,23 @@ using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
#else
# if SANITIZER_FUCHSIA || defined(__powerpc64__)
const uptr kAllocatorSpace = ~(uptr)0;
+# if SANITIZER_RISCV64
+// See the comments in compiler-rt/lib/asan/asan_allocator.h for why these
+// values were chosen.
+const uptr kAllocatorSize = UINT64_C(1) << 33; // 8GB
+using LSanSizeClassMap = SizeClassMap</*kNumBits=*/2,
+ /*kMinSizeLog=*/5,
+ /*kMidSizeLog=*/8,
+ /*kMaxSizeLog=*/18,
+ /*kNumCachedHintT=*/8,
+ /*kMaxBytesCachedLog=*/10>;
+static_assert(LSanSizeClassMap::kNumClassesRounded <= 32,
+ "32 size classes is the optimal number to ensure tests run "
+ "effieciently on Fuchsia.");
+# else
const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
using LSanSizeClassMap = DefaultSizeClassMap;
+# endif
# elif SANITIZER_RISCV64
const uptr kAllocatorSpace = ~(uptr)0;
const uptr kAllocatorSize = 0x2000000000ULL; // 128G.
More information about the llvm-commits
mailing list