--- old/src/share/vm/opto/ifg.cpp 2015-09-14 20:02:47.374676100 -0700 +++ new/src/share/vm/opto/ifg.cpp 2015-09-14 20:02:47.187476100 -0700 @@ -439,8 +439,10 @@ } } } - assert(int_pressure.current_pressure() == count_int_pressure(liveout), "the int pressure is incorrect"); - assert(float_pressure.current_pressure() == count_float_pressure(liveout), "the float pressure is incorrect"); + if (_scheduling_info_generated == false) { + assert(int_pressure.current_pressure() == count_int_pressure(liveout), "the int pressure is incorrect"); + assert(float_pressure.current_pressure() == count_float_pressure(liveout), "the float pressure is incorrect"); + } } /* Go to the first non-phi index in a block */ @@ -518,6 +520,58 @@ } /* +* Computes the entry register pressure of a block, looking at all live +* ranges in the livein. The register pressure is computed for both float +* and int/pointer registers. +*/ +void PhaseChaitin::compute_entry_block_pressure(Block* b) { + IndexSet* livein = _live->livein(b); + IndexSetIterator elements(livein); + uint lid = elements.next(); + while (lid != 0) { + LRG& lrg = lrgs(lid); + raise_pressure(b, lrg, _sched_int_pressure, _sched_float_pressure); + lid = elements.next(); + } + // Now check phis for locally defined inputs + for (uint j = 0; j < b->number_of_nodes(); j++) { + Node* n = b->get_node(j); + if (n->is_Phi()) { + for (uint k = 1; k < n->req(); k++) { + Node* phi_in = n->in(k); + // Because we are talking about phis, raise register pressure once for each + // instance of a phi to account for a single value + if (_cfg.get_block_for_node(phi_in) == b) { + LRG& lrg = lrgs(phi_in->_idx); + raise_pressure(b, lrg, _sched_int_pressure, _sched_float_pressure); + break; + } + } + } + } + _sched_int_pressure.set_start_pressure(_sched_int_pressure.current_pressure()); + _sched_float_pressure.set_start_pressure(_sched_float_pressure.current_pressure()); +} + +/* +* Computes the exit register pressure of a block, looking at all live +* ranges in the liveout. The register pressure is computed for both float +* and int/pointer registers. +*/ +void PhaseChaitin::compute_exit_block_pressure(Block* b) { + IndexSet* livein = _live->live(b); + IndexSetIterator elements(livein); + _sched_int_pressure.set_current_pressure(0); + _sched_float_pressure.set_current_pressure(0); + uint lid = elements.next(); + while (lid != 0) { + LRG& lrg = lrgs(lid); + raise_pressure(b, lrg, _sched_int_pressure, _sched_float_pressure); + lid = elements.next(); + } +} + +/* * Remove dead node if it's not used. * We only remove projection nodes if the node "defining" the projection is * dead, for example on x86, if we have a dead Add node we remove its @@ -737,6 +791,16 @@ block_hrp_index = i; } +void PhaseChaitin::print_pressure_info(Pressure& pressure, const char *str) { + if (str != NULL) { + tty->print_cr("# *** %s ***", str); + } + tty->print_cr("# start pressure is = %d", pressure.start_pressure()); + tty->print_cr("# max pressure is = %d", pressure.final_pressure()); + tty->print_cr("# end pressure is = %d", pressure.current_pressure()); + tty->print_cr("#"); +} + /* Build an interference graph: * That is, if 2 live ranges are simultaneously alive but in their acceptable * register sets do not overlap, then they do not interfere. The IFG is built