Index: compiler-rt/lib/hwasan/hwasan_allocator.h =================================================================== --- compiler-rt/lib/hwasan/hwasan_allocator.h +++ compiler-rt/lib/hwasan/hwasan_allocator.h @@ -45,28 +45,22 @@ }; static const uptr kMaxAllowedMallocSize = 2UL << 30; // 2G -static const uptr kRegionSizeLog = 20; -static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog; -typedef TwoLevelByteMap<(kNumRegions >> 12), 1 << 12> ByteMap; -struct AP32 { - static const uptr kSpaceBeg = 0; - static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE; +struct AP64 { + static const uptr kSpaceBeg = ~0ULL; + static const uptr kSpaceSize = 0x2000000000ULL; static const uptr kMetadataSize = sizeof(Metadata); - typedef __sanitizer::CompactSizeClassMap SizeClassMap; - static const uptr kRegionSizeLog = __hwasan::kRegionSizeLog; + typedef __sanitizer::VeryDenseSizeClassMap SizeClassMap; using AddressSpaceView = LocalAddressSpaceView; - using ByteMap = __hwasan::ByteMap; typedef HwasanMapUnmapCallback MapUnmapCallback; static const uptr kFlags = 0; }; -typedef SizeClassAllocator32 PrimaryAllocator; +typedef SizeClassAllocator64 PrimaryAllocator; typedef SizeClassAllocatorLocalCache AllocatorCache; typedef LargeMmapAllocator SecondaryAllocator; typedef CombinedAllocator Allocator; - void AllocatorSwallowThreadLocalCache(AllocatorCache *cache); class HwasanChunkView { Index: compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h +++ compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h @@ -34,15 +34,15 @@ "SecondaryAllocator is using wrong AddressSpaceView"); void InitLinkerInitialized(s32 release_to_os_interval_ms) { + stats_.InitLinkerInitialized(); primary_.Init(release_to_os_interval_ms); secondary_.InitLinkerInitialized(); - stats_.InitLinkerInitialized(); } void Init(s32 release_to_os_interval_ms) { + stats_.Init(); primary_.Init(release_to_os_interval_ms); secondary_.Init(); - stats_.Init(); } void *Allocate(AllocatorCache *cache, uptr size, uptr alignment) { Index: compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h +++ compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h @@ -237,3 +237,6 @@ // allowing for denser per-class arrays, smaller memory footprint and usually // better performances in threaded environments. typedef SizeClassMap<3, 4, 8, 17, 8, 10> DenseSizeClassMap; +// Similar to VeryCompact map above, this one has a small number of different +// size classes, and also reduced thread-local caches. +typedef SizeClassMap<2, 5, 9, 16, 8, 10> VeryDenseSizeClassMap;