diff options
-rw-r--r-- | runtime/gc/collector/concurrent_copying.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc index bd07bb8711..90446b03ae 100644 --- a/runtime/gc/collector/concurrent_copying.cc +++ b/runtime/gc/collector/concurrent_copying.cc @@ -520,7 +520,7 @@ class ConcurrentCopying::ImmuneSpaceScanObjVisitor { explicit ImmuneSpaceScanObjVisitor(ConcurrentCopying* cc) : collector_(cc) {} - void operator()(mirror::Object* obj) const SHARED_REQUIRES(Locks::mutator_lock_) { + ALWAYS_INLINE void operator()(mirror::Object* obj) const SHARED_REQUIRES(Locks::mutator_lock_) { if (kUseBakerReadBarrier && kGrayDirtyImmuneObjects) { if (obj->GetReadBarrierPointer() == ReadBarrier::GrayPtr()) { collector_->ScanImmuneObject(obj); @@ -534,6 +534,10 @@ class ConcurrentCopying::ImmuneSpaceScanObjVisitor { } } + static void Callback(mirror::Object* obj, void* arg) SHARED_REQUIRES(Locks::mutator_lock_) { + reinterpret_cast<ImmuneSpaceScanObjVisitor*>(arg)->operator()(obj); + } + private: ConcurrentCopying* const collector_; }; @@ -558,10 +562,15 @@ void ConcurrentCopying::MarkingPhase() { for (auto& space : immune_spaces_.GetSpaces()) { DCHECK(space->IsImageSpace() || space->IsZygoteSpace()); accounting::ContinuousSpaceBitmap* live_bitmap = space->GetLiveBitmap(); + accounting::ModUnionTable* table = heap_->FindModUnionTableFromSpace(space); ImmuneSpaceScanObjVisitor visitor(this); - live_bitmap->VisitMarkedRange(reinterpret_cast<uintptr_t>(space->Begin()), - reinterpret_cast<uintptr_t>(space->Limit()), - visitor); + if (table != nullptr) { + table->VisitObjects(ImmuneSpaceScanObjVisitor::Callback, &visitor); + } else { + live_bitmap->VisitMarkedRange(reinterpret_cast<uintptr_t>(space->Begin()), + reinterpret_cast<uintptr_t>(space->Limit()), + visitor); + } } } if (kUseBakerReadBarrier) { |