summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-11-29 19:52:09 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-11-29 19:52:09 +0000
commitd5df99b6ebd467163425ed288969f82f85068564 (patch)
tree74f7ad29f052dd3679e159cd7d5455a5c7ad632f
parent131cefe7bcd38007af045450ccbf590d569a0d02 (diff)
downloadcompiler-rt-d5df99b6ebd467163425ed288969f82f85068564.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319350 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/scudo/scudo_platform.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/scudo/scudo_platform.h b/lib/scudo/scudo_platform.h
index 7db1197fd..a915c9843 100644
--- a/lib/scudo/scudo_platform.h
+++ b/lib/scudo/scudo_platform.h
@@ -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_