diff options
Diffstat (limited to 'runtime/art_method.cc')
-rw-r--r-- | runtime/art_method.cc | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index ac433dd403..3e7ed9799d 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -61,6 +61,19 @@ DEFINE_RUNTIME_DEBUG_FLAG(ArtMethod, kCheckDeclaringClassState); static_assert(ArtMethod::kRuntimeMethodDexMethodIndex == DexFile::kDexNoIndex, "Wrong runtime-method dex method index"); +ArtMethod* ArtMethod::GetCanonicalMethod(PointerSize pointer_size) { + if (LIKELY(!IsDefault())) { + return this; + } else { + mirror::Class* declaring_class = GetDeclaringClass(); + ArtMethod* ret = declaring_class->FindDeclaredVirtualMethod(declaring_class->GetDexCache(), + GetDexMethodIndex(), + pointer_size); + DCHECK(ret != nullptr); + return ret; + } +} + ArtMethod* ArtMethod::GetNonObsoleteMethod() { DCHECK_EQ(kRuntimePointerSize, Runtime::Current()->GetClassLinker()->GetImagePointerSize()); if (LIKELY(!IsObsolete())) { @@ -405,15 +418,19 @@ bool ArtMethod::IsOverridableByDefaultMethod() { bool ArtMethod::IsAnnotatedWithFastNative() { return IsAnnotatedWith(WellKnownClasses::dalvik_annotation_optimization_FastNative, - DexFile::kDexVisibilityBuild); + DexFile::kDexVisibilityBuild, + /* lookup_in_resolved_boot_classes */ true); } bool ArtMethod::IsAnnotatedWithCriticalNative() { return IsAnnotatedWith(WellKnownClasses::dalvik_annotation_optimization_CriticalNative, - DexFile::kDexVisibilityBuild); + DexFile::kDexVisibilityBuild, + /* lookup_in_resolved_boot_classes */ true); } -bool ArtMethod::IsAnnotatedWith(jclass klass, uint32_t visibility) { +bool ArtMethod::IsAnnotatedWith(jclass klass, + uint32_t visibility, + bool lookup_in_resolved_boot_classes) { Thread* self = Thread::Current(); ScopedObjectAccess soa(self); StackHandleScope<1> shs(self); @@ -422,10 +439,8 @@ bool ArtMethod::IsAnnotatedWith(jclass klass, uint32_t visibility) { DCHECK(annotation->IsAnnotation()); Handle<mirror::Class> annotation_handle(shs.NewHandle(annotation)); - // Note: Resolves any method annotations' classes as a side-effect. - // -- This seems allowed by the spec since it says we can preload any classes - // referenced by another classes's constant pool table. - return annotations::IsMethodAnnotationPresent(this, annotation_handle, visibility); + return annotations::IsMethodAnnotationPresent( + this, annotation_handle, visibility, lookup_in_resolved_boot_classes); } static uint32_t GetOatMethodIndexFromMethodIndex(const DexFile& dex_file, |