src/share/vm/opto/lcm.cpp

Print this page




 400     block->map_node(tmp2, block->end_idx()+1);
 401     block->map_node(tmp1, block->end_idx()+2);
 402     Node *tmp = new Node(C->top()); // Use not NULL input
 403     tmp1->replace_by(tmp);
 404     tmp2->replace_by(tmp1);
 405     tmp->replace_by(tmp2);
 406     tmp->destruct();
 407   }
 408 
 409   // Remove the existing null check; use a new implicit null check instead.
 410   // Since schedule-local needs precise def-use info, we need to correct
 411   // it as well.
 412   Node *old_tst = proj->in(0);
 413   MachNode *nul_chk = new MachNullCheckNode(old_tst->in(0),best,bidx);
 414   block->map_node(nul_chk, block->end_idx());
 415   map_node_to_block(nul_chk, block);
 416   // Redirect users of old_test to nul_chk
 417   for (DUIterator_Last i2min, i2 = old_tst->last_outs(i2min); i2 >= i2min; --i2)
 418     old_tst->last_out(i2)->set_req(0, nul_chk);
 419   // Clean-up any dead code
 420   for (uint i3 = 0; i3 < old_tst->req(); i3++)

 421     old_tst->set_req(i3, NULL);






 422 
 423   latency_from_uses(nul_chk);
 424   latency_from_uses(best);
 425 }
 426 
 427 
 428 //------------------------------select-----------------------------------------
 429 // Select a nice fellow from the worklist to schedule next. If there is only
 430 // one choice, then use it. Projections take top priority for correctness
 431 // reasons - if I see a projection, then it is next.  There are a number of
 432 // other special cases, for instructions that consume condition codes, et al.
 433 // These are chosen immediately. Some instructions are required to immediately
 434 // precede the last instruction in the block, and these are taken last. Of the
 435 // remaining cases (most), choose the instruction with the greatest latency
 436 // (that is, the most number of pseudo-cycles required to the end of the
 437 // routine). If there is a tie, choose the instruction with the most inputs.
 438 Node* PhaseCFG::select(Block* block, Node_List &worklist, GrowableArray<int> &ready_cnt, VectorSet &next_call, uint sched_slot) {
 439 
 440   // If only a single entry on the stack, use it
 441   uint cnt = worklist.size();




 400     block->map_node(tmp2, block->end_idx()+1);
 401     block->map_node(tmp1, block->end_idx()+2);
 402     Node *tmp = new Node(C->top()); // Use not NULL input
 403     tmp1->replace_by(tmp);
 404     tmp2->replace_by(tmp1);
 405     tmp->replace_by(tmp2);
 406     tmp->destruct();
 407   }
 408 
 409   // Remove the existing null check; use a new implicit null check instead.
 410   // Since schedule-local needs precise def-use info, we need to correct
 411   // it as well.
 412   Node *old_tst = proj->in(0);
 413   MachNode *nul_chk = new MachNullCheckNode(old_tst->in(0),best,bidx);
 414   block->map_node(nul_chk, block->end_idx());
 415   map_node_to_block(nul_chk, block);
 416   // Redirect users of old_test to nul_chk
 417   for (DUIterator_Last i2min, i2 = old_tst->last_outs(i2min); i2 >= i2min; --i2)
 418     old_tst->last_out(i2)->set_req(0, nul_chk);
 419   // Clean-up any dead code
 420   for (uint i3 = 0; i3 < old_tst->req(); i3++) {
 421     Node* in = old_tst->in(i3);
 422     old_tst->set_req(i3, NULL);
 423     if (in->outcnt() == 0) {
 424       // Remove dead input node
 425       in->disconnect_inputs(NULL, C);
 426       block->find_remove(in);
 427     }
 428   }
 429 
 430   latency_from_uses(nul_chk);
 431   latency_from_uses(best);
 432 }
 433 
 434 
 435 //------------------------------select-----------------------------------------
 436 // Select a nice fellow from the worklist to schedule next. If there is only
 437 // one choice, then use it. Projections take top priority for correctness
 438 // reasons - if I see a projection, then it is next.  There are a number of
 439 // other special cases, for instructions that consume condition codes, et al.
 440 // These are chosen immediately. Some instructions are required to immediately
 441 // precede the last instruction in the block, and these are taken last. Of the
 442 // remaining cases (most), choose the instruction with the greatest latency
 443 // (that is, the most number of pseudo-cycles required to the end of the
 444 // routine). If there is a tie, choose the instruction with the most inputs.
 445 Node* PhaseCFG::select(Block* block, Node_List &worklist, GrowableArray<int> &ready_cnt, VectorSet &next_call, uint sched_slot) {
 446 
 447   // If only a single entry on the stack, use it
 448   uint cnt = worklist.size();