diff options
author | 2016-07-27 10:45:47 -0700 | |
---|---|---|
committer | 2016-07-27 13:57:01 -0700 | |
commit | 5ffa0780a2738eed1f86efb967ea99badcbd5d9c (patch) | |
tree | ee3a4bde21aa03ad564c84877b3cbab3048e6cfd /runtime/gc/reference_queue.cc | |
parent | 93afc5f20a23ece78d6d6e506ed75775b8ef2113 (diff) |
Reduce unnecessary read barriers in GC
Removed read barrier from IsUnprocessed, DequeuePendingReference,
EnqueueReference, and a few other places.
Hard to tell if GC time goes down.
EAAC:
Before GC slow path count: 254857
After GC slow path count: 1005
Bug: 30162165
Bug: 12687968
Test: test-art-host, volantis boot with CC
Change-Id: Ic2add3a9b1e1d7561b0b167f2218b10f8dbff76c
Diffstat (limited to 'runtime/gc/reference_queue.cc')
-rw-r--r-- | runtime/gc/reference_queue.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/gc/reference_queue.cc b/runtime/gc/reference_queue.cc index 6088a43ab1..62625c41b4 100644 --- a/runtime/gc/reference_queue.cc +++ b/runtime/gc/reference_queue.cc @@ -44,7 +44,9 @@ void ReferenceQueue::EnqueueReference(mirror::Reference* ref) { // 1 element cyclic queue, ie: Reference ref = ..; ref.pendingNext = ref; list_ = ref; } else { - mirror::Reference* head = list_->GetPendingNext(); + // The list is owned by the GC, everything that has been inserted must already be at least + // gray. + mirror::Reference* head = list_->GetPendingNext<kWithoutReadBarrier>(); DCHECK(head != nullptr); ref->SetPendingNext(head); } @@ -54,14 +56,14 @@ void ReferenceQueue::EnqueueReference(mirror::Reference* ref) { mirror::Reference* ReferenceQueue::DequeuePendingReference() { DCHECK(!IsEmpty()); - mirror::Reference* ref = list_->GetPendingNext(); + mirror::Reference* ref = list_->GetPendingNext<kWithoutReadBarrier>(); DCHECK(ref != nullptr); // Note: the following code is thread-safe because it is only called from ProcessReferences which // is single threaded. if (list_ == ref) { list_ = nullptr; } else { - mirror::Reference* next = ref->GetPendingNext(); + mirror::Reference* next = ref->GetPendingNext<kWithoutReadBarrier>(); list_->SetPendingNext(next); } ref->SetPendingNext(nullptr); |