summaryrefslogtreecommitdiff
path: root/lib/asan/asan_allocator.h
diff options
context:
space:
mode:
authorDan Liew <dan@su-root.co.uk>2018-12-21 21:22:27 +0000
committerDan Liew <dan@su-root.co.uk>2018-12-21 21:22:27 +0000
commitab629b8cfbda327ff4f131760aaaae3011df8b40 (patch)
treeee13ba321ac8da5cf83aebe5b223e1a6fc962310 /lib/asan/asan_allocator.h
parent219145fd9e272c8460523a84e90f3b308cc97c6e (diff)
downloadcompiler-rt-ab629b8cfbda327ff4f131760aaaae3011df8b40.tar.gz
Introduce `AddressSpaceView` template parameter to `CombinedAllocator`.
Summary: This is a follow up to https://reviews.llvm.org/D55764 . For the ASan and LSan allocatorsthe type declarations have been modified so that it's possible to create a combined allocator type that consistently uses a different type of `AddressSpaceView`. We intend to use this in future patches. For the other sanitizers they just use `LocalAddressSpaceView` by default because we have no plans to use these allocators in an out-of-process manner. rdar://problem/45284065 Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov, yln Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55766 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_allocator.h')
-rw-r--r--lib/asan/asan_allocator.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/asan/asan_allocator.h b/lib/asan/asan_allocator.h
index 209532e1f..c9b37dc7a 100644
--- a/lib/asan/asan_allocator.h
+++ b/lib/asan/asan_allocator.h
@@ -192,11 +192,21 @@ using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
#endif // SANITIZER_CAN_USE_ALLOCATOR64
static const uptr kNumberOfSizeClasses = SizeClassMap::kNumClasses;
-typedef SizeClassAllocatorLocalCache<PrimaryAllocator> AllocatorCache;
-typedef LargeMmapAllocator<AsanMapUnmapCallback> SecondaryAllocator;
-typedef CombinedAllocator<PrimaryAllocator, AllocatorCache,
- SecondaryAllocator> AsanAllocator;
+template <typename AddressSpaceView>
+using AllocatorCacheASVT =
+ SizeClassAllocatorLocalCache<PrimaryAllocatorASVT<AddressSpaceView>>;
+using AllocatorCache = AllocatorCacheASVT<LocalAddressSpaceView>;
+template <typename AddressSpaceView>
+using SecondaryAllocatorASVT =
+ LargeMmapAllocator<AsanMapUnmapCallback, DefaultLargeMmapAllocatorPtrArray,
+ AddressSpaceView>;
+template <typename AddressSpaceView>
+using AsanAllocatorASVT =
+ CombinedAllocator<PrimaryAllocatorASVT<AddressSpaceView>,
+ AllocatorCacheASVT<AddressSpaceView>,
+ SecondaryAllocatorASVT<AddressSpaceView>>;
+using AsanAllocator = AsanAllocatorASVT<LocalAddressSpaceView>;
struct AsanThreadLocalMallocStorage {
uptr quarantine_cache[16];