src/share/vm/opto/chaitin.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8021898 Sdiff src/share/vm/opto

src/share/vm/opto/chaitin.cpp

Print this page




 277 void PhaseChaitin::Union( const Node *src_n, const Node *dst_n ) {
 278   uint src = _lrg_map.find(src_n);
 279   uint dst = _lrg_map.find(dst_n);
 280   assert(src, "");
 281   assert(dst, "");
 282   assert(src < _lrg_map.max_lrg_id(), "oob");
 283   assert(dst < _lrg_map.max_lrg_id(), "oob");
 284   assert(src < dst, "always union smaller");
 285   _lrg_map.uf_map(dst, src);
 286 }
 287 
 288 //------------------------------new_lrg----------------------------------------
 289 void PhaseChaitin::new_lrg(const Node *x, uint lrg) {
 290   // Make the Node->LRG mapping
 291   _lrg_map.extend(x->_idx,lrg);
 292   // Make the Union-Find mapping an identity function
 293   _lrg_map.uf_extend(lrg, lrg);
 294 }
 295 
 296 
 297 bool PhaseChaitin::clone_projs_shared(Block *b, uint idx, Node *con, Node *copy, uint max_lrg_id) {
 298   Block *bcon = _cfg._bbs[con->_idx];
 299   uint cindex = bcon->find_node(con);
 300   Node *con_next = bcon->_nodes[cindex+1];
 301   if (con_next->in(0) != con || !con_next->is_MachProj()) {
 302     return false;               // No MachProj's follow
 303   }
 304 
 305   // Copy kills after the cloned constant
 306   Node *kills = con_next->clone();
 307   kills->set_req(0, copy);
 308   b->_nodes.insert(idx, kills);
 309   _cfg._bbs.map(kills->_idx, b);
 310   new_lrg(kills, max_lrg_id);
 311   return true;


 312 }
 313 
 314 //------------------------------compact----------------------------------------
 315 // Renumber the live ranges to compact them.  Makes the IFG smaller.
 316 void PhaseChaitin::compact() {
 317   // Current the _uf_map contains a series of short chains which are headed
 318   // by a self-cycle.  All the chains run from big numbers to little numbers.
 319   // The Find() call chases the chains & shortens them for the next Find call.
 320   // We are going to change this structure slightly.  Numbers above a moving
 321   // wave 'i' are unchanged.  Numbers below 'j' point directly to their
 322   // compacted live range with no further chaining.  There are no chains or
 323   // cycles below 'i', so the Find call no longer works.
 324   uint j=1;
 325   uint i;
 326   for (i = 1; i < _lrg_map.max_lrg_id(); i++) {
 327     uint lr = _lrg_map.uf_live_range_id(i);
 328     // Ignore unallocated live ranges
 329     if (!lr) {
 330       continue;
 331     }




 277 void PhaseChaitin::Union( const Node *src_n, const Node *dst_n ) {
 278   uint src = _lrg_map.find(src_n);
 279   uint dst = _lrg_map.find(dst_n);
 280   assert(src, "");
 281   assert(dst, "");
 282   assert(src < _lrg_map.max_lrg_id(), "oob");
 283   assert(dst < _lrg_map.max_lrg_id(), "oob");
 284   assert(src < dst, "always union smaller");
 285   _lrg_map.uf_map(dst, src);
 286 }
 287 
 288 //------------------------------new_lrg----------------------------------------
 289 void PhaseChaitin::new_lrg(const Node *x, uint lrg) {
 290   // Make the Node->LRG mapping
 291   _lrg_map.extend(x->_idx,lrg);
 292   // Make the Union-Find mapping an identity function
 293   _lrg_map.uf_extend(lrg, lrg);
 294 }
 295 
 296 
 297 int PhaseChaitin::clone_projs(Block *b, uint idx, Node *orig, Node *copy, uint &max_lrg_id) {
 298   assert(b->find_node(copy) == (idx - 1), "incorrect insert index for copy kill projections");
 299   Block* borig = _cfg._bbs[orig->_idx];
 300   uint  bindex = borig->find_node(orig) + 1;
 301   Node* proj   = borig->_nodes[bindex++];
 302   int found_projs = 0;
 303   while (proj->in(0) == orig && proj->is_MachProj()) {
 304     found_projs++;
 305     // Copy kill projections after the cloned node
 306     Node* kills = proj->clone();
 307     kills->set_req(0, copy);
 308     b->_nodes.insert(idx++, kills);
 309     _cfg._bbs.map(kills->_idx, b);
 310     new_lrg(kills, max_lrg_id++);
 311     proj = borig->_nodes[bindex++];
 312   }
 313   return found_projs;
 314 }
 315 
 316 //------------------------------compact----------------------------------------
 317 // Renumber the live ranges to compact them.  Makes the IFG smaller.
 318 void PhaseChaitin::compact() {
 319   // Current the _uf_map contains a series of short chains which are headed
 320   // by a self-cycle.  All the chains run from big numbers to little numbers.
 321   // The Find() call chases the chains & shortens them for the next Find call.
 322   // We are going to change this structure slightly.  Numbers above a moving
 323   // wave 'i' are unchanged.  Numbers below 'j' point directly to their
 324   // compacted live range with no further chaining.  There are no chains or
 325   // cycles below 'i', so the Find call no longer works.
 326   uint j=1;
 327   uint i;
 328   for (i = 1; i < _lrg_map.max_lrg_id(); i++) {
 329     uint lr = _lrg_map.uf_live_range_id(i);
 330     // Ignore unallocated live ranges
 331     if (!lr) {
 332       continue;
 333     }


src/share/vm/opto/chaitin.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File