[PATCH] D51173: Fix the configuration of the Primary allocator for Darwin ARM64

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 13:58:52 PDT 2018


delcypher added a comment.

In https://reviews.llvm.org/D51173#1211184, @cryptoad wrote:

> LGTM with a nit.
>  Additional question but that doesn't require changes to the CL: if you have a ByteMap it means you are using the SizeClassAllocator32 in 64-bit mode (it's gated by a define, look for SANITIZER_CAN_USE_ALLOCATOR64).
>  Have you tried using the SizeClassAllocator64?


@cryptoad

Yes I tried to use it and I couldn't get it to work with such a small VM space.

On the arm64 device I was using the "high mem" region is ~48GiB. This is portion of the VM space I wanted the SizeClassAllocator64 to use but it seems this region is too small for the allocator. The SizeClassAllocator64 has this compile time assert that I cannot satisfy.

  // kRegionSize must be >= 2^32.
   COMPILER_CHECK((kRegionSize) >= (1ULL << (SANITIZER_WORDSIZE / 2)));

This is basically `kRegionSize >= 4GiB`. `kRegionSize` is computed as

  static const uptr kRegionSize = kSpaceSize / kNumClassesRounded;

The smallest possible value for `kNumClassesRounded` is `32` which then implies we require that `(kSpaceSize /32) >= 4GiB` this then implies that `kSpaceSize >= 128GiB`. So the allocator needs at least 128GiB but we only have ~48GiB available at most. This means it's impossible to satisfy the requirements of the SizeClassAllocator64 on arm64 Darwin right now.



================
Comment at: lib/sanitizer_common/sanitizer_platform.h:238
 #elif defined(__aarch64__)
-# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 48)
+#  if SANITIZER_MAC
+// Darwin iOS/ARM64 has a 36-bit VMA, 64GiB VM
----------------
cryptoad wrote:
> nit: use 1 space for define indentation to conform with the rest of the file.
Oops I didn't notice that. I'll fix it.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D51173





More information about the llvm-commits mailing list