diff options
Diffstat (limited to 'compiler/optimizing/inliner.cc')
-rw-r--r-- | compiler/optimizing/inliner.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 968fe3e73c..82d63573bc 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -85,11 +85,9 @@ bool HInliner::TryInline(HInvoke* invoke_instruction, return false; } + bool can_use_dex_cache = true; if (resolved_method->GetDexFile()->GetLocation().compare(outer_dex_file.GetLocation()) != 0) { - VLOG(compiler) << "Did not inline " - << PrettyMethod(method_index, outer_dex_file) - << " because it is in a different dex file"; - return false; + can_use_dex_cache = false; } const DexFile::CodeItem* code_item = resolved_method->GetCodeItem(); @@ -124,7 +122,7 @@ bool HInliner::TryInline(HInvoke* invoke_instruction, return false; } - if (!TryBuildAndInline(resolved_method, invoke_instruction, method_index)) { + if (!TryBuildAndInline(resolved_method, invoke_instruction, method_index, can_use_dex_cache)) { resolved_method->SetShouldNotInline(); return false; } @@ -136,7 +134,8 @@ bool HInliner::TryInline(HInvoke* invoke_instruction, bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, HInvoke* invoke_instruction, - uint32_t method_index) const { + uint32_t method_index, + bool can_use_dex_cache) const { ScopedObjectAccess soa(Thread::Current()); const DexFile::CodeItem* code_item = resolved_method->GetCodeItem(); const DexFile& outer_dex_file = *outer_compilation_unit_.GetDexFile(); @@ -145,10 +144,10 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, nullptr, outer_compilation_unit_.GetClassLoader(), outer_compilation_unit_.GetClassLinker(), - outer_dex_file, + *resolved_method->GetDexFile(), code_item, resolved_method->GetDeclaringClass()->GetDexClassDefIndex(), - method_index, + resolved_method->GetDexMethodIndex(), resolved_method->GetAccessFlags(), nullptr); @@ -159,7 +158,7 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, HGraphBuilder builder(callee_graph, &dex_compilation_unit, &outer_compilation_unit_, - &outer_dex_file, + resolved_method->GetDexFile(), compiler_driver_, &inline_stats); @@ -200,7 +199,7 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, if (depth_ + 1 < kDepthLimit) { HInliner inliner( - callee_graph, outer_compilation_unit_, compiler_driver_, stats_, depth_ + 1); + callee_graph, dex_compilation_unit, compiler_driver_, stats_, depth_ + 1); inliner.Run(); } @@ -235,6 +234,13 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, << " needs an environment"; return false; } + + if (!can_use_dex_cache && current->NeedsDexCache()) { + VLOG(compiler) << "Method " << PrettyMethod(method_index, outer_dex_file) + << " could not be inlined because " << current->DebugName() + << " it is in a different dex file and requires access to the dex cache"; + return false; + } } } |