Disable read barriers in GC VisitReferences calls.
It's safe to disable read barriers in the CC collector's
VisitReferences calls. It speeds up the collector by some amount,
eg. Ritzperf EAAC GC time on N5 decreases by ~4.2%.
This is based on Mathieu Chartier's idea.
Bug: 12687968
Change-Id: I884dee7018f92761fad54269f4cd01db4fa82f2a
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 8e1b7f4..d393f0b 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1622,7 +1622,9 @@
inline void ConcurrentCopying::Scan(mirror::Object* to_ref) {
DCHECK(!region_space_->IsInFromSpace(to_ref));
ConcurrentCopyingRefFieldsVisitor visitor(this);
- to_ref->VisitReferences(visitor, visitor);
+ // Disable the read barrier for a performance reason.
+ to_ref->VisitReferences</*kVisitNativeRoots*/true, kDefaultVerifyFlags, kWithoutReadBarrier>(
+ visitor, visitor);
}
// Process a field.