6875959: CTW fails hotspot/src/share/vm/opto/reg_split.cpp:1087

Wed, 07 Oct 2009 12:43:50 -0700

author
kvn
date
Wed, 07 Oct 2009 12:43:50 -0700
changeset 1443
e90521d61f9a
parent 1442
1ce3281a8e93
child 1444
03b336640699

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

src/share/vm/opto/chaitin.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/chaitin.cpp	Tue Oct 06 10:15:38 2009 -0700
     1.2 +++ b/src/share/vm/opto/chaitin.cpp	Wed Oct 07 12:43:50 2009 -0700
     1.3 @@ -985,10 +985,12 @@
     1.4      uint lo_score = _hi_degree;
     1.5      double score = lrgs(lo_score).score();
     1.6      double area = lrgs(lo_score)._area;
     1.7 +    double cost = lrgs(lo_score)._cost;
     1.8 +    bool bound = lrgs(lo_score)._is_bound;
     1.9  
    1.10      // Find cheapest guy
    1.11      debug_only( int lo_no_simplify=0; );
    1.12 -    for( uint i = _hi_degree; i; i = lrgs(i)._next ) {
    1.13 +    for( uint i = lrgs(lo_score)._next; i; i = lrgs(i)._next ) {
    1.14        assert( !(*_ifg->_yanked)[i], "" );
    1.15        // It's just vaguely possible to move hi-degree to lo-degree without
    1.16        // going through a just-lo-degree stage: If you remove a double from
    1.17 @@ -1002,17 +1004,27 @@
    1.18        debug_only( if( lrgs(i)._was_lo ) lo_no_simplify=i; );
    1.19        double iscore = lrgs(i).score();
    1.20        double iarea = lrgs(i)._area;
    1.21 +      double icost = lrgs(i)._cost;
    1.22 +      bool ibound = lrgs(i)._is_bound;
    1.23  
    1.24        // Compare cost/area of i vs cost/area of lo_score.  Smaller cost/area
    1.25        // wins.  Ties happen because all live ranges in question have spilled
    1.26        // a few times before and the spill-score adds a huge number which
    1.27        // washes out the low order bits.  We are choosing the lesser of 2
    1.28        // evils; in this case pick largest area to spill.
    1.29 +      // Ties also happen when live ranges are defined and used only inside
    1.30 +      // one block. In which case their area is 0 and score set to max.
    1.31 +      // In such case choose bound live range over unbound to free registers
    1.32 +      // or with smaller cost to spill.
    1.33        if( iscore < score ||
    1.34 -          (iscore == score && iarea > area && lrgs(lo_score)._was_spilled2) ) {
    1.35 +          (iscore == score && iarea > area && lrgs(lo_score)._was_spilled2) ||
    1.36 +          (iscore == score && iarea == area &&
    1.37 +           ( (ibound && !bound) || ibound == bound && (icost < cost) )) ) {
    1.38          lo_score = i;
    1.39          score = iscore;
    1.40          area = iarea;
    1.41 +        cost = icost;
    1.42 +        bound = ibound;
    1.43        }
    1.44      }
    1.45      LRG *lo_lrg = &lrgs(lo_score);

mercurial