Restore bitmap marking in non-moving space in ConcurrentCopying::Copy.
When copying an (evac) from-space reference to the non-moving space in
ConcurrentCopying::Copy, also mark it in the heap mark bitmap, like it
used to be. (This marking operation was removed in
https://android-review.googlesource.com/257901.)
This addresses an issue with Sticky-Bit (Generational) CC collection,
where an assertion in
ConcurrentCopying::AssertToSpaceInvariantInNonMovingSpace could fail
when checking a reference in the non-moving space, that would happen
to be unmarked (and not on the allocation stack).
Test: ART run-tests & gtests, libcore tests, JDWP tests (host & device)
Test: Device/emulator boot test
Bug: 67628039
Bug: 12687968
Change-Id: Id21540a77c6c9f90e819377473951b4887f2f6bf
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index c9300b5..dc00342 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -2193,9 +2193,6 @@
(is_los && los_bitmap->Test(ref))) {
// OK.
} else {
- /* FIXME: We've seen this assertion fail in 004-ThreadStress from
- time to time with Sticky-Bit (Generational) CC (it seems the
- reference was in the non-moving space range at every occurrence). */
// If `ref` is on the allocation stack, then it may not be
// marked live, but considered marked/alive (but not
// necessarily on the live stack).
@@ -2554,9 +2551,8 @@
accounting::ContinuousSpaceBitmap* mark_bitmap =
heap_mark_bitmap_->GetContinuousSpaceBitmap(to_ref);
CHECK(mark_bitmap != nullptr);
- if (!kEnableGenerationalConcurrentCopyingCollection) {
- CHECK(!mark_bitmap->AtomicTestAndSet(to_ref));
- }
+ bool previously_marked_in_bitmap = mark_bitmap->AtomicTestAndSet(to_ref);
+ CHECK(!previously_marked_in_bitmap);
}
}
DCHECK(to_ref != nullptr);