NFC: Clang-format msan_allocator.cc

llvm-svn: 359270
This commit is contained in:
Vitaly Buka 2019-04-26 04:22:28 +00:00
parent 3db2a7a04f
commit a9e7fd2188
1 changed files with 56 additions and 56 deletions

View File

@ -45,76 +45,76 @@ struct MsanMapUnmapCallback {
}; };
#if defined(__mips64) #if defined(__mips64)
static const uptr kMaxAllowedMallocSize = 2UL << 30; static const uptr kMaxAllowedMallocSize = 2UL << 30;
static const uptr kRegionSizeLog = 20; static const uptr kRegionSizeLog = 20;
static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog; static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog;
typedef TwoLevelByteMap<(kNumRegions >> 12), 1 << 12> ByteMap; typedef TwoLevelByteMap<(kNumRegions >> 12), 1 << 12> ByteMap;
struct AP32 { struct AP32 {
static const uptr kSpaceBeg = 0; static const uptr kSpaceBeg = 0;
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE; static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
static const uptr kMetadataSize = sizeof(Metadata); static const uptr kMetadataSize = sizeof(Metadata);
typedef __sanitizer::CompactSizeClassMap SizeClassMap; typedef __sanitizer::CompactSizeClassMap SizeClassMap;
static const uptr kRegionSizeLog = __msan::kRegionSizeLog; static const uptr kRegionSizeLog = __msan::kRegionSizeLog;
using AddressSpaceView = LocalAddressSpaceView; using AddressSpaceView = LocalAddressSpaceView;
using ByteMap = __msan::ByteMap; using ByteMap = __msan::ByteMap;
typedef MsanMapUnmapCallback MapUnmapCallback; typedef MsanMapUnmapCallback MapUnmapCallback;
static const uptr kFlags = 0; static const uptr kFlags = 0;
}; };
typedef SizeClassAllocator32<AP32> PrimaryAllocator; typedef SizeClassAllocator32<AP32> PrimaryAllocator;
#elif defined(__x86_64__) #elif defined(__x86_64__)
#if SANITIZER_NETBSD || \ #if SANITIZER_NETBSD || \
(SANITIZER_LINUX && !defined(MSAN_LINUX_X86_64_OLD_MAPPING)) (SANITIZER_LINUX && !defined(MSAN_LINUX_X86_64_OLD_MAPPING))
static const uptr kAllocatorSpace = 0x700000000000ULL; static const uptr kAllocatorSpace = 0x700000000000ULL;
#else #else
static const uptr kAllocatorSpace = 0x600000000000ULL; static const uptr kAllocatorSpace = 0x600000000000ULL;
#endif #endif
static const uptr kMaxAllowedMallocSize = 8UL << 30; static const uptr kMaxAllowedMallocSize = 8UL << 30;
struct AP64 { // Allocator64 parameters. Deliberately using a short name. struct AP64 { // Allocator64 parameters. Deliberately using a short name.
static const uptr kSpaceBeg = kAllocatorSpace; static const uptr kSpaceBeg = kAllocatorSpace;
static const uptr kSpaceSize = 0x40000000000; // 4T. static const uptr kSpaceSize = 0x40000000000; // 4T.
static const uptr kMetadataSize = sizeof(Metadata); static const uptr kMetadataSize = sizeof(Metadata);
typedef DefaultSizeClassMap SizeClassMap; typedef DefaultSizeClassMap SizeClassMap;
typedef MsanMapUnmapCallback MapUnmapCallback; typedef MsanMapUnmapCallback MapUnmapCallback;
static const uptr kFlags = 0; static const uptr kFlags = 0;
using AddressSpaceView = LocalAddressSpaceView; using AddressSpaceView = LocalAddressSpaceView;
}; };
typedef SizeClassAllocator64<AP64> PrimaryAllocator; typedef SizeClassAllocator64<AP64> PrimaryAllocator;
#elif defined(__powerpc64__) #elif defined(__powerpc64__)
static const uptr kMaxAllowedMallocSize = 2UL << 30; // 2G static const uptr kMaxAllowedMallocSize = 2UL << 30; // 2G
struct AP64 { // Allocator64 parameters. Deliberately using a short name. struct AP64 { // Allocator64 parameters. Deliberately using a short name.
static const uptr kSpaceBeg = 0x300000000000; static const uptr kSpaceBeg = 0x300000000000;
static const uptr kSpaceSize = 0x020000000000; // 2T. static const uptr kSpaceSize = 0x020000000000; // 2T.
static const uptr kMetadataSize = sizeof(Metadata); static const uptr kMetadataSize = sizeof(Metadata);
typedef DefaultSizeClassMap SizeClassMap; typedef DefaultSizeClassMap SizeClassMap;
typedef MsanMapUnmapCallback MapUnmapCallback; typedef MsanMapUnmapCallback MapUnmapCallback;
static const uptr kFlags = 0; static const uptr kFlags = 0;
using AddressSpaceView = LocalAddressSpaceView; using AddressSpaceView = LocalAddressSpaceView;
}; };
typedef SizeClassAllocator64<AP64> PrimaryAllocator; typedef SizeClassAllocator64<AP64> PrimaryAllocator;
#elif defined(__aarch64__) #elif defined(__aarch64__)
static const uptr kMaxAllowedMallocSize = 2UL << 30; // 2G static const uptr kMaxAllowedMallocSize = 2UL << 30; // 2G
static const uptr kRegionSizeLog = 20; static const uptr kRegionSizeLog = 20;
static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog; static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog;
typedef TwoLevelByteMap<(kNumRegions >> 12), 1 << 12> ByteMap; typedef TwoLevelByteMap<(kNumRegions >> 12), 1 << 12> ByteMap;
struct AP32 { struct AP32 {
static const uptr kSpaceBeg = 0; static const uptr kSpaceBeg = 0;
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE; static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
static const uptr kMetadataSize = sizeof(Metadata); static const uptr kMetadataSize = sizeof(Metadata);
typedef __sanitizer::CompactSizeClassMap SizeClassMap; typedef __sanitizer::CompactSizeClassMap SizeClassMap;
static const uptr kRegionSizeLog = __msan::kRegionSizeLog; static const uptr kRegionSizeLog = __msan::kRegionSizeLog;
using AddressSpaceView = LocalAddressSpaceView; using AddressSpaceView = LocalAddressSpaceView;
using ByteMap = __msan::ByteMap; using ByteMap = __msan::ByteMap;
typedef MsanMapUnmapCallback MapUnmapCallback; typedef MsanMapUnmapCallback MapUnmapCallback;
static const uptr kFlags = 0; static const uptr kFlags = 0;
}; };
typedef SizeClassAllocator32<AP32> PrimaryAllocator; typedef SizeClassAllocator32<AP32> PrimaryAllocator;
#endif #endif
typedef SizeClassAllocatorLocalCache<PrimaryAllocator> AllocatorCache; typedef SizeClassAllocatorLocalCache<PrimaryAllocator> AllocatorCache;
typedef LargeMmapAllocator<MsanMapUnmapCallback> SecondaryAllocator; typedef LargeMmapAllocator<MsanMapUnmapCallback> SecondaryAllocator;