[PATCH] D40521: [scudo] Allow for compile-time choice of the SizeClassMap

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 20:14:20 PST 2017


cryptoad updated this revision to Diff 124690.
cryptoad marked 3 inline comments as done.
cryptoad added a comment.

As per Aleksey's excellent suggestion, allow for the typename to be defined via
SCUDO_SIZE_CLASS_MAP={Default|Compact|VeryCompact}. Which makes a lot 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,25 +49,26 @@
 
 #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_


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40521.124690.patch
Type: text/x-patch
Size: 1351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171129/c3cdfa12/attachment.bin>


More information about the llvm-commits mailing list