diff options
author | 2017-08-08 13:59:55 -0700 | |
---|---|---|
committer | 2017-08-11 10:23:30 -0700 | |
commit | 6ef45677305048c2bf0600f1c4b98a11b2cfaffb (patch) | |
tree | 9a8df6a3bebe4a6120403562c21817d775a6ef36 /compiler/optimizing/nodes.h | |
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/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index e4431422b2..29be8acc0d 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -6630,7 +6630,9 @@ class HConstructorFence FINAL : public HVariableInputSizeInstruction { // This must *not* be called during/after prepare_for_register_allocation, // because that removes all the inputs to the fences but the fence is actually // still considered live. - static void RemoveConstructorFences(HInstruction* instruction); + // + // Returns how many HConstructorFence instructions were removed from graph. + static size_t RemoveConstructorFences(HInstruction* instruction); // Check if this constructor fence is protecting // an HNewInstance or HNewArray that is also the immediate @@ -6878,9 +6880,13 @@ class HParallelMove FINAL : public HTemplateInstruction<0> { namespace art { +class OptimizingCompilerStats; + class HGraphVisitor : public ValueObject { public: - explicit HGraphVisitor(HGraph* graph) : graph_(graph) {} + explicit HGraphVisitor(HGraph* graph, OptimizingCompilerStats* stats = nullptr) + : stats_(stats), + graph_(graph) {} virtual ~HGraphVisitor() {} virtual void VisitInstruction(HInstruction* instruction ATTRIBUTE_UNUSED) {} @@ -6902,6 +6908,9 @@ class HGraphVisitor : public ValueObject { #undef DECLARE_VISIT_INSTRUCTION + protected: + OptimizingCompilerStats* stats_; + private: HGraph* const graph_; @@ -6910,7 +6919,8 @@ class HGraphVisitor : public ValueObject { class HGraphDelegateVisitor : public HGraphVisitor { public: - explicit HGraphDelegateVisitor(HGraph* graph) : HGraphVisitor(graph) {} + explicit HGraphDelegateVisitor(HGraph* graph, OptimizingCompilerStats* stats = nullptr) + : HGraphVisitor(graph, stats) {} virtual ~HGraphDelegateVisitor() {} // Visit functions that delegate to to super class. |