summaryrefslogtreecommitdiff
path: root/runtime/base/mutex.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-10-14 13:27:12 -0700
committer Andreas Gampe <agampe@google.com> 2016-10-14 14:48:26 -0700
commit05a364c8d8271ceeca307d04736f53e92d03de9d (patch)
tree70e166900c99564c0ab3596ef3c8d5d85f14e767 /runtime/base/mutex.h
parent4aed412037e6e7bad2cf589645449df960b88200 (diff)
ART: Make JNI global and weak global locks global
Add them to Locks. Give the JNI global table lock a lock level, close to the weak global JNI references. Bug: 31684578 Test: m test-art-host Change-Id: I3857a3b0be69b16811d9999096b2c42e7a25d227
Diffstat (limited to 'runtime/base/mutex.h')
-rw-r--r--runtime/base/mutex.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index b3ff6c20bc..e0cca7b0ce 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -68,6 +68,7 @@ enum LockLevel {
kMarkSweepMarkStackLock,
kTransactionLogLock,
kJniWeakGlobalsLock,
+ kJniGlobalsLock,
kReferenceQueueSoftReferencesLock,
kReferenceQueuePhantomReferencesLock,
kReferenceQueueFinalizerReferencesLock,
@@ -678,8 +679,14 @@ class Locks {
// Guards soft references queue.
static Mutex* reference_queue_soft_references_lock_ ACQUIRED_AFTER(reference_queue_phantom_references_lock_);
+ // Guard accesses to the JNI Global Reference table.
+ static ReaderWriterMutex* jni_globals_lock_ ACQUIRED_AFTER(reference_queue_soft_references_lock_);
+
+ // Guard accesses to the JNI Weak Global Reference table.
+ static Mutex* jni_weak_globals_lock_ ACQUIRED_AFTER(jni_globals_lock_);
+
// Have an exclusive aborting thread.
- static Mutex* abort_lock_ ACQUIRED_AFTER(reference_queue_soft_references_lock_);
+ static Mutex* abort_lock_ ACQUIRED_AFTER(jni_weak_globals_lock_);
// Allow mutual exclusion when manipulating Thread::suspend_count_.
// TODO: Does the trade-off of a per-thread lock make sense?