summaryrefslogtreecommitdiffstats
path: root/runtime/gc/reference_queue.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-03-14 17:16:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-03-14 17:16:15 +0000
commit0dea9872082bc3e576ed6cefed86b0d6c0c45ffd (patch)
treeb4809584363705a640b8a4d5c87f9fa2af59c41e /runtime/gc/reference_queue.h
parent282cbe489046face5475991aaa1ecb5f1deba107 (diff)
parent8fa2dad7fe7909c8335101d6c8904ae997cdf29f (diff)
downloadandroid_art-0dea9872082bc3e576ed6cefed86b0d6c0c45ffd.tar.gz
android_art-0dea9872082bc3e576ed6cefed86b0d6c0c45ffd.tar.bz2
android_art-0dea9872082bc3e576ed6cefed86b0d6c0c45ffd.zip
Merge "Refactor reference code into mirror namespace."
Diffstat (limited to 'runtime/gc/reference_queue.h')
-rw-r--r--runtime/gc/reference_queue.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/runtime/gc/reference_queue.h b/runtime/gc/reference_queue.h
index 99314ba0ef..8d392babf6 100644
--- a/runtime/gc/reference_queue.h
+++ b/runtime/gc/reference_queue.h
@@ -31,6 +31,10 @@
#include "thread_pool.h"
namespace art {
+namespace mirror {
+class Reference;
+} // namespace mirror
+
namespace gc {
class Heap;
@@ -40,18 +44,18 @@ class Heap;
// java.lang.ref.Reference objects.
class ReferenceQueue {
public:
- explicit ReferenceQueue(Heap* heap);
+ explicit ReferenceQueue();
// 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.
- void AtomicEnqueueIfNotEnqueued(Thread* self, mirror::Object* ref)
+ void AtomicEnqueueIfNotEnqueued(Thread* self, mirror::Reference* ref)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(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.
- void EnqueueReference(mirror::Object* ref) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void EnqueuePendingReference(mirror::Object* ref) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- mirror::Object* DequeuePendingReference() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void EnqueueReference(mirror::Reference* ref) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void EnqueuePendingReference(mirror::Reference* ref) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ mirror::Reference* DequeuePendingReference() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// 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,
@@ -76,7 +80,7 @@ class ReferenceQueue {
void Clear() {
list_ = nullptr;
}
- mirror::Object* GetList() {
+ mirror::Reference* GetList() {
return list_;
}
@@ -84,10 +88,8 @@ class ReferenceQueue {
// Lock, used for parallel GC reference enqueuing. It allows for multiple threads simultaneously
// calling AtomicEnqueueIfNotEnqueued.
Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
- // The heap contains the reference offsets.
- Heap* const heap_;
// The actual reference list. Not a root since it will be nullptr when the GC is not running.
- mirror::Object* list_;
+ mirror::Reference* list_;
};
} // namespace gc