Fix IsMovableObject to handle background compaction.
Before we assumed that only the bump pointer space contained
movable objects. This is incorrect since the background compaction
foreground -> background transition copies objects from the
RosAlloc / DlMalloc space (now called main space) to the bump pointer
space.
Bug: 8981901
Change-Id: Ie7bb9a5d82012988573e944ede2f6a8a77d8872f
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 1b221fa..622850f 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -670,6 +670,10 @@
// Space which we use for the kAllocatorTypeDlMalloc.
space::DlMallocSpace* dlmalloc_space_;
+ // The main space is the space which the GC copies to and from on process state updates. This
+ // space is typically either the dlmalloc_space_ or the rosalloc_space_.
+ space::MallocSpace* main_space_;
+
// The large object space we are currently allocating into.
space::LargeObjectSpace* large_object_space_;