1.1 --- a/src/share/vm/opto/lcm.cpp Mon Mar 04 13:15:01 2013 -0800 1.2 +++ b/src/share/vm/opto/lcm.cpp Tue Mar 05 04:24:50 2013 -0800 1.3 @@ -421,6 +421,7 @@ 1.4 uint latency = 0; // Bigger is scheduled first 1.5 uint score = 0; // Bigger is better 1.6 int idx = -1; // Index in worklist 1.7 + int cand_cnt = 0; // Candidate count 1.8 1.9 for( uint i=0; i<cnt; i++ ) { // Inspect entire worklist 1.10 // Order in worklist is used to break ties. 1.11 @@ -503,11 +504,14 @@ 1.12 uint n_score = n->req(); // Many inputs get high score to break ties 1.13 1.14 // Keep best latency found 1.15 - if( choice < n_choice || 1.16 - ( choice == n_choice && 1.17 - ( latency < n_latency || 1.18 - ( latency == n_latency && 1.19 - ( score < n_score ))))) { 1.20 + cand_cnt++; 1.21 + if (choice < n_choice || 1.22 + (choice == n_choice && 1.23 + ((StressLCM && Compile::randomized_select(cand_cnt)) || 1.24 + (!StressLCM && 1.25 + (latency < n_latency || 1.26 + (latency == n_latency && 1.27 + (score < n_score))))))) { 1.28 choice = n_choice; 1.29 latency = n_latency; 1.30 score = n_score;