Mercurial > hg > truffle
diff src/share/vm/opto/lcm.cpp @ 8691:571076d3c79d
8009120: Fuzz instruction scheduling in HotSpot compilers
Reviewed-by: kvn, vlivanov
author | shade |
---|---|
date | Tue, 05 Mar 2013 04:24:50 -0800 |
parents | b30b3c2a0cf2 |
children | 70120f47d403 |
line wrap: on
line diff
--- a/src/share/vm/opto/lcm.cpp Mon Mar 04 13:15:01 2013 -0800 +++ b/src/share/vm/opto/lcm.cpp Tue Mar 05 04:24:50 2013 -0800 @@ -421,6 +421,7 @@ uint latency = 0; // Bigger is scheduled first uint score = 0; // Bigger is better int idx = -1; // Index in worklist + int cand_cnt = 0; // Candidate count for( uint i=0; i<cnt; i++ ) { // Inspect entire worklist // Order in worklist is used to break ties. @@ -503,11 +504,14 @@ uint n_score = n->req(); // Many inputs get high score to break ties // Keep best latency found - if( choice < n_choice || - ( choice == n_choice && - ( latency < n_latency || - ( latency == n_latency && - ( score < n_score ))))) { + cand_cnt++; + if (choice < n_choice || + (choice == n_choice && + ((StressLCM && Compile::randomized_select(cand_cnt)) || + (!StressLCM && + (latency < n_latency || + (latency == n_latency && + (score < n_score))))))) { choice = n_choice; latency = n_latency; score = n_score;