diff options
| author | 2016-02-02 20:22:47 +0000 | |
|---|---|---|
| committer | 2016-02-02 20:22:47 +0000 | |
| commit | a89d6d630b6fdb591d3dce536f8bca35deae307e (patch) | |
| tree | dbc55a834cbc60e5251884bc0901cd285b536561 /runtime/gc/reference_queue.h | |
| parent | 1ef02af31d5936a59ddeb762cb3cf767b599787a (diff) | |
| parent | c4695dfdab80c280c98a89c20e027a3804191585 (diff) | |
Merge "Always use pendingNext to test enqueability of references."
Diffstat (limited to 'runtime/gc/reference_queue.h')
| -rw-r--r-- | runtime/gc/reference_queue.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h index aabac97742..04d3454c04 100644 --- a/runtime/gc/reference_queue.h +++ b/runtime/gc/reference_queue.h @@ -44,27 +44,24 @@ class GarbageCollector; class Heap; // Used to temporarily store java.lang.ref.Reference(s) during GC and prior to queueing on the -// appropriate java.lang.ref.ReferenceQueue. The linked list is maintained in the -// java.lang.ref.Reference objects. +// appropriate java.lang.ref.ReferenceQueue. The linked list is maintained as an unordered, +// circular, and singly-linked list using the pendingNext fields of the java.lang.ref.Reference +// objects. class ReferenceQueue { public: explicit ReferenceQueue(Mutex* lock); - // Enqueue a reference if is not already enqueued. Thread safe to call from multiple threads - // since it uses a lock to avoid a race between checking for the references presence and adding - // it. + // Enqueue a reference if it is unprocessed. Thread safe to call from multiple + // threads since it uses a lock to avoid a race between checking for the references presence and + // adding it. void AtomicEnqueueIfNotEnqueued(Thread* self, mirror::Reference* ref) SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!*lock_); - // Enqueue a reference, unlike EnqueuePendingReference, enqueue reference checks that the - // reference IsEnqueueable. Not thread safe, used when mutators are paused to minimize lock - // overhead. + // Enqueue a reference. The reference must be unprocessed. + // Not thread safe, used when mutators are paused to minimize lock overhead. void EnqueueReference(mirror::Reference* ref) SHARED_REQUIRES(Locks::mutator_lock_); - // Enqueue a reference without checking that it is enqueable. - void EnqueuePendingReference(mirror::Reference* ref) SHARED_REQUIRES(Locks::mutator_lock_); - - // Dequeue the first reference (returns list_). + // Dequeue a reference from the queue and return that dequeued reference. mirror::Reference* DequeuePendingReference() SHARED_REQUIRES(Locks::mutator_lock_); // Enqueues finalizer references with white referents. White referents are blackened, moved to |