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 | 36f974d76babc13a3e1de7b54965583878d5f272 (patch) | |
| tree | 4d6a8470ec5cd5381bf57ab8427cda6ba6638dc7 /compiler-rt/lib/lsan/lsan_allocator.cc | |
| parent | 12d3783add5d6db1af9913fff39b5f951de7d692 (diff) | |
| download | bcm5719-llvm-36f974d76babc13a3e1de7b54965583878d5f272.tar.gz bcm5719-llvm-36f974d76babc13a3e1de7b54965583878d5f272.zip | |
[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
llvm-svn: 229830
Diffstat (limited to 'compiler-rt/lib/lsan/lsan_allocator.cc')
| -rw-r--r-- | compiler-rt/lib/lsan/lsan_allocator.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/compiler-rt/lib/lsan/lsan_allocator.cc b/compiler-rt/lib/lsan/lsan_allocator.cc index 96a2b0428a6..67125dbb3e4 100644 --- a/compiler-rt/lib/lsan/lsan_allocator.cc +++ b/compiler-rt/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, |

