diff options
author | Sebastien Hertz <shertz@google.com> | 2015-04-13 17:04:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-13 17:04:58 +0000 |
commit | fac107bdddb5f2370f762e55a89847570e901245 (patch) | |
tree | afde3114490d3deceee2be122f69a84528a5e972 /runtime/jdwp | |
parent | a4c7aa2ba0485c2c876107ca6e1ce1f835ae23be (diff) | |
parent | 692063955ae845d8bd9fa2d22a50a1e06513bdcf (diff) | |
download | art-fac107bdddb5f2370f762e55a89847570e901245.tar.gz art-fac107bdddb5f2370f762e55a89847570e901245.tar.bz2 art-fac107bdddb5f2370f762e55a89847570e901245.zip |
Merge "JDWP: fix thread_list deadlock"
Diffstat (limited to 'runtime/jdwp')
-rw-r--r-- | runtime/jdwp/object_registry.cc | 4 | ||||
-rw-r--r-- | runtime/jdwp/object_registry.h | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/runtime/jdwp/object_registry.cc b/runtime/jdwp/object_registry.cc index 99a005df21..a42a58f601 100644 --- a/runtime/jdwp/object_registry.cc +++ b/runtime/jdwp/object_registry.cc @@ -50,6 +50,10 @@ JDWP::ObjectId ObjectRegistry::InternalAdd(mirror::Object* o) { Thread* const self = Thread::Current(); self->AssertNoPendingException(); + // Object::IdentityHashCode may cause these locks to be held so check we do not already + // hold them. + Locks::thread_list_lock_->AssertNotHeld(self); + Locks::thread_suspend_count_lock_->AssertNotHeld(self); StackHandleScope<1> hs(self); Handle<mirror::Object> obj_h(hs.NewHandle(o)); diff --git a/runtime/jdwp/object_registry.h b/runtime/jdwp/object_registry.h index 0693f334bf..27a4e55f41 100644 --- a/runtime/jdwp/object_registry.h +++ b/runtime/jdwp/object_registry.h @@ -62,9 +62,13 @@ class ObjectRegistry { ObjectRegistry(); JDWP::ObjectId Add(mirror::Object* o) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::thread_list_lock_); + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) + LOCKS_EXCLUDED(Locks::thread_list_lock_, + Locks::thread_suspend_count_lock_); JDWP::RefTypeId AddRefType(mirror::Class* c) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::thread_list_lock_); + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) + LOCKS_EXCLUDED(Locks::thread_list_lock_, + Locks::thread_suspend_count_lock_); template<typename T> T Get(JDWP::ObjectId id, JDWP::JdwpError* error) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -96,7 +100,9 @@ class ObjectRegistry { private: JDWP::ObjectId InternalAdd(mirror::Object* o) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) - LOCKS_EXCLUDED(lock_, Locks::thread_list_lock_); + LOCKS_EXCLUDED(lock_, + Locks::thread_list_lock_, + Locks::thread_suspend_count_lock_); mirror::Object* InternalGet(JDWP::ObjectId id, JDWP::JdwpError* error) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) |