src/share/vm/opto/reg_split.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/reg_split.cpp Fri Aug 23 23:47:50 2013
--- new/src/share/vm/opto/reg_split.cpp Fri Aug 23 23:47:50 2013
*** 110,139 ****
--- 110,139 ----
// Phis. Skip over a CatchNode and projs, inserting in the fall-through block
// instead. Update high-pressure indices. Create a new live range.
void PhaseChaitin::insert_proj( Block *b, uint i, Node *spill, uint maxlrg ) {
// Skip intervening ProjNodes. Do not insert between a ProjNode and
// its definer.
! while( i < b->_nodes.size() &&
! (b->_nodes[i]->is_Proj() ||
! b->_nodes[i]->is_Phi() ) )
! while( i < b->number_of_nodes() &&
! (b->get_node(i)->is_Proj() ||
! b->get_node(i)->is_Phi() ) )
i++;
// Do not insert between a call and his Catch
! if( b->_nodes[i]->is_Catch() ) {
! if( b->get_node(i)->is_Catch() ) {
// Put the instruction at the top of the fall-thru block.
// Find the fall-thru projection
while( 1 ) {
! const CatchProjNode *cp = b->_nodes[++i]->as_CatchProj();
! const CatchProjNode *cp = b->get_node(++i)->as_CatchProj();
if( cp->_con == CatchProjNode::fall_through_index )
break;
}
int sidx = i - b->end_idx()-1;
b = b->_succs[sidx]; // Switch to successor block
i = 1; // Right at start of block
}
! b->_nodes.insert(i,spill); // Insert node in block
! b->insert_node(spill, i); // Insert node in block
_cfg.map_node_to_block(spill, b); // Update node->block mapping to reflect
// Adjust the point where we go hi-pressure
if( i <= b->_ihrp_index ) b->_ihrp_index++;
if( i <= b->_fhrp_index ) b->_fhrp_index++;
*** 158,170 ****
--- 158,170 ----
// null check location (ie - null check is in HRP block) we need to do
// the null-check first, then spill-down in the following block.
// (The implicit_null_check function ensures the use is also dominated
// by the branch-not-taken block.)
Node *be = b->end();
! if( be->is_MachNullCheck() && be->in(1) == def && def == b->_nodes[loc] ) {
! if( be->is_MachNullCheck() && be->in(1) == def && def == b->get_node(loc)) {
// Spill goes in the branch-not-taken block
! b = b->_succs[b->_nodes[b->end_idx()+1]->Opcode() == Op_IfTrue];
! b = b->_succs[b->get_node(b->end_idx()+1)->Opcode() == Op_IfTrue];
loc = 0; // Just past the Region
}
assert( loc >= 0, "must insert past block head" );
// Get a def-side SpillCopy
*** 448,458 ****
--- 448,458 ----
return false;
}
// Scan block for 1st use.
for( uint i = 1; i <= b->end_idx(); i++ ) {
! Node *n = b->_nodes[i];
! Node *n = b->get_node(i);
// Ignore PHI use, these can be up or down
if (n->is_Phi()) {
continue;
}
for (uint j = 1; j < n->req(); j++) {
*** 645,655 ****
--- 645,655 ----
}
} // End for all potential Phi inputs
// check block for appropriate phinode & update edges
for( insidx = 1; insidx <= b->end_idx(); insidx++ ) {
! n1 = b->_nodes[insidx];
! n1 = b->get_node(insidx);
// bail if this is not a phi
phi = n1->is_Phi() ? n1->as_Phi() : NULL;
if( phi == NULL ) {
// Keep track of index of first non-PhiNode instruction in block
non_phi = insidx;
*** 745,755 ****
--- 745,755 ----
}
//----------Walk Instructions in the Block and Split----------
// For all non-phi instructions in the block
for( insidx = 1; insidx <= b->end_idx(); insidx++ ) {
! Node *n = b->_nodes[insidx];
! Node *n = b->get_node(insidx);
// Find the defining Node's live range index
uint defidx = _lrg_map.find_id(n);
uint cnt = n->req();
if (n->is_Phi()) {
*** 774,784 ****
--- 774,784 ----
assert( u, "at least 1 valid input expected" );
if (i >= cnt) { // Found one unique input
assert(_lrg_map.find_id(n) == _lrg_map.find_id(u), "should be the same lrg");
n->replace_by(u); // Then replace with unique input
n->disconnect_inputs(NULL, C);
! b->_nodes.remove(insidx);
! b->remove_node(insidx);
insidx--;
b->_ihrp_index--;
b->_fhrp_index--;
}
}
*** 787,802 ****
--- 787,802 ----
}
assert( insidx > b->_ihrp_index ||
(b->_reg_pressure < (uint)INTPRESSURE) ||
b->_ihrp_index > 4000000 ||
b->_ihrp_index >= b->end_idx() ||
! !b->_nodes[b->_ihrp_index]->is_Proj(), "" );
! !b->get_node(b->_ihrp_index)->is_Proj(), "" );
assert( insidx > b->_fhrp_index ||
(b->_freg_pressure < (uint)FLOATPRESSURE) ||
b->_fhrp_index > 4000000 ||
b->_fhrp_index >= b->end_idx() ||
! !b->_nodes[b->_fhrp_index]->is_Proj(), "" );
! !b->get_node(b->_fhrp_index)->is_Proj(), "" );
// ********** Handle Crossing HRP Boundry **********
if( (insidx == b->_ihrp_index) || (insidx == b->_fhrp_index) ) {
for( slidx = 0; slidx < spill_cnt; slidx++ ) {
// Check for need to split at HRP boundary - split if UP
*** 817,827 ****
--- 817,827 ----
}
else {
// Insert point is just past last use or def in the block
int insert_point = insidx-1;
while( insert_point > 0 ) {
! Node *n = b->_nodes[insert_point];
! Node *n = b->get_node(insert_point);
// Hit top of block? Quit going backwards
if (n->is_Phi()) {
break;
}
// Found a def? Better split after it.
*** 863,873 ****
--- 863,873 ----
}
#endif
}
} // end if LRG is UP
} // end for all spilling live ranges
! assert( b->_nodes[insidx] == n, "got insidx set incorrectly" );
! assert( b->get_node(insidx) == n, "got insidx set incorrectly" );
} // end if crossing HRP Boundry
// If the LRG index is oob, then this is a new spillcopy, skip it.
if (defidx >= _lrg_map.max_lrg_id()) {
continue;
*** 876,886 ****
--- 876,886 ----
uint copyidx = n->is_Copy();
// Remove coalesced copy from CFG
if (copyidx && defidx == _lrg_map.live_range_id(n->in(copyidx))) {
n->replace_by( n->in(copyidx) );
n->set_req( copyidx, NULL );
! b->_nodes.remove(insidx--);
! b->remove_node(insidx--);
b->_ihrp_index--; // Adjust the point where we go hi-pressure
b->_fhrp_index--;
continue;
}
*** 930,943 ****
--- 930,943 ----
}
// Rematerializable? Then clone def at use site instead
// of store/load
if( def->rematerialize() ) {
! int old_size = b->_nodes.size();
! int old_size = b->number_of_nodes();
def = split_Rematerialize( def, b, insidx, maxlrg, splits, slidx, lrg2reach, Reachblock, true );
if( !def ) return 0; // Bail out
! insidx += b->_nodes.size()-old_size;
! insidx += b->number_of_nodes()-old_size;
}
MachNode *mach = n->is_Mach() ? n->as_Mach() : NULL;
// Base pointers and oopmap references do not care where they live.
if ((inpidx >= oopoff) ||
*** 1330,1341 ****
--- 1330,1341 ----
// Place the rematerialized node above any MSCs created during
// phi node splitting. end_idx points at the insertion point
// so look at the node before it.
int insert = pred->end_idx();
while (insert >= 1 &&
! pred->_nodes[insert - 1]->is_SpillCopy() &&
! _lrg_map.find(pred->_nodes[insert - 1]) >= lrgs_before_phi_split) {
! pred->get_node(insert - 1)->is_SpillCopy() &&
! _lrg_map.find(pred->get_node(insert - 1)) >= lrgs_before_phi_split) {
insert--;
}
def = split_Rematerialize(def, pred, insert, maxlrg, splits, slidx, lrg2reach, Reachblock, false);
if (!def) {
return 0; // Bail out
*** 1400,1410 ****
--- 1400,1410 ----
#ifdef ASSERT
// Validate all live range index assignments
for (bidx = 0; bidx < _cfg.number_of_blocks(); bidx++) {
b = _cfg.get_block(bidx);
for (insidx = 0; insidx <= b->end_idx(); insidx++) {
! Node *n = b->_nodes[insidx];
! Node *n = b->get_node(insidx);
uint defidx = _lrg_map.find(n);
assert(defidx < _lrg_map.max_lrg_id(), "Bad live range index in Split");
assert(defidx < maxlrg,"Bad live range index in Split");
}
}
src/share/vm/opto/reg_split.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File