From 6ef45677305048c2bf0600f1c4b98a11b2cfaffb Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Tue, 8 Aug 2017 13:59:55 -0700 Subject: optimizing: Add statistics for # of constructor fences added/removed Statistics are attributed as follows: Added because: * HNewInstances requires a HConstructorFence following it. * HReturn requires a HConstructorFence (for final fields) preceding it. Removed because: * Optimized in Load-Store-Elimination. * Optimized in Prepare-For-Register-Allocation. Test: art/test.py Bug: 36656456 Change-Id: Ic119441c5151a5a840fc6532b411340e2d68e5eb --- compiler/optimizing/nodes.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 3a1864b2ae..8644f676e8 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1198,11 +1198,14 @@ void HVariableInputSizeInstruction::RemoveAllInputs() { DCHECK_EQ(0u, InputCount()); } -void HConstructorFence::RemoveConstructorFences(HInstruction* instruction) { +size_t HConstructorFence::RemoveConstructorFences(HInstruction* instruction) { DCHECK(instruction->GetBlock() != nullptr); // Removing constructor fences only makes sense for instructions with an object return type. DCHECK_EQ(Primitive::kPrimNot, instruction->GetType()); + // Return how many instructions were removed for statistic purposes. + size_t remove_count = 0; + // Efficient implementation that simultaneously (in one pass): // * Scans the uses list for all constructor fences. // * Deletes that constructor fence from the uses list of `instruction`. @@ -1250,6 +1253,7 @@ void HConstructorFence::RemoveConstructorFences(HInstruction* instruction) { // is removed. if (ctor_fence->InputCount() == 0u) { ctor_fence->GetBlock()->RemoveInstruction(ctor_fence); + ++remove_count; } } } @@ -1263,6 +1267,8 @@ void HConstructorFence::RemoveConstructorFences(HInstruction* instruction) { } CHECK(instruction->GetBlock() != nullptr); } + + return remove_count; } HInstruction* HConstructorFence::GetAssociatedAllocation() { -- cgit v1.2.3-59-g8ed1b