src/share/vm/opto/chaitin.cpp

changeset 5509
d1034bd8cefc
parent 5285
693e4d04fd09
child 5539
adb9a7d94cb5
     1.1 --- a/src/share/vm/opto/chaitin.cpp	Mon Aug 05 15:03:40 2013 -0700
     1.2 +++ b/src/share/vm/opto/chaitin.cpp	Wed Aug 07 17:56:19 2013 +0200
     1.3 @@ -295,7 +295,7 @@
     1.4  
     1.5  
     1.6  bool PhaseChaitin::clone_projs_shared(Block *b, uint idx, Node *con, Node *copy, uint max_lrg_id) {
     1.7 -  Block *bcon = _cfg._bbs[con->_idx];
     1.8 +  Block* bcon = _cfg.get_block_for_node(con);
     1.9    uint cindex = bcon->find_node(con);
    1.10    Node *con_next = bcon->_nodes[cindex+1];
    1.11    if (con_next->in(0) != con || !con_next->is_MachProj()) {
    1.12 @@ -306,7 +306,7 @@
    1.13    Node *kills = con_next->clone();
    1.14    kills->set_req(0, copy);
    1.15    b->_nodes.insert(idx, kills);
    1.16 -  _cfg._bbs.map(kills->_idx, b);
    1.17 +  _cfg.map_node_to_block(kills, b);
    1.18    new_lrg(kills, max_lrg_id);
    1.19    return true;
    1.20  }
    1.21 @@ -962,8 +962,7 @@
    1.22          // AggressiveCoalesce.  This effectively pre-virtual-splits
    1.23          // around uncommon uses of common defs.
    1.24          const RegMask &rm = n->in_RegMask(k);
    1.25 -        if( !after_aggressive &&
    1.26 -          _cfg._bbs[n->in(k)->_idx]->_freq > 1000*b->_freq ) {
    1.27 +        if (!after_aggressive && _cfg.get_block_for_node(n->in(k))->_freq > 1000 * b->_freq) {
    1.28            // Since we are BEFORE aggressive coalesce, leave the register
    1.29            // mask untrimmed by the call.  This encourages more coalescing.
    1.30            // Later, AFTER aggressive, this live range will have to spill
    1.31 @@ -1709,16 +1708,15 @@
    1.32        // set control to _root and place it into Start block
    1.33        // (where top() node is placed).
    1.34        base->init_req(0, _cfg._root);
    1.35 -      Block *startb = _cfg._bbs[C->top()->_idx];
    1.36 +      Block *startb = _cfg.get_block_for_node(C->top());
    1.37        startb->_nodes.insert(startb->find_node(C->top()), base );
    1.38 -      _cfg._bbs.map( base->_idx, startb );
    1.39 +      _cfg.map_node_to_block(base, startb);
    1.40        assert(_lrg_map.live_range_id(base) == 0, "should not have LRG yet");
    1.41      }
    1.42      if (_lrg_map.live_range_id(base) == 0) {
    1.43        new_lrg(base, maxlrg++);
    1.44      }
    1.45 -    assert(base->in(0) == _cfg._root &&
    1.46 -           _cfg._bbs[base->_idx] == _cfg._bbs[C->top()->_idx], "base NULL should be shared");
    1.47 +    assert(base->in(0) == _cfg._root && _cfg.get_block_for_node(base) == _cfg.get_block_for_node(C->top()), "base NULL should be shared");
    1.48      derived_base_map[derived->_idx] = base;
    1.49      return base;
    1.50    }
    1.51 @@ -1754,12 +1752,12 @@
    1.52    base->as_Phi()->set_type(t);
    1.53  
    1.54    // Search the current block for an existing base-Phi
    1.55 -  Block *b = _cfg._bbs[derived->_idx];
    1.56 +  Block *b = _cfg.get_block_for_node(derived);
    1.57    for( i = 1; i <= b->end_idx(); i++ ) {// Search for matching Phi
    1.58      Node *phi = b->_nodes[i];
    1.59      if( !phi->is_Phi() ) {      // Found end of Phis with no match?
    1.60        b->_nodes.insert( i, base ); // Must insert created Phi here as base
    1.61 -      _cfg._bbs.map( base->_idx, b );
    1.62 +      _cfg.map_node_to_block(base, b);
    1.63        new_lrg(base,maxlrg++);
    1.64        break;
    1.65      }
    1.66 @@ -1815,8 +1813,8 @@
    1.67        if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CmpI ) {
    1.68          Node *phi = n->in(1);
    1.69          if( phi->is_Phi() && phi->as_Phi()->region()->is_Loop() ) {
    1.70 -          Block *phi_block = _cfg._bbs[phi->_idx];
    1.71 -          if( _cfg._bbs[phi_block->pred(2)->_idx] == b ) {
    1.72 +          Block *phi_block = _cfg.get_block_for_node(phi);
    1.73 +          if (_cfg.get_block_for_node(phi_block->pred(2)) == b) {
    1.74              const RegMask *mask = C->matcher()->idealreg2spillmask[Op_RegI];
    1.75              Node *spill = new (C) MachSpillCopyNode( phi, *mask, *mask );
    1.76              insert_proj( phi_block, 1, spill, maxlrg++ );
    1.77 @@ -1870,7 +1868,7 @@
    1.78              if ((_lrg_map.live_range_id(base) >= _lrg_map.max_lrg_id() || // (Brand new base (hence not live) or
    1.79                   !liveout.member(_lrg_map.live_range_id(base))) && // not live) AND
    1.80                   (_lrg_map.live_range_id(base) > 0) && // not a constant
    1.81 -                 _cfg._bbs[base->_idx] != b) { // base not def'd in blk)
    1.82 +                 _cfg.get_block_for_node(base) != b) { // base not def'd in blk)
    1.83                // Base pointer is not currently live.  Since I stretched
    1.84                // the base pointer to here and it crosses basic-block
    1.85                // boundaries, the global live info is now incorrect.
    1.86 @@ -1993,8 +1991,8 @@
    1.87    tty->print("\n");
    1.88  }
    1.89  
    1.90 -void PhaseChaitin::dump( const Block * b ) const {
    1.91 -  b->dump_head( &_cfg._bbs );
    1.92 +void PhaseChaitin::dump(const Block *b) const {
    1.93 +  b->dump_head(&_cfg);
    1.94  
    1.95    // For all instructions
    1.96    for( uint j = 0; j < b->_nodes.size(); j++ )
    1.97 @@ -2299,7 +2297,7 @@
    1.98        if (_lrg_map.find_const(n) == lidx) {
    1.99          if (!dump_once++) {
   1.100            tty->cr();
   1.101 -          b->dump_head( &_cfg._bbs );
   1.102 +          b->dump_head(&_cfg);
   1.103          }
   1.104          dump(n);
   1.105          continue;
   1.106 @@ -2314,7 +2312,7 @@
   1.107            if (_lrg_map.find_const(m) == lidx) {
   1.108              if (!dump_once++) {
   1.109                tty->cr();
   1.110 -              b->dump_head(&_cfg._bbs);
   1.111 +              b->dump_head(&_cfg);
   1.112              }
   1.113              dump(n);
   1.114            }

mercurial