Fix Heap::UnBindBitmaps for spaces without bitmaps
Spaces that don't have a bitmap can't have their bitmaps unbound.
Test: test/testrunner/run_build_test_target.py -j50 art-debug-gc
Bug: 116052292
Change-Id: Icbd9fab5bdec5fbc7f23bd02d45d600201387d6d
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 063c443..8f1508a 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -2227,7 +2227,7 @@
for (const auto& space : GetContinuousSpaces()) {
if (space->IsContinuousMemMapAllocSpace()) {
space::ContinuousMemMapAllocSpace* alloc_space = space->AsContinuousMemMapAllocSpace();
- if (alloc_space->HasBoundBitmaps()) {
+ if (alloc_space->GetLiveBitmap() != nullptr && alloc_space->HasBoundBitmaps()) {
alloc_space->UnBindBitmaps();
}
}
diff --git a/runtime/gc/space/space.cc b/runtime/gc/space/space.cc
index 8ba8603..cae9ce8 100644
--- a/runtime/gc/space/space.cc
+++ b/runtime/gc/space/space.cc
@@ -112,6 +112,8 @@
}
bool ContinuousSpace::HasBoundBitmaps() {
+ DCHECK(GetLiveBitmap() != nullptr);
+ DCHECK(GetMarkBitmap() != nullptr);
// Check if the bitmaps are pointing to the same underlying data.
return GetLiveBitmap()->Begin() == GetMarkBitmap()->Begin();
}