< prev index next >

src/share/vm/opto/chaitin.cpp

Print this page




1283         break;
1284       }
1285       debug_only( if( lrgs(i)._was_lo ) lo_no_simplify=i; );
1286       double iscore = lrgs(i).score();
1287       double iarea = lrgs(i)._area;
1288       double icost = lrgs(i)._cost;
1289       bool ibound = lrgs(i)._is_bound;
1290 
1291       // Compare cost/area of i vs cost/area of lo_score.  Smaller cost/area
1292       // wins.  Ties happen because all live ranges in question have spilled
1293       // a few times before and the spill-score adds a huge number which
1294       // washes out the low order bits.  We are choosing the lesser of 2
1295       // evils; in this case pick largest area to spill.
1296       // Ties also happen when live ranges are defined and used only inside
1297       // one block. In which case their area is 0 and score set to max.
1298       // In such case choose bound live range over unbound to free registers
1299       // or with smaller cost to spill.
1300       if( iscore < score ||
1301           (iscore == score && iarea > area && lrgs(lo_score)._was_spilled2) ||
1302           (iscore == score && iarea == area &&
1303            ( (ibound && !bound) || ibound == bound && (icost < cost) )) ) {
1304         lo_score = i;
1305         score = iscore;
1306         area = iarea;
1307         cost = icost;
1308         bound = ibound;
1309       }
1310     }
1311     LRG *lo_lrg = &lrgs(lo_score);
1312     // The live range we choose for spilling is either hi-degree, or very
1313     // rarely it can be low-degree.  If we choose a hi-degree live range
1314     // there better not be any lo-degree choices.
1315     assert( lo_lrg->lo_degree() || !lo_no_simplify, "Live range was lo-degree before coalesce; should simplify" );
1316 
1317     // Pull from hi-degree list
1318     uint prev = lo_lrg->_prev;
1319     uint next = lo_lrg->_next;
1320     if( prev ) lrgs(prev)._next = next;
1321     else _hi_degree = next;
1322     lrgs(next)._prev = prev;
1323     // Jam him on the lo-degree list, despite his high degree.




1283         break;
1284       }
1285       debug_only( if( lrgs(i)._was_lo ) lo_no_simplify=i; );
1286       double iscore = lrgs(i).score();
1287       double iarea = lrgs(i)._area;
1288       double icost = lrgs(i)._cost;
1289       bool ibound = lrgs(i)._is_bound;
1290 
1291       // Compare cost/area of i vs cost/area of lo_score.  Smaller cost/area
1292       // wins.  Ties happen because all live ranges in question have spilled
1293       // a few times before and the spill-score adds a huge number which
1294       // washes out the low order bits.  We are choosing the lesser of 2
1295       // evils; in this case pick largest area to spill.
1296       // Ties also happen when live ranges are defined and used only inside
1297       // one block. In which case their area is 0 and score set to max.
1298       // In such case choose bound live range over unbound to free registers
1299       // or with smaller cost to spill.
1300       if( iscore < score ||
1301           (iscore == score && iarea > area && lrgs(lo_score)._was_spilled2) ||
1302           (iscore == score && iarea == area &&
1303            ( (ibound && !bound) || (ibound == bound && (icost < cost)) )) ) {
1304         lo_score = i;
1305         score = iscore;
1306         area = iarea;
1307         cost = icost;
1308         bound = ibound;
1309       }
1310     }
1311     LRG *lo_lrg = &lrgs(lo_score);
1312     // The live range we choose for spilling is either hi-degree, or very
1313     // rarely it can be low-degree.  If we choose a hi-degree live range
1314     // there better not be any lo-degree choices.
1315     assert( lo_lrg->lo_degree() || !lo_no_simplify, "Live range was lo-degree before coalesce; should simplify" );
1316 
1317     // Pull from hi-degree list
1318     uint prev = lo_lrg->_prev;
1319     uint next = lo_lrg->_next;
1320     if( prev ) lrgs(prev)._next = next;
1321     else _hi_degree = next;
1322     lrgs(next)._prev = prev;
1323     // Jam him on the lo-degree list, despite his high degree.


< prev index next >