From: Vladimir Marko Date: Tue, 26 Jan 2016 12:16:55 +0000 (+0000) Subject: ART: Remove some unnecessary mutator lock annotations. X-Git-Tag: android-x86-7.1-r1~424^2~150^2^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f39745e663f8f2634fc8858e427b77da98f8f2b4;p=android-x86%2Fart.git ART: Remove some unnecessary mutator lock annotations. 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 --- diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 5246fd1f0..41c2f17cd 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -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; } diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 08c9b4972..638fdb4f4 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -1779,8 +1779,7 @@ class BuildGenericJniFrameVisitor FINAL : public QuickArgumentVisitor { void FinalizeHandleScope(Thread* self) SHARED_REQUIRES(Locks::mutator_lock_); - StackReference* GetFirstHandleScopeEntry() - SHARED_REQUIRES(Locks::mutator_lock_) { + StackReference* GetFirstHandleScopeEntry() { return handle_scope_->GetHandle(0).GetReference(); } diff --git a/runtime/handle.h b/runtime/handle.h index 5b3bb60df..5df010bb1 100644 --- a/runtime/handle.h +++ b/runtime/handle.h @@ -70,8 +70,7 @@ class Handle : public ValueObject { return reinterpret_cast(reference_); } - ALWAYS_INLINE StackReference* GetReference() - SHARED_REQUIRES(Locks::mutator_lock_) { + ALWAYS_INLINE StackReference* GetReference() { return reference_; } diff --git a/runtime/handle_scope.h b/runtime/handle_scope.h index e617348ce..d53a0e4f9 100644 --- a/runtime/handle_scope.h +++ b/runtime/handle_scope.h @@ -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 GetHandle(size_t i) - SHARED_REQUIRES(Locks::mutator_lock_); + ALWAYS_INLINE Handle GetHandle(size_t i); ALWAYS_INLINE MutableHandle GetMutableHandle(size_t i) SHARED_REQUIRES(Locks::mutator_lock_);