Switch JNI globals lock to reader-writer.
Also, verifier rejected classes lock. These locks show as contended during
dex2oat, however, they're commonly only read access is required.
Change-Id: If8bb834cc69cd8c26494c87fb7f7b20d4e41cdfd
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 505e368..3178bf1 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1184,13 +1184,13 @@
} else if (kind == kGlobal) {
JavaVMExt* vm = Runtime::Current()->GetJavaVM();
IndirectReferenceTable& globals = vm->globals;
- MutexLock mu(const_cast<Thread*>(this), vm->globals_lock);
+ ReaderMutexLock mu(const_cast<Thread*>(this), vm->globals_lock);
result = const_cast<mirror::Object*>(globals.Get(ref));
} else {
DCHECK_EQ(kind, kWeakGlobal);
JavaVMExt* vm = Runtime::Current()->GetJavaVM();
IndirectReferenceTable& weak_globals = vm->weak_globals;
- MutexLock mu(const_cast<Thread*>(this), vm->weak_globals_lock);
+ ReaderMutexLock mu(const_cast<Thread*>(this), vm->weak_globals_lock);
result = const_cast<mirror::Object*>(weak_globals.Get(ref));
if (result == kClearedJniWeakGlobal) {
// This is a special case where it's okay to return NULL.