Revert "ART: Implement try/catch blocks in Builder"
Causes OutOfMemory issues, need to investigate.
This reverts commit 0b5c7d1994b76090afcc825e737f2b8c546da2f8.
Change-Id: I263e6cc4df5f9a56ad2ce44e18932ca51d7e349f
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 881f9ec..a6390af 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -189,20 +189,15 @@
ssa_builder.BuildSsa();
}
-HBasicBlock* HGraph::SplitEdge(HBasicBlock* block, HBasicBlock* successor) {
- HBasicBlock* new_block = new (arena_) HBasicBlock(this, successor->GetDexPc());
- AddBlock(new_block);
- // Use `InsertBetween` to ensure the predecessor index and successor index of
- // `block` and `successor` are preserved.
- new_block->InsertBetween(block, successor);
- return new_block;
-}
-
void HGraph::SplitCriticalEdge(HBasicBlock* block, HBasicBlock* successor) {
// Insert a new node between `block` and `successor` to split the
// critical edge.
- HBasicBlock* new_block = SplitEdge(block, successor);
+ HBasicBlock* new_block = new (arena_) HBasicBlock(this, successor->GetDexPc());
+ AddBlock(new_block);
new_block->AddInstruction(new (arena_) HGoto());
+ // Use `InsertBetween` to ensure the predecessor index and successor index of
+ // `block` and `successor` are preserved.
+ new_block->InsertBetween(block, successor);
if (successor->IsLoopHeader()) {
// If we split at a back edge boundary, make the new block the back edge.
HLoopInformation* info = successor->GetLoopInformation();
@@ -1024,35 +1019,6 @@
}
}
-HBasicBlock* HBasicBlock::SplitBefore(HInstruction* cursor) {
- DCHECK(!graph_->IsInSsaForm()) << "Support for SSA form not implemented";
- DCHECK_EQ(cursor->GetBlock(), this);
-
- HBasicBlock* new_block = new (GetGraph()->GetArena()) HBasicBlock(GetGraph(), GetDexPc());
- new_block->instructions_.first_instruction_ = cursor;
- new_block->instructions_.last_instruction_ = instructions_.last_instruction_;
- instructions_.last_instruction_ = cursor->previous_;
- if (cursor->previous_ == nullptr) {
- instructions_.first_instruction_ = nullptr;
- } else {
- cursor->previous_->next_ = nullptr;
- cursor->previous_ = nullptr;
- }
-
- new_block->instructions_.SetBlockOfInstructions(new_block);
- AddInstruction(new (GetGraph()->GetArena()) HGoto());
-
- for (size_t i = 0, e = GetSuccessors().Size(); i < e; ++i) {
- HBasicBlock* successor = GetSuccessors().Get(i);
- new_block->successors_.Add(successor);
- successor->predecessors_.Put(successor->GetPredecessorIndexOf(this), new_block);
- }
- successors_.Reset();
- AddSuccessor(new_block);
-
- return new_block;
-}
-
HBasicBlock* HBasicBlock::SplitAfter(HInstruction* cursor) {
DCHECK(!cursor->IsControlFlow());
DCHECK_NE(instructions_.last_instruction_, cursor);
@@ -1082,24 +1048,14 @@
return new_block;
}
-bool HBasicBlock::IsExceptionalSuccessor(size_t idx) const {
- return !GetInstructions().IsEmpty()
- && GetLastInstruction()->IsTryBoundary()
- && GetLastInstruction()->AsTryBoundary()->IsExceptionalSuccessor(idx);
-}
-
-static bool HasOnlyOneInstruction(const HBasicBlock& block) {
- return block.GetPhis().IsEmpty()
- && !block.GetInstructions().IsEmpty()
- && block.GetFirstInstruction() == block.GetLastInstruction();
-}
-
bool HBasicBlock::IsSingleGoto() const {
- return HasOnlyOneInstruction(*this) && GetLastInstruction()->IsGoto();
-}
-
-bool HBasicBlock::IsSingleTryBoundary() const {
- return HasOnlyOneInstruction(*this) && GetLastInstruction()->IsTryBoundary();
+ HLoopInformation* loop_info = GetLoopInformation();
+ DCHECK(EndsWithControlFlowInstruction());
+ return GetPhis().IsEmpty()
+ && GetFirstInstruction() == GetLastInstruction()
+ && GetLastInstruction()->IsGoto()
+ // Back edges generate the suspend check.
+ && (loop_info == nullptr || !loop_info->IsBackEdge(*this));
}
bool HBasicBlock::EndsWithControlFlowInstruction() const {