summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-08-28 14:41:50 +0200
committerSebastien Hertz <shertz@google.com>2014-09-11 11:37:43 +0200
commit4537c41b9a58c2280b3ad8bcf0130ed11c7a54f6 (patch)
tree94017c28f80cd0cbbe2d9aa61f9eabc02e6047fc /runtime/jdwp
parentc7f6b86c269727fe031146b9c18652d40916d46f (diff)
downloadart-4537c41b9a58c2280b3ad8bcf0130ed11c7a54f6.tar.gz
art-4537c41b9a58c2280b3ad8bcf0130ed11c7a54f6.tar.bz2
art-4537c41b9a58c2280b3ad8bcf0130ed11c7a54f6.zip
Don't hold any lock when visiting classes from JDWP
Computes reference type ids of all loaded classes without holding the class linker lock. Because computing the JDWP reference type id can cause thread suspension, we can't hold any lock. This is detected in debug build (using libartd.so) and causes an abort. Also adds missing thread safety annotations related to ObjectRegistry::lock_. Bug: 17305632 Bug: 16720689 (cherry picked from commit 95795e286145a4aece5c4a095fa2e7e88ee2115a) Change-Id: If4fb069790a0a3358ad49da8f75c62a54c0f0b56
Diffstat (limited to 'runtime/jdwp')
-rw-r--r--runtime/jdwp/object_registry.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/runtime/jdwp/object_registry.h b/runtime/jdwp/object_registry.h
index 0e46d5cf20..f2f43c41e0 100644
--- a/runtime/jdwp/object_registry.h
+++ b/runtime/jdwp/object_registry.h
@@ -80,10 +80,14 @@ class ObjectRegistry {
void Clear() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void DisableCollection(JDWP::ObjectId id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void EnableCollection(JDWP::ObjectId id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void DisableCollection(JDWP::ObjectId id)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(lock_);
- bool IsCollected(JDWP::ObjectId id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void EnableCollection(JDWP::ObjectId id)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(lock_);
+
+ bool IsCollected(JDWP::ObjectId id)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(lock_);
void DisposeObject(JDWP::ObjectId id, uint32_t reference_count)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -94,13 +98,24 @@ class ObjectRegistry {
private:
JDWP::ObjectId InternalAdd(mirror::Object* o)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::thread_list_lock_);
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ LOCKS_EXCLUDED(lock_, Locks::thread_list_lock_);
+
mirror::Object* InternalGet(JDWP::ObjectId id, JDWP::JdwpError* error)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void Demote(ObjectRegistryEntry& entry) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, lock_);
- void Promote(ObjectRegistryEntry& entry) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, lock_);
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ LOCKS_EXCLUDED(lock_);
+
+ void Demote(ObjectRegistryEntry& entry)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ EXCLUSIVE_LOCKS_REQUIRED(lock_);
+
+ void Promote(ObjectRegistryEntry& entry)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ EXCLUSIVE_LOCKS_REQUIRED(lock_);
+
bool Contains(mirror::Object* o, ObjectRegistryEntry** out_entry)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(lock_);
+
bool ContainsLocked(Thread* self, mirror::Object* o, int32_t identity_hash_code,
ObjectRegistryEntry** out_entry)
EXCLUSIVE_LOCKS_REQUIRED(lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);