[Portable Compiler] Rework return block marking.
Move the detection of blocks that contain a return from the
GBC emit pass up to Dex parsing. This allows logic that detects
backward branches that go to method return to skip suspend checks.
Change-Id: I2a606b49850235b59c5faf237a08729e98220f4d
diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc
index 44baea2..9afd18e 100644
--- a/src/compiler/frontend.cc
+++ b/src/compiler/frontend.cc
@@ -148,6 +148,10 @@
bottom_block->first_mir_insn = insn;
bottom_block->last_mir_insn = orig_block->last_mir_insn;
+ /* If this block was terminated by a return, the flag needs to go with the bottom block */
+ bottom_block->terminated_by_return = orig_block->terminated_by_return;
+ orig_block->terminated_by_return = false;
+
/* Add it to the quick lookup cache */
cu->block_map.Put(bottom_block->start_offset, bottom_block);
@@ -972,6 +976,7 @@
cur_block = ProcessCanBranch(cu.get(), cur_block, insn, cur_offset,
width, flags, code_ptr, code_end);
} else if (flags & Instruction::kReturn) {
+ cur_block->terminated_by_return = true;
cur_block->fall_through = exit_block;
InsertGrowableList(cu.get(), exit_block->predecessors,
reinterpret_cast<uintptr_t>(cur_block));