summaryrefslogtreecommitdiff
path: root/runtime/gc/reference_queue.h
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2022-01-26 02:43:33 +0000
committer Hans Boehm <hboehm@google.com> 2022-01-26 02:43:33 +0000
commit07cbc5ba4f117ea74faecffe14ffc0ce8aa7ee0e (patch)
tree2c3c512ebfdf1ac807c688611f8a9dd16562d654 /runtime/gc/reference_queue.h
parent0ab5b6d2afbdd71a18f8fb9b1fcf39e54cfd55a5 (diff)
Revert "Reduce pauses for weak reference access"
This reverts commit 0ab5b6d2afbdd71a18f8fb9b1fcf39e54cfd55a5. Reason for revert: Breaks CMS builds Change-Id: Ib3dfcc90ac5b7259c7f718a0373b48acc2ba10b2
Diffstat (limited to 'runtime/gc/reference_queue.h')
-rw-r--r--runtime/gc/reference_queue.h22
1 files changed, 7 insertions, 15 deletions
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h
index 3fda7167d4..06243c40a2 100644
--- a/runtime/gc/reference_queue.h
+++ b/runtime/gc/reference_queue.h
@@ -90,20 +90,17 @@ class ReferenceQueue {
collector::GarbageCollector* collector)
REQUIRES_SHARED(Locks::mutator_lock_);
- // Walks the reference list marking and dequeuing any references subject to the reference
- // clearing policy. References with a black referent are removed from the list. References
- // with white referents biased toward saving are blackened and also removed from the list.
- // Returns the number of non-null soft references. May be called concurrently with
- // AtomicEnqueueIfNotEnqueued().
+ // Walks the reference list marking any references subject to the reference clearing policy.
+ // References with a black referent are removed from the list. References with white referents
+ // biased toward saving are blackened and also removed from the list.
+ // Returns the number of non-null soft references.
uint32_t ForwardSoftReferences(MarkObjectVisitor* visitor)
- REQUIRES(!*lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
// Unlink the reference list clearing references objects with white referents. Cleared references
// registered to a reference queue are scheduled for appending by the heap worker thread.
void ClearWhiteReferences(ReferenceQueue* cleared_references,
- collector::GarbageCollector* collector,
- bool report_cleared = false)
+ collector::GarbageCollector* collector)
REQUIRES_SHARED(Locks::mutator_lock_);
void Dump(std::ostream& os) const REQUIRES_SHARED(Locks::mutator_lock_);
@@ -112,12 +109,9 @@ class ReferenceQueue {
bool IsEmpty() const {
return list_ == nullptr;
}
-
- // Clear this queue. Only safe after handing off the contents elsewhere for further processing.
void Clear() {
list_ = nullptr;
}
-
mirror::Reference* GetList() REQUIRES_SHARED(Locks::mutator_lock_) {
return list_;
}
@@ -130,10 +124,8 @@ class ReferenceQueue {
// Lock, used for parallel GC reference enqueuing. It allows for multiple threads simultaneously
// calling AtomicEnqueueIfNotEnqueued.
Mutex* const lock_;
- // The actual reference list. Only a root for the mark compact GC since it
- // will be null during root marking for other GC types. Not an ObjPtr since it
- // is accessed from multiple threads. Points to a singly-linked circular list
- // using the pendingNext field.
+ // The actual reference list. Only a root for the mark compact GC since it will be null for other
+ // GC types. Not an ObjPtr since it is accessed from multiple threads.
mirror::Reference* list_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ReferenceQueue);