From bbdd05378516f11443fce29a0fbff25ad993db23 Mon Sep 17 00:00:00 2001 From: buzbee Date: Thu, 7 Feb 2013 09:33:02 -0800 Subject: [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 --- src/compiler/frontend.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/compiler/frontend.cc') diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc index 44baea28fa..9afd18e4d9 100644 --- a/src/compiler/frontend.cc +++ b/src/compiler/frontend.cc @@ -148,6 +148,10 @@ static BasicBlock *SplitBlock(CompilationUnit* cu, unsigned int code_offset, 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 @@ static CompiledMethod* CompileMethod(Compiler& compiler, 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(cur_block)); -- cgit v1.2.3-59-g8ed1b