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/instruction_builder.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index b66883f6ad..ca3b191cb0 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -664,6 +664,9 @@ void HInstructionBuilder::BuildReturn(const Instruction& instruction, DCHECK(fence_target != nullptr); AppendInstruction(new (arena_) HConstructorFence(fence_target, dex_pc, arena_)); + MaybeRecordStat( + compilation_stats_, + MethodCompilationStat::kConstructorFenceGeneratedFinal); } AppendInstruction(new (arena_) HReturnVoid(dex_pc)); } else { @@ -1034,6 +1037,9 @@ void HInstructionBuilder::BuildConstructorFenceForAllocation(HInstruction* alloc HConstructorFence* ctor_fence = new (arena_) HConstructorFence(allocation, allocation->GetDexPc(), arena_); AppendInstruction(ctor_fence); + MaybeRecordStat( + compilation_stats_, + MethodCompilationStat::kConstructorFenceGeneratedNew); } static bool IsSubClass(mirror::Class* to_test, mirror::Class* super_class) -- cgit v1.2.3-59-g8ed1b