diff options
author | 2016-03-16 11:53:41 +0000 | |
---|---|---|
committer | 2016-03-16 14:07:22 +0000 | |
commit | 6915898b28cea6c9836ca1be6814d87e89cc6d76 (patch) | |
tree | 89eb0f498a958b72d78c8aee25b4de212c25348b /compiler/optimizing | |
parent | fbc61e19578d281d05728bcd120e1ace57c2fbd8 (diff) |
Improve compiler stats
- report the max size of arena alloc
- report how many virtual or interface invokes were inlined
Change-Id: I82f154a8e25b5e3890181a1aa11346cdc3f93e37
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/inliner.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 18 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler_stats.h | 4 |
3 files changed, 19 insertions, 9 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index d861e39c8b..80835532fe 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -293,7 +293,11 @@ bool HInliner::TryInline(HInvoke* invoke_instruction) { } if (actual_method != nullptr) { - return TryInlineAndReplace(invoke_instruction, actual_method, /* do_rtp */ true); + bool result = TryInlineAndReplace(invoke_instruction, actual_method, /* do_rtp */ true); + if (result && !invoke_instruction->IsInvokeStaticOrDirect()) { + MaybeRecordStat(kInlinedInvokeVirtualOrInterface); + } + return result; } DCHECK(!invoke_instruction->IsInvokeStaticOrDirect()); diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 049901b882..062b5a6b81 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -34,8 +34,12 @@ class InstructionSimplifierVisitor : public HGraphDelegateVisitor { void RecordSimplification() { simplification_occurred_ = true; simplifications_at_current_position_++; - if (stats_) { - stats_->RecordStat(kInstructionSimplifications); + MaybeRecordStat(kInstructionSimplifications); + } + + void MaybeRecordStat(MethodCompilationStat stat) { + if (stats_ != nullptr) { + stats_->RecordStat(stat); } } @@ -463,9 +467,7 @@ void InstructionSimplifierVisitor::VisitCheckCast(HCheckCast* check_cast) { if (object->IsNullConstant()) { check_cast->GetBlock()->RemoveInstruction(check_cast); - if (stats_ != nullptr) { - stats_->RecordStat(MethodCompilationStat::kRemovedCheckedCast); - } + MaybeRecordStat(MethodCompilationStat::kRemovedCheckedCast); return; } @@ -473,9 +475,7 @@ void InstructionSimplifierVisitor::VisitCheckCast(HCheckCast* check_cast) { if (TypeCheckHasKnownOutcome(load_class, object, &outcome)) { if (outcome) { check_cast->GetBlock()->RemoveInstruction(check_cast); - if (stats_ != nullptr) { - stats_->RecordStat(MethodCompilationStat::kRemovedCheckedCast); - } + MaybeRecordStat(MethodCompilationStat::kRemovedCheckedCast); if (!load_class->HasUses()) { // We cannot rely on DCE to remove the class because the `HLoadClass` thinks it can throw. // However, here we know that it cannot because the checkcast was successfull, hence @@ -505,6 +505,7 @@ void InstructionSimplifierVisitor::VisitInstanceOf(HInstanceOf* instruction) { HGraph* graph = GetGraph(); if (object->IsNullConstant()) { + MaybeRecordStat(kRemovedInstanceOf); instruction->ReplaceWith(graph->GetIntConstant(0)); instruction->GetBlock()->RemoveInstruction(instruction); RecordSimplification(); @@ -513,6 +514,7 @@ void InstructionSimplifierVisitor::VisitInstanceOf(HInstanceOf* instruction) { bool outcome; if (TypeCheckHasKnownOutcome(load_class, object, &outcome)) { + MaybeRecordStat(kRemovedInstanceOf); if (outcome && can_be_null) { // Type test will succeed, we just need a null test. HNotEqual* test = new (graph->GetArena()) HNotEqual(graph->GetNullConstant(), object); diff --git a/compiler/optimizing/optimizing_compiler_stats.h b/compiler/optimizing/optimizing_compiler_stats.h index 179004bd40..ecbe371a8b 100644 --- a/compiler/optimizing/optimizing_compiler_stats.h +++ b/compiler/optimizing/optimizing_compiler_stats.h @@ -60,6 +60,8 @@ enum MethodCompilationStat { kIntrinsicRecognized, kLoopInvariantMoved, kSelectGenerated, + kRemovedInstanceOf, + kInlinedInvokeVirtualOrInterface, kLastStat }; @@ -133,6 +135,8 @@ class OptimizingCompilerStats { case kIntrinsicRecognized : name = "IntrinsicRecognized"; break; case kLoopInvariantMoved : name = "LoopInvariantMoved"; break; case kSelectGenerated : name = "SelectGenerated"; break; + case kRemovedInstanceOf: name = "RemovedInstanceOf"; break; + case kInlinedInvokeVirtualOrInterface: name = "InlinedInvokeVirtualOrInterface"; break; case kLastStat: LOG(FATAL) << "invalid stat " |