diff options
| -rw-r--r-- | runtime/gc/accounting/mod_union_table.cc | 6 | ||||
| -rw-r--r-- | runtime/gc/collector/mark_sweep.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc index d16afd947e..4e40aea585 100644 --- a/runtime/gc/accounting/mod_union_table.cc +++ b/runtime/gc/accounting/mod_union_table.cc @@ -210,7 +210,11 @@ class AddToReferenceArrayVisitor { if (mod_union_table_->ShouldAddReference(root->AsMirrorPtr())) { *has_target_reference_ = true; // TODO: Add MarkCompressedReference callback here. - root->Assign(visitor_->MarkObject(root->AsMirrorPtr())); + mirror::Object* old_ref = root->AsMirrorPtr(); + mirror::Object* new_ref = visitor_->MarkObject(old_ref); + if (old_ref != new_ref) { + root->Assign(new_ref); + } } } diff --git a/runtime/gc/collector/mark_sweep.h b/runtime/gc/collector/mark_sweep.h index b61bef7317..c19107a626 100644 --- a/runtime/gc/collector/mark_sweep.h +++ b/runtime/gc/collector/mark_sweep.h @@ -231,7 +231,7 @@ class MarkSweep : public GarbageCollector { protected: // Returns object if the object is marked in the heap bitmap, otherwise null. virtual mirror::Object* IsMarked(mirror::Object* object) OVERRIDE - SHARED_REQUIRES(Locks::heap_bitmap_lock_); + SHARED_REQUIRES(Locks::heap_bitmap_lock_, Locks::mutator_lock_); void MarkObjectNonNull(mirror::Object* obj, mirror::Object* holder = nullptr, |