src/share/vm/opto/loopUnswitch.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/loopUnswitch.cpp

Print this page
rev 7259 : [mq]: max_node_limit.8u40


  44 //    endif                        predicate [clone]
  45 //    stmt4                        loop [clone]
  46 //  endloop                          stmt1 [clone]
  47 //                                   stmt3
  48 //                                   stmt4 [clone]
  49 //                                 endloop
  50 //                               endif
  51 //
  52 // Note: the "else" clause may be empty
  53 
  54 //------------------------------policy_unswitching-----------------------------
  55 // Return TRUE or FALSE if the loop should be unswitched
  56 // (ie. clone loop with an invariant test that does not exit the loop)
  57 bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const {
  58   if( !LoopUnswitching ) {
  59     return false;
  60   }
  61   if (!_head->is_Loop()) {
  62     return false;
  63   }
  64   uint nodes_left = MaxNodeLimit - phase->C->live_nodes();
  65   if (2 * _body.size() > nodes_left) {
  66     return false; // Too speculative if running low on nodes.
  67   }
  68   LoopNode* head = _head->as_Loop();
  69   if (head->unswitch_count() + 1 > head->unswitch_max()) {
  70     return false;
  71   }
  72   return phase->find_unswitching_candidate(this) != NULL;
  73 }
  74 
  75 //------------------------------find_unswitching_candidate-----------------------------
  76 // Find candidate "if" for unswitching
  77 IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop) const {
  78 
  79   // Find first invariant test that doesn't exit the loop
  80   LoopNode *head = loop->_head->as_Loop();
  81   IfNode* unswitch_iff = NULL;
  82   Node* n = head->in(LoopNode::LoopBackControl);
  83   while (n != head) {
  84     Node* n_dom = idom(n);
  85     if (n->is_Region()) {




  44 //    endif                        predicate [clone]
  45 //    stmt4                        loop [clone]
  46 //  endloop                          stmt1 [clone]
  47 //                                   stmt3
  48 //                                   stmt4 [clone]
  49 //                                 endloop
  50 //                               endif
  51 //
  52 // Note: the "else" clause may be empty
  53 
  54 //------------------------------policy_unswitching-----------------------------
  55 // Return TRUE or FALSE if the loop should be unswitched
  56 // (ie. clone loop with an invariant test that does not exit the loop)
  57 bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const {
  58   if( !LoopUnswitching ) {
  59     return false;
  60   }
  61   if (!_head->is_Loop()) {
  62     return false;
  63   }
  64   int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes();
  65   if ((int)(2 * _body.size()) > nodes_left) {
  66     return false; // Too speculative if running low on nodes.
  67   }
  68   LoopNode* head = _head->as_Loop();
  69   if (head->unswitch_count() + 1 > head->unswitch_max()) {
  70     return false;
  71   }
  72   return phase->find_unswitching_candidate(this) != NULL;
  73 }
  74 
  75 //------------------------------find_unswitching_candidate-----------------------------
  76 // Find candidate "if" for unswitching
  77 IfNode* PhaseIdealLoop::find_unswitching_candidate(const IdealLoopTree *loop) const {
  78 
  79   // Find first invariant test that doesn't exit the loop
  80   LoopNode *head = loop->_head->as_Loop();
  81   IfNode* unswitch_iff = NULL;
  82   Node* n = head->in(LoopNode::LoopBackControl);
  83   while (n != head) {
  84     Node* n_dom = idom(n);
  85     if (n->is_Region()) {


src/share/vm/opto/loopUnswitch.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File