6287 assert(cur_last_op->info() == NULL, "return instructions do not have debug information");
6288 assert(block->number_of_sux() == 0 ||
6289 (return_converted.at(block->block_id()) && block->number_of_sux() == 1),
6290 "blocks that end with return must not have successors");
6291
6292 assert(cur_last_op->as_Op1() != NULL, "return must be LIR_Op1");
6293 LIR_Opr return_opr = ((LIR_Op1*)cur_last_op)->in_opr();
6294
6295 for (int j = block->number_of_preds() - 1; j >= 0; j--) {
6296 BlockBegin* pred = block->pred_at(j);
6297 LIR_OpList* pred_instructions = pred->lir()->instructions_list();
6298 LIR_Op* pred_last_op = pred_instructions->last();
6299
6300 if (pred_last_op->code() == lir_branch) {
6301 assert(pred_last_op->as_OpBranch() != NULL, "branch must be LIR_OpBranch");
6302 LIR_OpBranch* pred_last_branch = (LIR_OpBranch*)pred_last_op;
6303
6304 if (pred_last_branch->block() == block && pred_last_branch->cond() == lir_cond_always && pred_last_branch->info() == NULL) {
6305 // replace the jump to a return with a direct return
6306 // Note: currently the edge between the blocks is not deleted
6307 pred_instructions->at_put(pred_instructions->length() - 1, new LIR_Op1(lir_return, return_opr));
6308 #ifdef ASSERT
6309 return_converted.set_bit(pred->block_id());
6310 #endif
6311 }
6312 }
6313 }
6314 }
6315 }
6316 }
6317
6318
6319 #ifdef ASSERT
6320 void ControlFlowOptimizer::verify(BlockList* code) {
6321 for (int i = 0; i < code->length(); i++) {
6322 BlockBegin* block = code->at(i);
6323 LIR_OpList* instructions = block->lir()->instructions_list();
6324
6325 int j;
6326 for (j = 0; j < instructions->length(); j++) {
6327 LIR_OpBranch* op_branch = instructions->at(j)->as_OpBranch();
|
6287 assert(cur_last_op->info() == NULL, "return instructions do not have debug information");
6288 assert(block->number_of_sux() == 0 ||
6289 (return_converted.at(block->block_id()) && block->number_of_sux() == 1),
6290 "blocks that end with return must not have successors");
6291
6292 assert(cur_last_op->as_Op1() != NULL, "return must be LIR_Op1");
6293 LIR_Opr return_opr = ((LIR_Op1*)cur_last_op)->in_opr();
6294
6295 for (int j = block->number_of_preds() - 1; j >= 0; j--) {
6296 BlockBegin* pred = block->pred_at(j);
6297 LIR_OpList* pred_instructions = pred->lir()->instructions_list();
6298 LIR_Op* pred_last_op = pred_instructions->last();
6299
6300 if (pred_last_op->code() == lir_branch) {
6301 assert(pred_last_op->as_OpBranch() != NULL, "branch must be LIR_OpBranch");
6302 LIR_OpBranch* pred_last_branch = (LIR_OpBranch*)pred_last_op;
6303
6304 if (pred_last_branch->block() == block && pred_last_branch->cond() == lir_cond_always && pred_last_branch->info() == NULL) {
6305 // replace the jump to a return with a direct return
6306 // Note: currently the edge between the blocks is not deleted
6307 pred_instructions->at_put(pred_instructions->length() - 1, new LIR_Op1Safepoint(lir_return, return_opr, NULL));
6308 #ifdef ASSERT
6309 return_converted.set_bit(pred->block_id());
6310 #endif
6311 }
6312 }
6313 }
6314 }
6315 }
6316 }
6317
6318
6319 #ifdef ASSERT
6320 void ControlFlowOptimizer::verify(BlockList* code) {
6321 for (int i = 0; i < code->length(); i++) {
6322 BlockBegin* block = code->at(i);
6323 LIR_OpList* instructions = block->lir()->instructions_list();
6324
6325 int j;
6326 for (j = 0; j < instructions->length(); j++) {
6327 LIR_OpBranch* op_branch = instructions->at(j)->as_OpBranch();
|