[PATCH] D40521: [scudo] Allow for compile-time choice of the SizeClassMap
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 14:15:23 PST 2017
cryptoad created this revision.
Herald added a subscriber: srhines.
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!
https://reviews.llvm.org/D40521
Files:
lib/scudo/scudo_platform.h
Index: lib/scudo/scudo_platform.h
===================================================================
--- lib/scudo/scudo_platform.h
+++ lib/scudo/scudo_platform.h
@@ -49,24 +49,25 @@
#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;
+const uptr RegionSizeLog = SANITIZER_ANDROID ? 19 : 20;
+#endif // SANITIZER_CAN_USE_ALLOCATOR64
+
+#if SCUDO_SCM_VERYCOMPACT
typedef VeryCompactSizeClassMap SizeClassMap;
-# else
-static const uptr RegionSizeLog = 20;
+#elif SCUDO_SCM_COMPACT
typedef CompactSizeClassMap SizeClassMap;
-# endif
-#endif // SANITIZER_CAN_USE_ALLOCATOR64
+#elif SCUDO_SCM_DEFAULT
+typedef DefaultSizeClassMap SizeClassMap;
+#else
+typedef DefaultSizeClassMap SizeClassMap;
+#endif
} // namespace __scudo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40521.124468.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/8e39ec2d/attachment.bin>
More information about the llvm-commits
mailing list