Don't create shadow-map if kObjPtrPoisoning is true
Causes Dex2oatImageTest.TestExtension gtest to fail in 64-bit.
Bug: 160737021
Test: run gtest Dex2oatImageTest.TestExtension
Change-Id: Ic255b69c18495985bd407b332a6fbd9640bc86f5
diff --git a/runtime/gc/collector/mark_compact.cc b/runtime/gc/collector/mark_compact.cc
index 50f5708..7658440 100644
--- a/runtime/gc/collector/mark_compact.cc
+++ b/runtime/gc/collector/mark_compact.cc
@@ -324,13 +324,19 @@
// running the GC cycle in copy-mode rather than minor-fault.
//
// This map doesn't have to be aligned to 2MB as we don't mremap on it.
- shadow_to_space_map_ = MemMap::MapAnonymous("Concurrent mark-compact moving-space shadow",
- moving_space_size,
- PROT_NONE,
- /*low_4gb=*/kObjPtrPoisoning,
- &err_msg);
- if (!shadow_to_space_map_.IsValid()) {
- LOG(WARNING) << "Failed to allocate concurrent mark-compact moving-space shadow: " << err_msg;
+ if (!kObjPtrPoisoning && uffd_minor_fault_supported_) {
+ // We need this map only if minor-fault feature is supported. But in that case
+ // don't create the mapping if obj-ptr poisoning is enabled as then the mapping
+ // has to be created in low_4gb. Doing this here rather than later causes the
+ // Dex2oatImageTest.TestExtension gtest to fail in 64-bit platforms.
+ shadow_to_space_map_ = MemMap::MapAnonymous("Concurrent mark-compact moving-space shadow",
+ moving_space_size,
+ PROT_NONE,
+ /*low_4gb=*/false,
+ &err_msg);
+ if (!shadow_to_space_map_.IsValid()) {
+ LOG(WARNING) << "Failed to allocate concurrent mark-compact moving-space shadow: " << err_msg;
+ }
}
const size_t num_pages = 1 + std::min(heap_->GetParallelGCThreadCount(), kMaxNumUffdWorkers);
compaction_buffers_map_ = MemMap::MapAnonymous("Concurrent mark-compact compaction buffers",