OSDN Git Service

ART: Remove some unnecessary mutator lock annotations.
authorVladimir Marko <vmarko@google.com>
Tue, 26 Jan 2016 12:16:55 +0000 (12:16 +0000)
committerVladimir Marko <vmarko@google.com>
Tue, 26 Jan 2016 12:16:55 +0000 (12:16 +0000)
The StackReference<> pointer held by a Handle<> can be used
without holding the mutator lock. We already do that when
we copy Handle<>s around. Only accessing the actual content
of the pointed-to StackReference<> needs to be done while
holding the mutator lock.

Change-Id: I5f93bd7e277383192f1f16dff6883ecb26387414

compiler/optimizing/nodes.h
runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
runtime/handle.h
runtime/handle_scope.h

index 5246fd1..41c2f17 100644 (file)
@@ -159,7 +159,7 @@ class ReferenceTypeInfo : ValueObject {
 
   static ReferenceTypeInfo CreateInvalid() { return ReferenceTypeInfo(); }
 
-  static bool IsValidHandle(TypeHandle handle) SHARED_REQUIRES(Locks::mutator_lock_) {
+  static bool IsValidHandle(TypeHandle handle) {
     return handle.GetReference() != nullptr;
   }
 
index 08c9b49..638fdb4 100644 (file)
@@ -1779,8 +1779,7 @@ class BuildGenericJniFrameVisitor FINAL : public QuickArgumentVisitor {
 
   void FinalizeHandleScope(Thread* self) SHARED_REQUIRES(Locks::mutator_lock_);
 
-  StackReference<mirror::Object>* GetFirstHandleScopeEntry()
-      SHARED_REQUIRES(Locks::mutator_lock_) {
+  StackReference<mirror::Object>* GetFirstHandleScopeEntry() {
     return handle_scope_->GetHandle(0).GetReference();
   }
 
index 5b3bb60..5df010b 100644 (file)
@@ -70,8 +70,7 @@ class Handle : public ValueObject {
     return reinterpret_cast<jobject>(reference_);
   }
 
-  ALWAYS_INLINE StackReference<mirror::Object>* GetReference()
-      SHARED_REQUIRES(Locks::mutator_lock_) {
+  ALWAYS_INLINE StackReference<mirror::Object>* GetReference() {
     return reference_;
   }
 
index e617348..d53a0e4 100644 (file)
@@ -62,8 +62,7 @@ class PACKED(4) HandleScope {
   ALWAYS_INLINE mirror::Object* GetReference(size_t i) const
       SHARED_REQUIRES(Locks::mutator_lock_);
 
-  ALWAYS_INLINE Handle<mirror::Object> GetHandle(size_t i)
-      SHARED_REQUIRES(Locks::mutator_lock_);
+  ALWAYS_INLINE Handle<mirror::Object> GetHandle(size_t i);
 
   ALWAYS_INLINE MutableHandle<mirror::Object> GetMutableHandle(size_t i)
       SHARED_REQUIRES(Locks::mutator_lock_);