diff options
| -rw-r--r-- | runtime/art_method-inl.h | 9 | ||||
| -rw-r--r-- | runtime/art_method.h | 43 |
2 files changed, 22 insertions, 30 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index 65bcefa354..d6b2b7e04d 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -35,8 +35,6 @@ #include "quick/quick_method_frame_info.h" #include "read_barrier-inl.h" #include "runtime-inl.h" -#include "scoped_thread_state_change.h" -#include "thread-inl.h" #include "utils.h" namespace art { @@ -78,11 +76,8 @@ inline bool ArtMethod::CASDeclaringClass(mirror::Class* expected_class, } inline uint32_t ArtMethod::GetAccessFlags() { - if (kIsDebugBuild) { - ScopedObjectAccess soa(Thread::Current()); - CHECK(IsRuntimeMethod() || GetDeclaringClass()->IsIdxLoaded() || - GetDeclaringClass()->IsErroneous()); - } + DCHECK(IsRuntimeMethod() || GetDeclaringClass()->IsIdxLoaded() || + GetDeclaringClass()->IsErroneous()); return access_flags_; } diff --git a/runtime/art_method.h b/runtime/art_method.h index 0315c3a953..f78c8274b0 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -75,9 +75,7 @@ class ArtMethod FINAL { return MemberOffset(OFFSETOF_MEMBER(ArtMethod, declaring_class_)); } - // Note: GetAccessFlags acquires the mutator lock in debug mode to check that it is not called for - // a proxy method. - ALWAYS_INLINE uint32_t GetAccessFlags(); + ALWAYS_INLINE uint32_t GetAccessFlags() SHARED_REQUIRES(Locks::mutator_lock_); void SetAccessFlags(uint32_t new_access_flags) { // Not called within a transaction. @@ -88,78 +86,77 @@ class ArtMethod FINAL { InvokeType GetInvokeType() SHARED_REQUIRES(Locks::mutator_lock_); // Returns true if the method is declared public. - bool IsPublic() { + bool IsPublic() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccPublic) != 0; } // Returns true if the method is declared private. - bool IsPrivate() { + bool IsPrivate() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccPrivate) != 0; } // Returns true if the method is declared static. - bool IsStatic() { + bool IsStatic() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccStatic) != 0; } // Returns true if the method is a constructor. - bool IsConstructor() { + bool IsConstructor() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccConstructor) != 0; } // Returns true if the method is a class initializer. - bool IsClassInitializer() { + bool IsClassInitializer() SHARED_REQUIRES(Locks::mutator_lock_) { return IsConstructor() && IsStatic(); } // Returns true if the method is static, private, or a constructor. - bool IsDirect() { + bool IsDirect() SHARED_REQUIRES(Locks::mutator_lock_) { return IsDirect(GetAccessFlags()); } static bool IsDirect(uint32_t access_flags) { - constexpr uint32_t direct = kAccStatic | kAccPrivate | kAccConstructor; - return (access_flags & direct) != 0; + return (access_flags & (kAccStatic | kAccPrivate | kAccConstructor)) != 0; } // Returns true if the method is declared synchronized. - bool IsSynchronized() { - constexpr uint32_t synchonized = kAccSynchronized | kAccDeclaredSynchronized; + bool IsSynchronized() SHARED_REQUIRES(Locks::mutator_lock_) { + uint32_t synchonized = kAccSynchronized | kAccDeclaredSynchronized; return (GetAccessFlags() & synchonized) != 0; } - bool IsFinal() { + bool IsFinal() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccFinal) != 0; } - bool IsMiranda() { + bool IsMiranda() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccMiranda) != 0; } - bool IsNative() { + bool IsNative() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccNative) != 0; } - bool IsFastNative() { - constexpr uint32_t mask = kAccFastNative | kAccNative; + bool IsFastNative() SHARED_REQUIRES(Locks::mutator_lock_) { + uint32_t mask = kAccFastNative | kAccNative; return (GetAccessFlags() & mask) == mask; } - bool IsAbstract() { + bool IsAbstract() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccAbstract) != 0; } - bool IsSynthetic() { + bool IsSynthetic() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccSynthetic) != 0; } bool IsProxyMethod() SHARED_REQUIRES(Locks::mutator_lock_); - bool IsPreverified() { + bool IsPreverified() SHARED_REQUIRES(Locks::mutator_lock_) { return (GetAccessFlags() & kAccPreverified) != 0; } - void SetPreverified() { + void SetPreverified() SHARED_REQUIRES(Locks::mutator_lock_) { DCHECK(!IsPreverified()); SetAccessFlags(GetAccessFlags() | kAccPreverified); } @@ -407,7 +404,7 @@ class ArtMethod FINAL { return GetNativePointer<void*>(EntryPointFromJniOffset(pointer_size), pointer_size); } - void SetEntryPointFromJni(const void* entrypoint) { + void SetEntryPointFromJni(const void* entrypoint) SHARED_REQUIRES(Locks::mutator_lock_) { DCHECK(IsNative()); SetEntryPointFromJniPtrSize(entrypoint, sizeof(void*)); } |