diff options
-rw-r--r-- | runtime/verifier/method_verifier.cc | 13 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.h | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 95fda9d8df..c420ea68d4 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -4063,20 +4063,19 @@ void MethodVerifier::SetDexGcMap(MethodReference ref, const std::vector<uint8_t> void MethodVerifier::SetSafeCastMap(MethodReference ref, const MethodSafeCastSet* cast_set) { DCHECK(Runtime::Current()->IsCompiler()); - MutexLock mu(Thread::Current(), *safecast_map_lock_); + WriterMutexLock mu(Thread::Current(), *safecast_map_lock_); SafeCastMap::iterator it = safecast_map_->find(ref); if (it != safecast_map_->end()) { delete it->second; safecast_map_->erase(it); } - safecast_map_->Put(ref, cast_set); DCHECK(safecast_map_->find(ref) != safecast_map_->end()); } bool MethodVerifier::IsSafeCast(MethodReference ref, uint32_t pc) { DCHECK(Runtime::Current()->IsCompiler()); - MutexLock mu(Thread::Current(), *safecast_map_lock_); + ReaderMutexLock mu(Thread::Current(), *safecast_map_lock_); SafeCastMap::const_iterator it = safecast_map_->find(ref); if (it == safecast_map_->end()) { return false; @@ -4197,7 +4196,7 @@ bool MethodVerifier::IsCandidateForCompilation(const DexFile::CodeItem* code_ite ReaderWriterMutex* MethodVerifier::dex_gc_maps_lock_ = NULL; MethodVerifier::DexGcMapTable* MethodVerifier::dex_gc_maps_ = NULL; -Mutex* MethodVerifier::safecast_map_lock_ = NULL; +ReaderWriterMutex* MethodVerifier::safecast_map_lock_ = NULL; MethodVerifier::SafeCastMap* MethodVerifier::safecast_map_ = NULL; ReaderWriterMutex* MethodVerifier::devirt_maps_lock_ = NULL; @@ -4215,9 +4214,9 @@ void MethodVerifier::Init() { dex_gc_maps_ = new MethodVerifier::DexGcMapTable; } - safecast_map_lock_ = new Mutex("verifier Cast Elision lock"); + safecast_map_lock_ = new ReaderWriterMutex("verifier Cast Elision lock"); { - MutexLock mu(self, *safecast_map_lock_); + WriterMutexLock mu(self, *safecast_map_lock_); safecast_map_ = new MethodVerifier::SafeCastMap(); } @@ -4250,7 +4249,7 @@ void MethodVerifier::Shutdown() { dex_gc_maps_lock_ = NULL; { - MutexLock mu(self, *safecast_map_lock_); + WriterMutexLock mu(self, *safecast_map_lock_); STLDeleteValues(safecast_map_); delete safecast_map_; safecast_map_ = NULL; diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index c7b8a740a8..e01f2c08c1 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -648,7 +648,7 @@ class MethodVerifier { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void SetSafeCastMap(MethodReference ref, const MethodSafeCastSet* mscs); LOCKS_EXCLUDED(safecast_map_lock_); - static Mutex* safecast_map_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; + static ReaderWriterMutex* safecast_map_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; static SafeCastMap* safecast_map_ GUARDED_BY(safecast_map_lock_); // Devirtualization map. |