diff options
author | Mohit K. Bhakkad <mohit.bhakkad@imgtec.com> | 2015-02-19 07:30:39 +0000 |
---|---|---|
committer | Mohit K. Bhakkad <mohit.bhakkad@imgtec.com> | 2015-02-19 07:30:39 +0000 |
commit | 8c07b4265420d7ac25cdd4b65daa608dbd13285e (patch) | |
tree | f335c5b0ba1bc3486dc5fb7dc655793b94c678af /lib/lsan/lsan_allocator.cc | |
parent | bdc0e9eb245f5d3afc91e21ad9669183b17317eb (diff) | |
download | compiler-rt-8c07b4265420d7ac25cdd4b65daa608dbd13285e.tar.gz |
[LSan] [MIPS] adding support of LSan for mips64/mips64el arch
Patch by Sagar Thakur
Reviewers: petarj, earthdok, kcc.
Subscribers: samsonov, dsanders, mohit.bhakkad, Anand.Takale, llvm-commits.
Differential Revision: http://reviews.llvm.org/D7013
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan/lsan_allocator.cc')
-rw-r--r-- | lib/lsan/lsan_allocator.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/lsan/lsan_allocator.cc b/lib/lsan/lsan_allocator.cc index 96a2b0428..67125dbb3 100644 --- a/lib/lsan/lsan_allocator.cc +++ b/lib/lsan/lsan_allocator.cc @@ -25,10 +25,6 @@ extern "C" void *memset(void *ptr, int value, uptr num); namespace __lsan { -static const uptr kMaxAllowedMallocSize = 8UL << 30; -static const uptr kAllocatorSpace = 0x600000000000ULL; -static const uptr kAllocatorSize = 0x40000000000ULL; // 4T. - struct ChunkMetadata { bool allocated : 8; // Must be first. ChunkTag tag : 2; @@ -36,8 +32,22 @@ struct ChunkMetadata { u32 stack_trace_id; }; +#if defined(__mips64) +static const uptr kMaxAllowedMallocSize = 4UL << 30; +static const uptr kRegionSizeLog = 20; +static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog; +typedef TwoLevelByteMap<(kNumRegions >> 12), 1 << 12> ByteMap; +typedef CompactSizeClassMap SizeClassMap; +typedef SizeClassAllocator32<0, SANITIZER_MMAP_RANGE_SIZE, + sizeof(ChunkMetadata), SizeClassMap, kRegionSizeLog, ByteMap> + PrimaryAllocator; +#else +static const uptr kMaxAllowedMallocSize = 8UL << 30; +static const uptr kAllocatorSpace = 0x600000000000ULL; +static const uptr kAllocatorSize = 0x40000000000ULL; // 4T. typedef SizeClassAllocator64<kAllocatorSpace, kAllocatorSize, sizeof(ChunkMetadata), DefaultSizeClassMap> PrimaryAllocator; +#endif typedef SizeClassAllocatorLocalCache<PrimaryAllocator> AllocatorCache; typedef LargeMmapAllocator<> SecondaryAllocator; typedef CombinedAllocator<PrimaryAllocator, AllocatorCache, |