< prev index next >

src/share/vm/opto/loopnode.cpp

Print this page
rev 10955 : undo
rev 11689 : 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
Summary: With UseCountedLoopSafepoints on do not convert loops to counted loop if they have a safepoint on the backedge
Reviewed-by:


 262 }
 263 
 264 //------------------------------is_counted_loop--------------------------------
 265 bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
 266   PhaseGVN *gvn = &_igvn;
 267 
 268   // Counted loop head must be a good RegionNode with only 3 not NULL
 269   // control input edges: Self, Entry, LoopBack.
 270   if (x->in(LoopNode::Self) == NULL || x->req() != 3 || loop->_irreducible) {
 271     return false;
 272   }
 273   Node *init_control = x->in(LoopNode::EntryControl);
 274   Node *back_control = x->in(LoopNode::LoopBackControl);
 275   if (init_control == NULL || back_control == NULL)    // Partially dead
 276     return false;
 277   // Must also check for TOP when looking for a dead loop
 278   if (init_control->is_top() || back_control->is_top())
 279     return false;
 280 
 281   // Allow funny placement of Safepoint
 282   if (back_control->Opcode() == Op_SafePoint)







 283     back_control = back_control->in(TypeFunc::Control);

 284 
 285   // Controlling test for loop
 286   Node *iftrue = back_control;
 287   uint iftrue_op = iftrue->Opcode();
 288   if (iftrue_op != Op_IfTrue &&
 289       iftrue_op != Op_IfFalse)
 290     // I have a weird back-control.  Probably the loop-exit test is in
 291     // the middle of the loop and I am looking at some trailing control-flow
 292     // merge point.  To fix this I would have to partially peel the loop.
 293     return false; // Obscure back-control
 294 
 295   // Get boolean guarding loop-back test
 296   Node *iff = iftrue->in(0);
 297   if (get_loop(iff) != loop || !iff->in(1)->is_Bool())
 298     return false;
 299   BoolNode *test = iff->in(1)->as_Bool();
 300   BoolTest::mask bt = test->_test._test;
 301   float cl_prob = iff->as_If()->_prob;
 302   if (iftrue_op == Op_IfFalse) {
 303     bt = BoolTest(bt).negate();




 262 }
 263 
 264 //------------------------------is_counted_loop--------------------------------
 265 bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
 266   PhaseGVN *gvn = &_igvn;
 267 
 268   // Counted loop head must be a good RegionNode with only 3 not NULL
 269   // control input edges: Self, Entry, LoopBack.
 270   if (x->in(LoopNode::Self) == NULL || x->req() != 3 || loop->_irreducible) {
 271     return false;
 272   }
 273   Node *init_control = x->in(LoopNode::EntryControl);
 274   Node *back_control = x->in(LoopNode::LoopBackControl);
 275   if (init_control == NULL || back_control == NULL)    // Partially dead
 276     return false;
 277   // Must also check for TOP when looking for a dead loop
 278   if (init_control->is_top() || back_control->is_top())
 279     return false;
 280 
 281   // Allow funny placement of Safepoint
 282   if (back_control->Opcode() == Op_SafePoint) {
 283     if (UseCountedLoopSafepoints) {
 284       // Leaving the safepoint on the backedge and creating a
 285       // CountedLoop will confuse optimizations. We can't move the
 286       // safepoint around because its jvm state wouldn't match a new
 287       // location. Give up on that loop.
 288       return false;
 289     }
 290     back_control = back_control->in(TypeFunc::Control);
 291   }
 292 
 293   // Controlling test for loop
 294   Node *iftrue = back_control;
 295   uint iftrue_op = iftrue->Opcode();
 296   if (iftrue_op != Op_IfTrue &&
 297       iftrue_op != Op_IfFalse)
 298     // I have a weird back-control.  Probably the loop-exit test is in
 299     // the middle of the loop and I am looking at some trailing control-flow
 300     // merge point.  To fix this I would have to partially peel the loop.
 301     return false; // Obscure back-control
 302 
 303   // Get boolean guarding loop-back test
 304   Node *iff = iftrue->in(0);
 305   if (get_loop(iff) != loop || !iff->in(1)->is_Bool())
 306     return false;
 307   BoolNode *test = iff->in(1)->as_Bool();
 308   BoolTest::mask bt = test->_test._test;
 309   float cl_prob = iff->as_If()->_prob;
 310   if (iftrue_op == Op_IfFalse) {
 311     bt = BoolTest(bt).negate();


< prev index next >