# HG changeset patch # User rasbold # Date 1222296996 25200 # Node ID 5f85534046c2c8d8129a5b198099fb41840bdd32 # Parent 36ccc817fca4894becf4c75a51324d4a77790890 6750588: assert(lrg._area >= 0,"negative spill area") running NSK stmp0101 test Summary: handle NaN costs more carefully Reviewed-by: kvn, never diff -r 36ccc817fca4 -r 5f85534046c2 src/share/vm/opto/ifg.cpp --- a/src/share/vm/opto/ifg.cpp Tue Sep 23 12:29:06 2008 -0700 +++ b/src/share/vm/opto/ifg.cpp Wed Sep 24 15:56:36 2008 -0700 @@ -485,8 +485,9 @@ // Liveout things are presumed live for the whole block. We accumulate // 'area' accordingly. If they get killed in the block, we'll subtract // the unused part of the block from the area. - double cost = b->_freq * double(last_inst-last_phi); - assert( cost >= 0, "negative spill cost" ); + int inst_count = last_inst - last_phi; + double cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); + assert(!(cost < 0.0), "negative spill cost" ); IndexSetIterator elements(&liveout); uint lidx; while ((lidx = elements.next()) != 0) { @@ -590,7 +591,7 @@ } else { // Else it is live // A DEF also ends 'area' partway through the block. lrgs(r)._area -= cost; - assert( lrgs(r)._area >= 0, "negative spill area" ); + assert(!(lrgs(r)._area < 0.0), "negative spill area" ); // Insure high score for immediate-use spill copies so they get a color if( n->is_SpillCopy() @@ -703,8 +704,9 @@ } // End of if normal register-allocated value - cost -= b->_freq; // Area remaining in the block - if( cost < 0.0 ) cost = 0.0; // Cost goes negative in the Phi area + // Area remaining in the block + inst_count--; + cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); // Make all inputs live if( !n->is_Phi() ) { // Phi function uses come from prior block @@ -751,7 +753,7 @@ assert( pressure[0] == count_int_pressure (&liveout), "" ); assert( pressure[1] == count_float_pressure(&liveout), "" ); } - assert( lrg._area >= 0, "negative spill area" ); + assert(!(lrg._area < 0.0), "negative spill area" ); } } } // End of reverse pass over all instructions in block