diff options
author | 2016-10-14 13:27:12 -0700 | |
---|---|---|
committer | 2016-10-14 14:48:26 -0700 | |
commit | 05a364c8d8271ceeca307d04736f53e92d03de9d (patch) | |
tree | 70e166900c99564c0ab3596ef3c8d5d85f14e767 /runtime/base/mutex.cc | |
parent | 4aed412037e6e7bad2cf589645449df960b88200 (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.cc')
-rw-r--r-- | runtime/base/mutex.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc index 1183dea7c4..e77e6d7170 100644 --- a/runtime/base/mutex.cc +++ b/runtime/base/mutex.cc @@ -64,6 +64,8 @@ Mutex* Locks::thread_suspend_count_lock_ = nullptr; Mutex* Locks::trace_lock_ = nullptr; Mutex* Locks::unexpected_signal_lock_ = nullptr; Uninterruptible Roles::uninterruptible_; +ReaderWriterMutex* Locks::jni_globals_lock_ = nullptr; +Mutex* Locks::jni_weak_globals_lock_ = nullptr; struct AllMutexData { // A guard for all_mutexes_ that's not a mutex (Mutexes must CAS to acquire and busy wait). @@ -1088,6 +1090,15 @@ void Locks::Init() { DCHECK(reference_queue_soft_references_lock_ == nullptr); reference_queue_soft_references_lock_ = new Mutex("ReferenceQueue soft references lock", current_lock_level); + UPDATE_CURRENT_LOCK_LEVEL(kJniGlobalsLock); + DCHECK(jni_globals_lock_ == nullptr); + jni_globals_lock_ = + new ReaderWriterMutex("JNI global reference table lock", current_lock_level); + + UPDATE_CURRENT_LOCK_LEVEL(kJniWeakGlobalsLock); + DCHECK(jni_weak_globals_lock_ == nullptr); + jni_weak_globals_lock_ = new Mutex("JNI weak global reference table lock", current_lock_level); + UPDATE_CURRENT_LOCK_LEVEL(kAbortLock); DCHECK(abort_lock_ == nullptr); abort_lock_ = new Mutex("abort lock", current_lock_level, true); |