diff options
Diffstat (limited to 'runtime/art_method-inl.h')
| -rw-r--r-- | runtime/art_method-inl.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index 15938c52be..950f1aa9f4 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -109,8 +109,7 @@ inline uint32_t ArtMethod::GetAccessFlags() { } inline uint16_t ArtMethod::GetMethodIndex() { - DCHECK(IsRuntimeMethod() || GetDeclaringClass()->IsResolved() || - GetDeclaringClass()->IsErroneous()); + DCHECK(IsRuntimeMethod() || GetDeclaringClass()->IsResolved()); return method_index_; } @@ -245,7 +244,9 @@ inline bool ArtMethod::IsImtUnimplementedMethod() { } inline const DexFile* ArtMethod::GetDexFile() { - return GetDexCache()->GetDexFile(); + // It is safe to avoid the read barrier here since the dex file is constant, so if we read the + // from-space dex file pointer it will be equal to the to-space copy. + return GetDexCache<kWithoutReadBarrier>()->GetDexFile(); } inline const char* ArtMethod::GetDeclaringClassDescriptor() { @@ -362,32 +363,34 @@ inline mirror::ClassLoader* ArtMethod::GetClassLoader() { return GetDeclaringClass()->GetClassLoader(); } +template <ReadBarrierOption kReadBarrierOption> inline mirror::DexCache* ArtMethod::GetDexCache() { if (LIKELY(!IsObsolete())) { - return GetDeclaringClass()->GetDexCache(); + mirror::Class* klass = GetDeclaringClass<kReadBarrierOption>(); + return klass->GetDexCache<kDefaultVerifyFlags, kReadBarrierOption>(); } else { DCHECK(!IsProxyMethod()); return GetObsoleteDexCache(); } } -template<ReadBarrierOption kReadBarrierOption> inline bool ArtMethod::IsProxyMethod() { - return GetDeclaringClass<kReadBarrierOption>()->IsProxyClass(); + // Avoid read barrier since the from-space version of the class will have the correct proxy class + // flags since they are constant for the lifetime of the class. + return GetDeclaringClass<kWithoutReadBarrier>()->IsProxyClass(); } inline ArtMethod* ArtMethod::GetInterfaceMethodIfProxy(PointerSize pointer_size) { if (LIKELY(!IsProxyMethod())) { return this; } - mirror::Class* klass = GetDeclaringClass(); ArtMethod* interface_method = mirror::DexCache::GetElementPtrSize( GetDexCacheResolvedMethods(pointer_size), GetDexMethodIndex(), pointer_size); DCHECK(interface_method != nullptr); DCHECK_EQ(interface_method, - Runtime::Current()->GetClassLinker()->FindMethodForProxy(klass, this)); + Runtime::Current()->GetClassLinker()->FindMethodForProxy(GetDeclaringClass(), this)); return interface_method; } |