Mercurial > hg > truffle
comparison src/share/vm/opto/ifg.cpp @ 369:5f85534046c2
6750588: assert(lrg._area >= 0,"negative spill area") running NSK stmp0101 test
Summary: handle NaN costs more carefully
Reviewed-by: kvn, never
author | rasbold |
---|---|
date | Wed, 24 Sep 2008 15:56:36 -0700 |
parents | ea18057223c4 |
children | eb28cf662f56 |
comparison
equal
deleted
inserted
replaced
368:36ccc817fca4 | 369:5f85534046c2 |
---|---|
483 hrp_index[0] = hrp_index[1] = last_inst+1; | 483 hrp_index[0] = hrp_index[1] = last_inst+1; |
484 b->_reg_pressure = b->_freg_pressure = 0; | 484 b->_reg_pressure = b->_freg_pressure = 0; |
485 // Liveout things are presumed live for the whole block. We accumulate | 485 // Liveout things are presumed live for the whole block. We accumulate |
486 // 'area' accordingly. If they get killed in the block, we'll subtract | 486 // 'area' accordingly. If they get killed in the block, we'll subtract |
487 // the unused part of the block from the area. | 487 // the unused part of the block from the area. |
488 double cost = b->_freq * double(last_inst-last_phi); | 488 int inst_count = last_inst - last_phi; |
489 assert( cost >= 0, "negative spill cost" ); | 489 double cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); |
490 assert(!(cost < 0.0), "negative spill cost" ); | |
490 IndexSetIterator elements(&liveout); | 491 IndexSetIterator elements(&liveout); |
491 uint lidx; | 492 uint lidx; |
492 while ((lidx = elements.next()) != 0) { | 493 while ((lidx = elements.next()) != 0) { |
493 LRG &lrg = lrgs(lidx); | 494 LRG &lrg = lrgs(lidx); |
494 lrg._area += cost; | 495 lrg._area += cost; |
588 } | 589 } |
589 | 590 |
590 } else { // Else it is live | 591 } else { // Else it is live |
591 // A DEF also ends 'area' partway through the block. | 592 // A DEF also ends 'area' partway through the block. |
592 lrgs(r)._area -= cost; | 593 lrgs(r)._area -= cost; |
593 assert( lrgs(r)._area >= 0, "negative spill area" ); | 594 assert(!(lrgs(r)._area < 0.0), "negative spill area" ); |
594 | 595 |
595 // Insure high score for immediate-use spill copies so they get a color | 596 // Insure high score for immediate-use spill copies so they get a color |
596 if( n->is_SpillCopy() | 597 if( n->is_SpillCopy() |
597 && lrgs(r).is_singledef() // MultiDef live range can still split | 598 && lrgs(r).is_singledef() // MultiDef live range can still split |
598 && n->outcnt() == 1 // and use must be in this block | 599 && n->outcnt() == 1 // and use must be in this block |
701 // compatible register sets. | 702 // compatible register sets. |
702 interfere_with_live(r,&liveout); | 703 interfere_with_live(r,&liveout); |
703 | 704 |
704 } // End of if normal register-allocated value | 705 } // End of if normal register-allocated value |
705 | 706 |
706 cost -= b->_freq; // Area remaining in the block | 707 // Area remaining in the block |
707 if( cost < 0.0 ) cost = 0.0; // Cost goes negative in the Phi area | 708 inst_count--; |
709 cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); | |
708 | 710 |
709 // Make all inputs live | 711 // Make all inputs live |
710 if( !n->is_Phi() ) { // Phi function uses come from prior block | 712 if( !n->is_Phi() ) { // Phi function uses come from prior block |
711 JVMState* jvms = n->jvms(); | 713 JVMState* jvms = n->jvms(); |
712 uint debug_start = jvms ? jvms->debug_start() : 999999; | 714 uint debug_start = jvms ? jvms->debug_start() : 999999; |
749 } | 751 } |
750 } | 752 } |
751 assert( pressure[0] == count_int_pressure (&liveout), "" ); | 753 assert( pressure[0] == count_int_pressure (&liveout), "" ); |
752 assert( pressure[1] == count_float_pressure(&liveout), "" ); | 754 assert( pressure[1] == count_float_pressure(&liveout), "" ); |
753 } | 755 } |
754 assert( lrg._area >= 0, "negative spill area" ); | 756 assert(!(lrg._area < 0.0), "negative spill area" ); |
755 } | 757 } |
756 } | 758 } |
757 } // End of reverse pass over all instructions in block | 759 } // End of reverse pass over all instructions in block |
758 | 760 |
759 // If we run off the top of the block with high pressure and | 761 // If we run off the top of the block with high pressure and |