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

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 11:15:50 PDT 2019


vitalybuka added a comment.

I propose to finalize one patch for either lsan or asan and then replicate it for another.



================
Comment at: compiler-rt/lib/asan/asan_allocator.cc:750
       SpinMutexLock l(&fallback_mutex);
-      AllocatorCache *cache = &fallback_allocator_cache;
-      allocated = allocator.Allocate(cache, needed_size, 8);
+      Allocate(needed_size);
     }
----------------
allocated = 


================
Comment at: compiler-rt/lib/lsan/lsan_allocator.cc:40
+#if defined(__aarch64__)
+static bool useAllocator64 = true;
+static Allocator64 allocator64;
----------------
maybe 
```
#if defined(SANITIZER_SELECT_ALLOCATOR_AT_RUNTIME)
bool useAllocator1 = false;

struct AllocatorCache {
  Type1 cache1;
  Type2 cache2;

  void Fn1() {
    if (useAllocator1)
      cache1.Fn1();
    else
      cache2.Fn1();
  }
}

struct Allocator {
  Type1 allocator1;
  Type2 allocator2;
  
  void Fn1() {
    if (useAllocator1)
      allocator1.Fn1();
    else
      allocator2.Fn1();
  }
};

#else

using Allocator = CombinedAllocator<
   PrimeAlloc, AllocatorCache, SecondAlloc, LocalAddressSpaceView>;
using AllocatorCache = AllocatorASVT<LocalAddressSpaceView>;

#endif

```

Would be nice to be able to enable SANITIZER_SELECT_ALLOCATOR_AT_RUNTIME 
even on platforms where it's not needed, just to check the build


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

https://reviews.llvm.org/D60243





More information about the llvm-commits mailing list