diff options
author | Igor Murashkin <iam@google.com> | 2017-08-08 13:59:55 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2017-08-11 10:23:30 -0700 |
commit | 6ef45677305048c2bf0600f1c4b98a11b2cfaffb (patch) | |
tree | 9a8df6a3bebe4a6120403562c21817d775a6ef36 /compiler/optimizing/instruction_builder.cc | |
parent | 1e065a54845da12541572f4f149e6ab0dcd20180 (diff) |
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
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 6 |
1 files changed, 6 insertions, 0 deletions
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) |