diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-05-26 14:35:06 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-05-26 15:20:51 +0100 |
commit | 4fa04a672482f12cae0fa9e9e4c2f0cc1b1d98d5 (patch) | |
tree | 2b194d882bf4d291d3bbb834152ddca3d54a1aba /compiler/optimizing | |
parent | 8ae14d8ed082b1d479b8488831d74acb06cd31c8 (diff) | |
download | art-4fa04a672482f12cae0fa9e9e4c2f0cc1b1d98d5.tar.gz art-4fa04a672482f12cae0fa9e9e4c2f0cc1b1d98d5.tar.bz2 art-4fa04a672482f12cae0fa9e9e4c2f0cc1b1d98d5.zip |
Make inlining deterministic.
Only the case where two methods are not in the same dex
file could lead to undeterministic behavior.
bug:20037935
(cherry picked from commit ff199d84b02efe6cd7162a3c414db99240592454)
Change-Id: If1b0bff3a228be4caec9a068210b1d4d2a7bae1f
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/inliner.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index afffc7ab4f..086454321c 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -141,7 +141,6 @@ bool HInliner::TryInline(HInvoke* invoke_instruction, } if (!TryBuildAndInline(resolved_method, invoke_instruction, method_index, can_use_dex_cache)) { - resolved_method->SetShouldNotInline(); return false; } @@ -187,6 +186,7 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, if (!builder.BuildGraph(*code_item)) { VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " could not be built, so cannot be inlined"; + resolved_method->SetShouldNotInline(); return false; } @@ -194,12 +194,14 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, compiler_driver_->GetInstructionSet())) { VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " cannot be inlined because of the register allocator"; + resolved_method->SetShouldNotInline(); return false; } if (!callee_graph->TryBuildingSsa()) { VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " could not be transformed to SSA"; + resolved_method->SetShouldNotInline(); return false; } @@ -236,6 +238,7 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, if (block->IsLoopHeader()) { VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " could not be inlined because it contains a loop"; + resolved_method->SetShouldNotInline(); return false; } @@ -251,6 +254,7 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " could not be inlined because " << current->DebugName() << " can throw"; + resolved_method->SetShouldNotInline(); return false; } @@ -258,6 +262,7 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " could not be inlined because " << current->DebugName() << " needs an environment"; + resolved_method->SetShouldNotInline(); return false; } @@ -265,6 +270,8 @@ bool HInliner::TryBuildAndInline(Handle<mirror::ArtMethod> resolved_method, VLOG(compiler) << "Method " << PrettyMethod(method_index, caller_dex_file) << " could not be inlined because " << current->DebugName() << " it is in a different dex file and requires access to the dex cache"; + // Do not flag the method as not-inlineable. A caller within the same + // dex file could still successfully inline it. return false; } } |