ART: Change alloc-space begin for x86 ASAN
Move the preferred AllocSpace begin to 0x40000000, as lower memory
is mostly reserved by ASAN. This does not seem to apply to arm32.
Bug: 31098551
Bug: 37728308
Test: m SANITIZE_HOST=address test-art-host-gtest32
Test: lunch aosp_bullhead && m && m SANITIZE_TARGET=address # device boots
Change-Id: I2c6508305e62040b0679dfe483c76fd283dba9de
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index bd4f99b..298336a 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -150,8 +150,13 @@
static uint8_t* const kPreferredAllocSpaceBegin =
reinterpret_cast<uint8_t*>(300 * MB - Heap::kDefaultNonMovingSpaceCapacity);
#else
-// For 32-bit, use 0x20000000 because asan reserves 0x04000000 - 0x20000000.
+#ifdef __ANDROID__
+// For 32-bit Android, use 0x20000000 because asan reserves 0x04000000 - 0x20000000.
static uint8_t* const kPreferredAllocSpaceBegin = reinterpret_cast<uint8_t*>(0x20000000);
+#else
+// For 32-bit host, use 0x40000000 because asan uses most of the space below this.
+static uint8_t* const kPreferredAllocSpaceBegin = reinterpret_cast<uint8_t*>(0x40000000);
+#endif
#endif
static inline bool CareAboutPauseTimes() {