Add extra failed inlining reasons
Added reasons for polymorphic invoke, custom, and unresolved.
Added a counter for the total number of inline attempts.
Test: run dex2oat on APK with --dump-stats
Change-Id: I57aa83dc7ac5fa8897b0c197f416baf46fbe9d53
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 5920f78..3646cc7 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -489,11 +489,19 @@
}
bool HInliner::TryInline(HInvoke* invoke_instruction) {
- if (invoke_instruction->IsInvokeUnresolved() ||
- invoke_instruction->IsInvokePolymorphic() ||
- invoke_instruction->IsInvokeCustom()) {
- return false; // Don't bother to move further if we know the method is unresolved or the
- // invocation is polymorphic (invoke-{polymorphic,custom}).
+ MaybeRecordStat(stats_, MethodCompilationStat::kTryInline);
+
+ // Don't bother to move further if we know the method is unresolved or the invocation is
+ // polymorphic (invoke-{polymorphic,custom}).
+ if (invoke_instruction->IsInvokeUnresolved()) {
+ MaybeRecordStat(stats_, MethodCompilationStat::kNotInlinedUnresolved);
+ return false;
+ } else if (invoke_instruction->IsInvokePolymorphic()) {
+ MaybeRecordStat(stats_, MethodCompilationStat::kNotInlinedPolymorphic);
+ return false;
+ } else if (invoke_instruction->IsInvokeCustom()) {
+ MaybeRecordStat(stats_, MethodCompilationStat::kNotInlinedCustom);
+ return false;
}
ScopedObjectAccess soa(Thread::Current());
diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h
index 83dbef7..621e863 100644
--- a/compiler/optimizing/optimizing_compiler_stats.h
+++ b/compiler/optimizing/optimizing_compiler_stats.h
@@ -97,6 +97,10 @@
kNotInlinedWont,
kNotInlinedRecursiveBudget,
kNotInlinedProxy,
+ kNotInlinedUnresolved,
+ kNotInlinedPolymorphic,
+ kNotInlinedCustom,
+ kTryInline,
kConstructorFenceGeneratedNew,
kConstructorFenceGeneratedFinal,
kConstructorFenceRemovedLSE,