hotspot/src/share/vm/opto/lcm.cpp
changeset 15871 b04dd94da4e6
parent 15242 695bb216be99
child 17384 4e6ea5fa04ad
equal deleted inserted replaced
15869:6336b792f928 15871:b04dd94da4e6
   419 
   419 
   420   uint choice  = 0; // Bigger is most important
   420   uint choice  = 0; // Bigger is most important
   421   uint latency = 0; // Bigger is scheduled first
   421   uint latency = 0; // Bigger is scheduled first
   422   uint score   = 0; // Bigger is better
   422   uint score   = 0; // Bigger is better
   423   int idx = -1;     // Index in worklist
   423   int idx = -1;     // Index in worklist
       
   424   int cand_cnt = 0; // Candidate count
   424 
   425 
   425   for( uint i=0; i<cnt; i++ ) { // Inspect entire worklist
   426   for( uint i=0; i<cnt; i++ ) { // Inspect entire worklist
   426     // Order in worklist is used to break ties.
   427     // Order in worklist is used to break ties.
   427     // See caller for how this is used to delay scheduling
   428     // See caller for how this is used to delay scheduling
   428     // of induction variable increments to after the other
   429     // of induction variable increments to after the other
   501 
   502 
   502     uint n_latency = cfg->_node_latency->at_grow(n->_idx);
   503     uint n_latency = cfg->_node_latency->at_grow(n->_idx);
   503     uint n_score   = n->req();   // Many inputs get high score to break ties
   504     uint n_score   = n->req();   // Many inputs get high score to break ties
   504 
   505 
   505     // Keep best latency found
   506     // Keep best latency found
   506     if( choice < n_choice ||
   507     cand_cnt++;
   507         ( choice == n_choice &&
   508     if (choice < n_choice ||
   508           ( latency < n_latency ||
   509         (choice == n_choice &&
   509             ( latency == n_latency &&
   510          ((StressLCM && Compile::randomized_select(cand_cnt)) ||
   510               ( score < n_score ))))) {
   511           (!StressLCM &&
       
   512            (latency < n_latency ||
       
   513             (latency == n_latency &&
       
   514              (score < n_score))))))) {
   511       choice  = n_choice;
   515       choice  = n_choice;
   512       latency = n_latency;
   516       latency = n_latency;
   513       score   = n_score;
   517       score   = n_score;
   514       idx     = i;               // Also keep index in worklist
   518       idx     = i;               // Also keep index in worklist
   515     }
   519     }