summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-05-26 14:35:06 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-05-26 14:37:34 +0100
commitd0261431ec6e2224c8bb58e194d90ada82475e20 (patch)
treedd72f3c0236b8adcb5d4e82d50193edc39727811 /compiler
parent092a5656937a319449346e8c356f3f4c2870d81c (diff)
Make inlining deterministic.
Only the case where two methods are not in the same dex file could lead to undeterministic behavior. bug:20037935 Change-Id: I1a7642a979302b17e76d196894437c1aacbbbe9d
Diffstat (limited to 'compiler')
-rw-r--r--compiler/optimizing/inliner.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 47c6318c95..a72817fade 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;
}
@@ -208,6 +207,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;
}
@@ -215,12 +215,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;
}
@@ -257,6 +259,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;
}
@@ -272,6 +275,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;
}
@@ -279,6 +283,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;
}
@@ -286,6 +291,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;
}
}