comparison 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
comparison
equal deleted inserted replaced
8689:bf06968a8a00 8691:571076d3c79d
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 }