[PATCH] D60243: [LSan][AArch64] Speed-up leak and address sanitizers on AArch64 for 48-bit VMA

Sebastian Pop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 11:53:37 PDT 2019


sebpop marked 6 inline comments as done.
sebpop added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_allocator.h:164
+static const uptr kMaxNumberOfSizeClasses =
+    SizeClassMap32::kNumClasses < SizeClassMap64::kNumClasses
+        ? SizeClassMap64::kNumClasses
----------------
vitalybuka wrote:
> Max(SizeClassMap32::kNumClasses, SizeClassMap64::kNumClasses) ?
Calling `Max()` instead of the cond_expr fails in several places where `kMaxNumberOfSizeClasses` is used.  It seems like in those places a cond_expr is allowed by the language whereas a function call is not:

```
/home/ubuntu/s/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_stats.h:41:48: error: array bound is not an integer constant before ‘]’ token
   uptr malloced_by_size[kMaxNumberOfSizeClasses];
                                                ^
```



================
Comment at: compiler-rt/lib/asan/asan_stats.cc:35
   Printf("%s", prefix);
-  for (uptr i = 0; i < kNumberOfSizeClasses; i++) {
+  for (uptr i = 0; i < kMaxNumberOfSizeClasses; i++) {
     if (!array[i]) continue;
----------------
vitalybuka wrote:
> I thing we should print only relevant part of array
> ```
> static void PrintMallocStatsArray(const char *prefix,
>                                   uptr *array, uptr size) {
>   Printf("%s", prefix);
>   for (uptr i = 0; i < size; i++) {
> ...
> 
> PrintMallocStatsArray("  mallocs by size class: ", malloced_by_size, get_allocator().KMaxSize());
> 
> ```
`get_allocator()` is static to `asan_allocator.cc`.  I exported it to make it available to `asan_stats.cc`.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_double_allocator.h:1
+//===-- sanitizer_double_allocator.h ----------------------------*- C++ -*-===//
+//
----------------
vitalybuka wrote:
> any idea for better name?
What about `sanitizer_runtime_select_allocator.h`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60243/new/

https://reviews.llvm.org/D60243





More information about the llvm-commits mailing list