From 6f4dcae28c23a9ac42fd1283ea1c2462f5e1e210 Mon Sep 17 00:00:00 2001 From: Razvan A Lupusoru Date: Mon, 29 Sep 2014 11:59:12 -0700 Subject: [PATCH] ART: Allow overridable calculation of basic block dataflow Currently dataflow information is not calculated for catch blocks in order to reduce overhead. However, this makes assumption that the lack of this information is only preventing local optimizations to catch block. But in reality this problematic for global optimizations. However, since no optimizations need complete information for now, simply leave logic same but factor it out in separate method. Change-Id: I5c13344c18409bd172a5d9b07577b4a1353cc733 Signed-off-by: Razvan A Lupusoru --- compiler/dex/mir_dataflow.cc | 30 +++++++++++++++++------------- compiler/dex/mir_graph.h | 3 ++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/compiler/dex/mir_dataflow.cc b/compiler/dex/mir_dataflow.cc index fd8546e82..854efa148 100644 --- a/compiler/dex/mir_dataflow.cc +++ b/compiler/dex/mir_dataflow.cc @@ -1272,6 +1272,22 @@ bool MIRGraph::DoSSAConversion(BasicBlock* bb) { return true; } +void MIRGraph::InitializeBasicBlockDataFlow() { + /* + * Allocate the BasicBlockDataFlow structure for the entry and code blocks. + */ + for (BasicBlock* bb : block_list_) { + if (bb->hidden == true) continue; + if (bb->block_type == kDalvikByteCode || + bb->block_type == kEntryBlock || + bb->block_type == kExitBlock) { + bb->data_flow_info = + static_cast(arena_->Alloc(sizeof(BasicBlockDataFlow), + kArenaAllocDFInfo)); + } + } +} + /* Setup the basic data structures for SSA conversion */ void MIRGraph::CompilerInitializeSSAConversion() { size_t num_reg = GetNumOfCodeAndTempVRs(); @@ -1319,19 +1335,7 @@ void MIRGraph::CompilerInitializeSSAConversion() { // The MIR graph keeps track of the sreg for method pointer specially, so record that now. method_sreg_ = method_temp->s_reg_low; - /* - * Allocate the BasicBlockDataFlow structure for the entry and code blocks - */ - for (BasicBlock* bb : block_list_) { - if (bb->hidden == true) continue; - if (bb->block_type == kDalvikByteCode || - bb->block_type == kEntryBlock || - bb->block_type == kExitBlock) { - bb->data_flow_info = - static_cast(arena_->Alloc(sizeof(BasicBlockDataFlow), - kArenaAllocDFInfo)); - } - } + InitializeBasicBlockDataFlow(); } /* diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h index ea2ca390b..7dc24e653 100644 --- a/compiler/dex/mir_graph.h +++ b/compiler/dex/mir_graph.h @@ -559,7 +559,7 @@ const RegLocation bad_loc = {kLocDalvikFrame, 0, 0, 0, 0, 0, 0, 0, 0, RegStorage class MIRGraph { public: MIRGraph(CompilationUnit* cu, ArenaAllocator* arena); - ~MIRGraph(); + virtual ~MIRGraph(); /* * Examine the graph to determine whether it's worthwile to spend the time compiling @@ -1178,6 +1178,7 @@ class MIRGraph { void ComputeDefBlockMatrix(); void ComputeDominators(); void CompilerInitializeSSAConversion(); + virtual void InitializeBasicBlockDataFlow(); void InsertPhiNodes(); void DoDFSPreOrderSSARename(BasicBlock* block); -- 2.11.0