src/share/vm/opto/gcm.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
JDK-8033260 Cdiff src/share/vm/opto/gcm.cpp
src/share/vm/opto/gcm.cpp
Print this page
rev 5903 : 8033260: assert(lrg._area >= 0.0) failed: negative spill area
Summary: Change type from float to double on block frequency, and add check for +Inf - +Inf operation
Reviewed-by:
*** 1659,1672 ****
ch->compute_freq();
ch = ch->_sibling;
}
assert (_members.length() > 0, "no empty loops");
Block* hd = head();
! hd->_freq = 1.0f;
for (int i = 0; i < _members.length(); i++) {
CFGElement* s = _members.at(i);
! float freq = s->_freq;
if (s->is_block()) {
Block* b = s->as_Block();
for (uint j = 0; j < b->_num_succs; j++) {
Block* sb = b->_succs[j];
update_succ_freq(sb, freq * b->succ_prob(j));
--- 1659,1672 ----
ch->compute_freq();
ch = ch->_sibling;
}
assert (_members.length() > 0, "no empty loops");
Block* hd = head();
! hd->_freq = 1.0;
for (int i = 0; i < _members.length(); i++) {
CFGElement* s = _members.at(i);
! double freq = s->_freq;
if (s->is_block()) {
Block* b = s->as_Block();
for (uint j = 0; j < b->_num_succs; j++) {
Block* sb = b->_succs[j];
update_succ_freq(sb, freq * b->succ_prob(j));
*** 1674,1684 ****
} else {
CFGLoop* lp = s->as_CFGLoop();
assert(lp->_parent == this, "immediate child");
for (int k = 0; k < lp->_exits.length(); k++) {
Block* eb = lp->_exits.at(k).get_target();
! float prob = lp->_exits.at(k).get_prob();
update_succ_freq(eb, freq * prob);
}
}
}
--- 1674,1684 ----
} else {
CFGLoop* lp = s->as_CFGLoop();
assert(lp->_parent == this, "immediate child");
for (int k = 0; k < lp->_exits.length(); k++) {
Block* eb = lp->_exits.at(k).get_target();
! double prob = lp->_exits.at(k).get_prob();
update_succ_freq(eb, freq * prob);
}
}
}
*** 1686,1696 ****
// sum and normalize the exit probability. The "method" loop
// should keep the initial exit probability of 1, so that
// inner blocks do not get erroneously scaled.
if (_depth != 0) {
// Total the exit probabilities for this loop.
! float exits_sum = 0.0f;
for (int i = 0; i < _exits.length(); i++) {
exits_sum += _exits.at(i).get_prob();
}
// Normalize the exit probabilities. Until now, the
--- 1686,1696 ----
// sum and normalize the exit probability. The "method" loop
// should keep the initial exit probability of 1, so that
// inner blocks do not get erroneously scaled.
if (_depth != 0) {
// Total the exit probabilities for this loop.
! double exits_sum = 0.0f;
for (int i = 0; i < _exits.length(); i++) {
exits_sum += _exits.at(i).get_prob();
}
// Normalize the exit probabilities. Until now, the
*** 1933,1943 ****
}
//------------------------------update_succ_freq-------------------------------
// Update the appropriate frequency associated with block 'b', a successor of
// a block in this loop.
! void CFGLoop::update_succ_freq(Block* b, float freq) {
if (b->_loop == this) {
if (b == head()) {
// back branch within the loop
// Do nothing now, the loop carried frequency will be
// adjust later in scale_freq().
--- 1933,1943 ----
}
//------------------------------update_succ_freq-------------------------------
// Update the appropriate frequency associated with block 'b', a successor of
// a block in this loop.
! void CFGLoop::update_succ_freq(Block* b, double freq) {
if (b->_loop == this) {
if (b == head()) {
// back branch within the loop
// Do nothing now, the loop carried frequency will be
// adjust later in scale_freq().
*** 1974,1988 ****
//------------------------------scale_freq-------------------------------------
// Scale frequency of loops and blocks by trip counts from outer loops
// Do a top down traversal of loop tree (visit outer loops first.)
void CFGLoop::scale_freq() {
! float loop_freq = _freq * trip_count();
_freq = loop_freq;
for (int i = 0; i < _members.length(); i++) {
CFGElement* s = _members.at(i);
! float block_freq = s->_freq * loop_freq;
if (g_isnan(block_freq) || block_freq < MIN_BLOCK_FREQUENCY)
block_freq = MIN_BLOCK_FREQUENCY;
s->_freq = block_freq;
}
CFGLoop* ch = _child;
--- 1974,1988 ----
//------------------------------scale_freq-------------------------------------
// Scale frequency of loops and blocks by trip counts from outer loops
// Do a top down traversal of loop tree (visit outer loops first.)
void CFGLoop::scale_freq() {
! double loop_freq = _freq * trip_count();
_freq = loop_freq;
for (int i = 0; i < _members.length(); i++) {
CFGElement* s = _members.at(i);
! double block_freq = s->_freq * loop_freq;
if (g_isnan(block_freq) || block_freq < MIN_BLOCK_FREQUENCY)
block_freq = MIN_BLOCK_FREQUENCY;
s->_freq = block_freq;
}
CFGLoop* ch = _child;
*** 1991,2001 ****
ch = ch->_sibling;
}
}
// Frequency of outer loop
! float CFGLoop::outer_loop_freq() const {
if (_child != NULL) {
return _child->_freq;
}
return _freq;
}
--- 1991,2001 ----
ch = ch->_sibling;
}
}
// Frequency of outer loop
! double CFGLoop::outer_loop_freq() const {
if (_child != NULL) {
return _child->_freq;
}
return _freq;
}
*** 2040,2050 ****
tty->print("\n ");
for (int j = 0; j < _depth+1; j++) tty->print(" ");
k = 0;
}
Block *blk = _exits.at(i).get_target();
! float prob = _exits.at(i).get_prob();
tty->print(" ->%d@%d%%", blk->_pre_order, (int)(prob*100));
}
tty->print("\n");
}
#endif
--- 2040,2050 ----
tty->print("\n ");
for (int j = 0; j < _depth+1; j++) tty->print(" ");
k = 0;
}
Block *blk = _exits.at(i).get_target();
! double prob = _exits.at(i).get_prob();
tty->print(" ->%d@%d%%", blk->_pre_order, (int)(prob*100));
}
tty->print("\n");
}
#endif
src/share/vm/opto/gcm.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File