diff options
Diffstat (limited to 'compiler/dex/mir_graph.cc')
-rw-r--r-- | compiler/dex/mir_graph.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc index 3ef1dbfac3..a2676c82ca 100644 --- a/compiler/dex/mir_graph.cc +++ b/compiler/dex/mir_graph.cc @@ -111,7 +111,8 @@ MIRGraph::MIRGraph(CompilationUnit* cu, ArenaAllocator* arena) merged_df_flags_(0u), ifield_lowering_infos_(arena, 0u), sfield_lowering_infos_(arena, 0u), - method_lowering_infos_(arena, 0u) { + method_lowering_infos_(arena, 0u), + gen_suspend_test_list_(arena, 0u) { try_block_addr_ = new (arena_) ArenaBitVector(arena_, 0, true /* expandable */); max_available_special_compiler_temps_ = std::abs(static_cast<int>(kVRegNonSpecialTempBaseReg)) - std::abs(static_cast<int>(kVRegTempBaseReg)); @@ -1533,6 +1534,24 @@ bool BasicBlock::IsExceptionBlock() const { return false; } +bool MIRGraph::HasSuspendTestBetween(BasicBlock* source, BasicBlockId target_id) { + BasicBlock* target = GetBasicBlock(target_id); + + if (source == nullptr || target == nullptr) + return false; + + int idx; + for (idx = gen_suspend_test_list_.Size() - 1; idx >= 0; idx--) { + BasicBlock* bb = gen_suspend_test_list_.Get(idx); + if (bb == source) + return true; // The block has been inserted by a suspend check before. + if (source->dominators->IsBitSet(bb->id) && bb->dominators->IsBitSet(target_id)) + return true; + } + + return false; +} + ChildBlockIterator::ChildBlockIterator(BasicBlock* bb, MIRGraph* mir_graph) : basic_block_(bb), mir_graph_(mir_graph), visited_fallthrough_(false), visited_taken_(false), have_successors_(false) { |