summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/gc/collector/semi_space-inl.h1
-rw-r--r--runtime/gc/collector/semi_space.cc2
2 files changed, 2 insertions, 1 deletions
diff --git a/runtime/gc/collector/semi_space-inl.h b/runtime/gc/collector/semi_space-inl.h
index 12cf3dbf98..e87b5ff332 100644
--- a/runtime/gc/collector/semi_space-inl.h
+++ b/runtime/gc/collector/semi_space-inl.h
@@ -75,6 +75,7 @@ inline void SemiSpace::MarkObject(
}
obj_ptr->Assign(forward_address);
} else if (!collect_from_space_only_ && !immune_spaces_.IsInImmuneRegion(obj)) {
+ DCHECK(!to_space_->HasAddress(obj)) << "Tried to mark " << obj << " in to-space";
BitmapSetSlowPathVisitor visitor(this);
if (!mark_bitmap_->Set(obj, visitor)) {
// This object was not previously marked.
diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc
index 278469329f..f37daa54e9 100644
--- a/runtime/gc/collector/semi_space.cc
+++ b/runtime/gc/collector/semi_space.cc
@@ -619,7 +619,7 @@ mirror::Object* SemiSpace::MarkNonForwardedObject(mirror::Object* obj) {
mirror::Object* SemiSpace::MarkObject(mirror::Object* root) {
auto ref = StackReference<mirror::Object>::FromMirrorPtr(root);
- MarkObject(&ref);
+ MarkObjectIfNotInToSpace(&ref);
return ref.AsMirrorPtr();
}