diff options
author | 2016-01-22 14:18:57 -0800 | |
---|---|---|
committer | 2016-01-26 15:19:36 -0800 | |
commit | 522d51b088c63d757e487d07d769f8f09e042f2a (patch) | |
tree | f1b5a1646ef0fa68f7b51e68caaf1f82624099e2 /runtime/gc/reference_queue.cc | |
parent | c31fb58453ec1eba82390c3313623d37314c5490 (diff) |
Factor out common code for SetPendingNext.
Change-Id: I6c1f9cd6da7b2c21714175455e61479273d3669f
Diffstat (limited to 'runtime/gc/reference_queue.cc')
-rw-r--r-- | runtime/gc/reference_queue.cc | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/runtime/gc/reference_queue.cc b/runtime/gc/reference_queue.cc index 56957baebf..67dcc2d1a8 100644 --- a/runtime/gc/reference_queue.cc +++ b/runtime/gc/reference_queue.cc @@ -49,17 +49,9 @@ void ReferenceQueue::EnqueuePendingReference(mirror::Reference* ref) { list_ = ref; } else { mirror::Reference* head = list_->GetPendingNext(); - if (Runtime::Current()->IsActiveTransaction()) { - ref->SetPendingNext<true>(head); - } else { - ref->SetPendingNext<false>(head); - } - } - if (Runtime::Current()->IsActiveTransaction()) { - list_->SetPendingNext<true>(ref); - } else { - list_->SetPendingNext<false>(ref); + ref->SetPendingNext(head); } + list_->SetPendingNext(ref); } mirror::Reference* ReferenceQueue::DequeuePendingReference() { @@ -74,18 +66,10 @@ mirror::Reference* ReferenceQueue::DequeuePendingReference() { list_ = nullptr; } else { mirror::Reference* next = head->GetPendingNext(); - if (Runtime::Current()->IsActiveTransaction()) { - list_->SetPendingNext<true>(next); - } else { - list_->SetPendingNext<false>(next); - } + list_->SetPendingNext(next); ref = head; } - if (Runtime::Current()->IsActiveTransaction()) { - ref->SetPendingNext<true>(nullptr); - } else { - ref->SetPendingNext<false>(nullptr); - } + ref->SetPendingNext(nullptr); Heap* heap = Runtime::Current()->GetHeap(); if (kUseBakerOrBrooksReadBarrier && heap->CurrentCollectorType() == kCollectorTypeCC && heap->ConcurrentCopyingCollector()->IsActive()) { |