[compiler-rt] r319350 - [scudo] Allow for compile-time choice of the SizeClassMap
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 29 11:52:09 PST 2017
Author: cryptoad
Date: Wed Nov 29 11:52:09 2017
New Revision: 319350
URL: http://llvm.org/viewvc/llvm-project?rev=319350&view=rev
Log:
[scudo] Allow for compile-time choice of the SizeClassMap
Summary:
With this change, we allow someone to chose the `SizeClassMap` they want to use
at compile time via a define.
I feel somewhat unimaginative with the name of the defines, so if someone has a
better idea, let me know. I have been alternating between those and
`SCUDO_USE_xxx_SIZECLASSMAP` which is clearer but also longer. The issue with
those is that it wouldn't be consistent with `SCUDO_TSD_EXCLUSIVE` that should
probably become `SCUDO_USE_EXCLUSIVE_TSD` maybe?
Anyway, naming is hard, and I am not sure what makes more sense!
Reviewers: alekseyshl, flowerhack
Reviewed By: alekseyshl
Subscribers: llvm-commits, srhines
Differential Revision: https://reviews.llvm.org/D40521
Modified:
compiler-rt/trunk/lib/scudo/scudo_platform.h
Modified: compiler-rt/trunk/lib/scudo/scudo_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_platform.h?rev=319350&r1=319349&r2=319350&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_platform.h (original)
+++ compiler-rt/trunk/lib/scudo/scudo_platform.h Wed Nov 29 11:52:09 2017
@@ -49,25 +49,26 @@ namespace __scudo {
#if SANITIZER_CAN_USE_ALLOCATOR64
# if defined(__aarch64__) && SANITIZER_ANDROID
-const uptr AllocatorSize = 0x2000000000ULL; // 128G.
-typedef VeryCompactSizeClassMap SizeClassMap;
+const uptr AllocatorSize = 0x4000000000ULL; // 256G.
# elif defined(__aarch64__)
const uptr AllocatorSize = 0x10000000000ULL; // 1T.
-typedef CompactSizeClassMap SizeClassMap;
# else
const uptr AllocatorSize = 0x40000000000ULL; // 4T.
-typedef CompactSizeClassMap SizeClassMap;
# endif
#else
-# if SANITIZER_ANDROID
-static const uptr RegionSizeLog = 19;
-typedef VeryCompactSizeClassMap SizeClassMap;
-# else
-static const uptr RegionSizeLog = 20;
-typedef CompactSizeClassMap SizeClassMap;
-# endif
+const uptr RegionSizeLog = SANITIZER_ANDROID ? 19 : 20;
#endif // SANITIZER_CAN_USE_ALLOCATOR64
+#if !defined(SCUDO_SIZE_CLASS_MAP)
+# define SCUDO_SIZE_CLASS_MAP Default
+#endif
+
+#define SIZE_CLASS_MAP_TYPE SIZE_CLASS_MAP_TYPE_(SCUDO_SIZE_CLASS_MAP)
+#define SIZE_CLASS_MAP_TYPE_(T) SIZE_CLASS_MAP_TYPE__(T)
+#define SIZE_CLASS_MAP_TYPE__(T) T##SizeClassMap
+
+typedef SIZE_CLASS_MAP_TYPE SizeClassMap;
+
} // namespace __scudo
#endif // SCUDO_PLATFORM_H_
More information about the llvm-commits
mailing list