summaryrefslogtreecommitdiff
path: root/runtime/gc/reference_queue.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2014-05-06 10:57:27 -0700
committer Mathieu Chartier <mathieuc@google.com> 2014-05-07 15:28:35 -0700
commit78f7b4c04ab6e8b5581921bc95b67a9beee1c246 (patch)
tree78b93c72007478b5bfc3b88ab413fa3d772da723 /runtime/gc/reference_queue.h
parent052a647973b590c9d5007a2e16f313f4e32a70bd (diff)
Add concurrent reference processing.
Concurrent reference processing currently works by going into native code from java.lang.ref.Reference.get(). From there, we have a fast path if the references aren't being processed which returns the referent without needing to access any locks. In the slow path we block until reference processing is complete. It may be possible to improve the slow path if the referent is blackened. TODO: Investigate doing the fast path in java code by using racy reads of a static volatile boolean. This will work as long as there are no suspend points inbetween the boolean read and referent read. Bug: 14381653 Change-Id: I1546b55be4691fe4ff4aa6d857b234cce7187d87
Diffstat (limited to 'runtime/gc/reference_queue.h')
-rw-r--r--runtime/gc/reference_queue.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h
index 8d392babf6..4f223e22e3 100644
--- a/runtime/gc/reference_queue.h
+++ b/runtime/gc/reference_queue.h
@@ -59,8 +59,8 @@ class ReferenceQueue {
// Enqueues finalizer references with white referents. White referents are blackened, moved to the
// zombie field, and the referent field is cleared.
void EnqueueFinalizerReferences(ReferenceQueue& cleared_references,
- IsMarkedCallback is_marked_callback,
- MarkObjectCallback recursive_mark_callback, void* arg)
+ IsMarkedCallback* is_marked_callback,
+ MarkObjectCallback* mark_object_callback, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// 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
@@ -69,7 +69,8 @@ class ReferenceQueue {
SHARED_LOCKS_REQUIRED(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, IsMarkedCallback is_marked_callback,
+ void ClearWhiteReferences(ReferenceQueue& cleared_references,
+ IsMarkedCallback* is_marked_callback,
void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void Dump(std::ostream& os) const