diff options
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils-inl.h')
-rw-r--r-- | runtime/entrypoints/entrypoint_utils-inl.h | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 84299d5077..5b931a15be 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -80,10 +80,20 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method, for (InlineInfo inline_info : inline_infos) { DCHECK(!inline_info.EncodesArtMethod()); DCHECK_NE(inline_info.GetDexPc(), static_cast<uint32_t>(-1)); - uint32_t method_index = code_info.GetMethodIndexOf(inline_info); - ArtMethod* inlined_method = class_linker->LookupResolvedMethod(method_index, - method->GetDexCache(), - method->GetClassLoader()); + MethodInfo method_info = code_info.GetMethodInfoOf(inline_info); + uint32_t method_index = method_info.GetMethodIndex(); + ArtMethod* inlined_method; + if (method_info.HasDexFileIndex()) { + const DexFile* dex_file = class_linker->GetBootClassPath()[method_info.GetDexFileIndex()]; + ObjPtr<mirror::DexCache> dex_cache = class_linker->FindDexCache(Thread::Current(), *dex_file); + // The class loader is always nullptr for this case so we can simplify the call. + DCHECK_EQ(dex_cache->GetClassLoader(), nullptr); + inlined_method = class_linker->LookupResolvedMethod(method_index, dex_cache, nullptr); + } else { + inlined_method = class_linker->LookupResolvedMethod( + method_index, outer_method->GetDexCache(), outer_method->GetClassLoader()); + } + if (UNLIKELY(inlined_method == nullptr)) { LOG(FATAL) << "Could not find an inlined method from an .oat file: " << method->GetDexFile()->PrettyMethod(method_index) << " . " @@ -91,7 +101,8 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method, UNREACHABLE(); } DCHECK(!inlined_method->IsRuntimeMethod()); - if (UNLIKELY(inlined_method->GetDexFile() != method->GetDexFile())) { + if (UNLIKELY(inlined_method->GetDexFile() != method->GetDexFile() && + !method_info.HasDexFileIndex())) { // TODO: We could permit inlining within a multi-dex oat file and the boot image, // even going back from boot image methods to the same oat file. However, this is // not currently implemented in the compiler. Therefore crossing dex file boundary @@ -99,13 +110,14 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method, bool target_sdk_at_least_p = IsSdkVersionSetAndAtLeast(Runtime::Current()->GetTargetSdkVersion(), SdkVersion::kP); LOG(target_sdk_at_least_p ? FATAL : WARNING) - << "Inlined method resolution crossed dex file boundary: from " - << method->PrettyMethod() + << "Inlined method resolution crossed dex file boundary: from " << method->PrettyMethod() << " in " << method->GetDexFile()->GetLocation() << "/" - << static_cast<const void*>(method->GetDexFile()) - << " to " << inlined_method->PrettyMethod() - << " in " << inlined_method->GetDexFile()->GetLocation() << "/" - << static_cast<const void*>(inlined_method->GetDexFile()) << ". " + << static_cast<const void*>(method->GetDexFile()) << " to " + << inlined_method->PrettyMethod() << " in " << inlined_method->GetDexFile()->GetLocation() + << "/" << static_cast<const void*>(inlined_method->GetDexFile()) << ". " + << "The outermost method in the chain is: " << outer_method->PrettyMethod() << " in " + << outer_method->GetDexFile()->GetLocation() << "/" + << static_cast<const void*>(outer_method->GetDexFile()) << "This must be due to duplicate classes or playing wrongly with class loaders. " << "The runtime is in an unsafe state."; } |