Mercurial > hg > truffle
comparison src/share/vm/opto/chaitin.cpp @ 1008:e90521d61f9a
6875959: CTW fails hotspot/src/share/vm/opto/reg_split.cpp:1087
Summary: To break spill ties choose bound live range over unbound to free register or one with smaller cost to spill.
Reviewed-by: never, jrose
author | kvn |
---|---|
date | Wed, 07 Oct 2009 12:43:50 -0700 |
parents | 04fa5affa478 |
children | 5f29a958a545 |
comparison
equal
deleted
inserted
replaced
1007:1ce3281a8e93 | 1008:e90521d61f9a |
---|---|
983 | 983 |
984 // Time to pick a potential spill guy | 984 // Time to pick a potential spill guy |
985 uint lo_score = _hi_degree; | 985 uint lo_score = _hi_degree; |
986 double score = lrgs(lo_score).score(); | 986 double score = lrgs(lo_score).score(); |
987 double area = lrgs(lo_score)._area; | 987 double area = lrgs(lo_score)._area; |
988 double cost = lrgs(lo_score)._cost; | |
989 bool bound = lrgs(lo_score)._is_bound; | |
988 | 990 |
989 // Find cheapest guy | 991 // Find cheapest guy |
990 debug_only( int lo_no_simplify=0; ); | 992 debug_only( int lo_no_simplify=0; ); |
991 for( uint i = _hi_degree; i; i = lrgs(i)._next ) { | 993 for( uint i = lrgs(lo_score)._next; i; i = lrgs(i)._next ) { |
992 assert( !(*_ifg->_yanked)[i], "" ); | 994 assert( !(*_ifg->_yanked)[i], "" ); |
993 // It's just vaguely possible to move hi-degree to lo-degree without | 995 // It's just vaguely possible to move hi-degree to lo-degree without |
994 // going through a just-lo-degree stage: If you remove a double from | 996 // going through a just-lo-degree stage: If you remove a double from |
995 // a float live range it's degree will drop by 2 and you can skip the | 997 // a float live range it's degree will drop by 2 and you can skip the |
996 // just-lo-degree stage. It's very rare (shows up after 5000+ methods | 998 // just-lo-degree stage. It's very rare (shows up after 5000+ methods |
1000 break; | 1002 break; |
1001 } | 1003 } |
1002 debug_only( if( lrgs(i)._was_lo ) lo_no_simplify=i; ); | 1004 debug_only( if( lrgs(i)._was_lo ) lo_no_simplify=i; ); |
1003 double iscore = lrgs(i).score(); | 1005 double iscore = lrgs(i).score(); |
1004 double iarea = lrgs(i)._area; | 1006 double iarea = lrgs(i)._area; |
1007 double icost = lrgs(i)._cost; | |
1008 bool ibound = lrgs(i)._is_bound; | |
1005 | 1009 |
1006 // Compare cost/area of i vs cost/area of lo_score. Smaller cost/area | 1010 // Compare cost/area of i vs cost/area of lo_score. Smaller cost/area |
1007 // wins. Ties happen because all live ranges in question have spilled | 1011 // wins. Ties happen because all live ranges in question have spilled |
1008 // a few times before and the spill-score adds a huge number which | 1012 // a few times before and the spill-score adds a huge number which |
1009 // washes out the low order bits. We are choosing the lesser of 2 | 1013 // washes out the low order bits. We are choosing the lesser of 2 |
1010 // evils; in this case pick largest area to spill. | 1014 // evils; in this case pick largest area to spill. |
1015 // Ties also happen when live ranges are defined and used only inside | |
1016 // one block. In which case their area is 0 and score set to max. | |
1017 // In such case choose bound live range over unbound to free registers | |
1018 // or with smaller cost to spill. | |
1011 if( iscore < score || | 1019 if( iscore < score || |
1012 (iscore == score && iarea > area && lrgs(lo_score)._was_spilled2) ) { | 1020 (iscore == score && iarea > area && lrgs(lo_score)._was_spilled2) || |
1021 (iscore == score && iarea == area && | |
1022 ( (ibound && !bound) || ibound == bound && (icost < cost) )) ) { | |
1013 lo_score = i; | 1023 lo_score = i; |
1014 score = iscore; | 1024 score = iscore; |
1015 area = iarea; | 1025 area = iarea; |
1026 cost = icost; | |
1027 bound = ibound; | |
1016 } | 1028 } |
1017 } | 1029 } |
1018 LRG *lo_lrg = &lrgs(lo_score); | 1030 LRG *lo_lrg = &lrgs(lo_score); |
1019 // The live range we choose for spilling is either hi-degree, or very | 1031 // The live range we choose for spilling is either hi-degree, or very |
1020 // rarely it can be low-degree. If we choose a hi-degree live range | 1032 // rarely it can be low-degree. If we choose a hi-degree live range |