src/share/vm/c1/c1_Optimizer.cpp

changeset 4860
46f6f063b272
parent 4164
d804e148cff8
child 4947
acadb114c818
equal deleted inserted replaced
4780:98f3af397705 4860:46f6f063b272
176 for_each_phi_fun(f_block, phi, return; ); 176 for_each_phi_fun(f_block, phi, return; );
177 177
178 // 2) substitute conditional expression 178 // 2) substitute conditional expression
179 // with an IfOp followed by a Goto 179 // with an IfOp followed by a Goto
180 // cut if_ away and get node before 180 // cut if_ away and get node before
181 Instruction* cur_end = if_->prev(block); 181 Instruction* cur_end = if_->prev();
182 182
183 // append constants of true- and false-block if necessary 183 // append constants of true- and false-block if necessary
184 // clone constants because original block must not be destroyed 184 // clone constants because original block must not be destroyed
185 assert((t_value != f_const && f_value != t_const) || t_const == f_const, "mismatch"); 185 assert((t_value != f_const && f_value != t_const) || t_const == f_const, "mismatch");
186 if (t_value == t_const) { 186 if (t_value == t_const) {
200 NOT_PRODUCT(result->set_printable_bci(if_->printable_bci())); 200 NOT_PRODUCT(result->set_printable_bci(if_->printable_bci()));
201 cur_end = cur_end->set_next(result); 201 cur_end = cur_end->set_next(result);
202 } 202 }
203 203
204 // append Goto to successor 204 // append Goto to successor
205 ValueStack* state_before = if_->is_safepoint() ? if_->state_before() : NULL; 205 ValueStack* state_before = if_->state_before();
206 Goto* goto_ = new Goto(sux, state_before, if_->is_safepoint() || t_goto->is_safepoint() || f_goto->is_safepoint()); 206 Goto* goto_ = new Goto(sux, state_before, if_->is_safepoint() || t_goto->is_safepoint() || f_goto->is_safepoint());
207 207
208 // prepare state for Goto 208 // prepare state for Goto
209 ValueStack* goto_state = if_state; 209 ValueStack* goto_state = if_state;
210 goto_state = goto_state->copy(ValueStack::StateAfter, goto_state->bci()); 210 goto_state = goto_state->copy(ValueStack::StateAfter, goto_state->bci());
365 } 365 }
366 assert(sux_state->caller_state() == end_state->caller_state(), "caller not equal"); 366 assert(sux_state->caller_state() == end_state->caller_state(), "caller not equal");
367 #endif 367 #endif
368 368
369 // find instruction before end & append first instruction of sux block 369 // find instruction before end & append first instruction of sux block
370 Instruction* prev = end->prev(block); 370 Instruction* prev = end->prev();
371 Instruction* next = sux->next(); 371 Instruction* next = sux->next();
372 assert(prev->as_BlockEnd() == NULL, "must not be a BlockEnd"); 372 assert(prev->as_BlockEnd() == NULL, "must not be a BlockEnd");
373 prev->set_next(next); 373 prev->set_next(next);
374 prev->fixup_block_pointers();
374 sux->disconnect_from_graph(); 375 sux->disconnect_from_graph();
375 block->set_end(sux->end()); 376 block->set_end(sux->end());
376 // add exception handlers of deleted block, if any 377 // add exception handlers of deleted block, if any
377 for (int k = 0; k < sux->number_of_exception_handlers(); k++) { 378 for (int k = 0; k < sux->number_of_exception_handlers(); k++) {
378 BlockBegin* xhandler = sux->exception_handler_at(k); 379 BlockBegin* xhandler = sux->exception_handler_at(k);
531 void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x); 532 void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
532 void do_ProfileCall (ProfileCall* x); 533 void do_ProfileCall (ProfileCall* x);
533 void do_ProfileInvoke (ProfileInvoke* x); 534 void do_ProfileInvoke (ProfileInvoke* x);
534 void do_RuntimeCall (RuntimeCall* x); 535 void do_RuntimeCall (RuntimeCall* x);
535 void do_MemBar (MemBar* x); 536 void do_MemBar (MemBar* x);
537 void do_RangeCheckPredicate(RangeCheckPredicate* x);
538 void do_Assert (Assert* x);
536 }; 539 };
537 540
538 541
539 // Because of a static contained within (for the purpose of iteration 542 // Because of a static contained within (for the purpose of iteration
540 // over instructions), it is only valid to have one of these active at 543 // over instructions), it is only valid to have one of these active at
712 void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {} 715 void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
713 void NullCheckVisitor::do_ProfileCall (ProfileCall* x) { nce()->clear_last_explicit_null_check(); } 716 void NullCheckVisitor::do_ProfileCall (ProfileCall* x) { nce()->clear_last_explicit_null_check(); }
714 void NullCheckVisitor::do_ProfileInvoke (ProfileInvoke* x) {} 717 void NullCheckVisitor::do_ProfileInvoke (ProfileInvoke* x) {}
715 void NullCheckVisitor::do_RuntimeCall (RuntimeCall* x) {} 718 void NullCheckVisitor::do_RuntimeCall (RuntimeCall* x) {}
716 void NullCheckVisitor::do_MemBar (MemBar* x) {} 719 void NullCheckVisitor::do_MemBar (MemBar* x) {}
720 void NullCheckVisitor::do_RangeCheckPredicate(RangeCheckPredicate* x) {}
721 void NullCheckVisitor::do_Assert (Assert* x) {}
717 722
718 723
719 void NullCheckEliminator::visit(Value* p) { 724 void NullCheckEliminator::visit(Value* p) {
720 assert(*p != NULL, "should not find NULL instructions"); 725 assert(*p != NULL, "should not find NULL instructions");
721 if (visitable(*p)) { 726 if (visitable(*p)) {

mercurial