diff options
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); |