src/share/vm/opto/lcm.cpp

changeset 5635
650868c062a9
parent 5539
adb9a7d94cb5
child 5639
4b078f877b56
     1.1 --- a/src/share/vm/opto/lcm.cpp	Mon Aug 26 16:12:20 2013 +0200
     1.2 +++ b/src/share/vm/opto/lcm.cpp	Mon Aug 26 12:50:23 2013 +0200
     1.3 @@ -75,11 +75,11 @@
     1.4    // Get the successor block for if the test ptr is non-null
     1.5    Block* not_null_block;  // this one goes with the proj
     1.6    Block* null_block;
     1.7 -  if (_nodes[_nodes.size()-1] == proj) {
     1.8 +  if (get_node(number_of_nodes()-1) == proj) {
     1.9      null_block     = _succs[0];
    1.10      not_null_block = _succs[1];
    1.11    } else {
    1.12 -    assert(_nodes[_nodes.size()-2] == proj, "proj is one or the other");
    1.13 +    assert(get_node(number_of_nodes()-2) == proj, "proj is one or the other");
    1.14      not_null_block = _succs[0];
    1.15      null_block     = _succs[1];
    1.16    }
    1.17 @@ -94,7 +94,7 @@
    1.18    {
    1.19      bool found_trap = false;
    1.20      for (uint i1 = 0; i1 < null_block->_nodes.size(); i1++) {
    1.21 -      Node* nn = null_block->_nodes[i1];
    1.22 +      Node* nn = null_block->get_node(i1);
    1.23        if (nn->is_MachCall() &&
    1.24            nn->as_MachCall()->entry_point() == SharedRuntime::uncommon_trap_blob()->entry_point()) {
    1.25          const Type* trtype = nn->in(TypeFunc::Parms)->bottom_type();
    1.26 @@ -282,7 +282,7 @@
    1.27        while( b != this ) {
    1.28          uint k;
    1.29          for( k = 1; k < b->_nodes.size(); k++ ) {
    1.30 -          Node *n = b->_nodes[k];
    1.31 +          Node *n = b->get_node(k);
    1.32            if( n->needs_anti_dependence_check() &&
    1.33                n->in(LoadNode::Memory) == mach->in(StoreNode::Memory) )
    1.34              break;              // Found anti-dependent load
    1.35 @@ -344,8 +344,8 @@
    1.36    cfg->map_node_to_block(best, this);
    1.37  
    1.38    // Move the control dependence
    1.39 -  if (best->in(0) && best->in(0) == old_block->_nodes[0])
    1.40 -    best->set_req(0, _nodes[0]);
    1.41 +  if (best->in(0) && best->in(0) == old_block->head())
    1.42 +    best->set_req(0, head());
    1.43  
    1.44    // Check for flag-killing projections that also need to be hoisted
    1.45    // Should be DU safe because no edge updates.
    1.46 @@ -368,8 +368,8 @@
    1.47    // We need to flip the projections to keep the same semantics.
    1.48    if( proj->Opcode() == Op_IfTrue ) {
    1.49      // Swap order of projections in basic block to swap branch targets
    1.50 -    Node *tmp1 = _nodes[end_idx()+1];
    1.51 -    Node *tmp2 = _nodes[end_idx()+2];
    1.52 +    Node *tmp1 = get_node(end_idx()+1);
    1.53 +    Node *tmp2 = get_node(end_idx()+2);
    1.54      _nodes.map(end_idx()+1, tmp2);
    1.55      _nodes.map(end_idx()+2, tmp1);
    1.56      Node *tmp = new (C) Node(C->top()); // Use not NULL input
    1.57 @@ -624,7 +624,7 @@
    1.58    int op = mcall->ideal_Opcode();
    1.59    MachProjNode *proj = new (matcher.C) MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj );
    1.60    cfg->map_node_to_block(proj, this);
    1.61 -  _nodes.insert(node_cnt++, proj);
    1.62 +  insert_node(proj, node_cnt++);
    1.63  
    1.64    // Select the right register save policy.
    1.65    const char * save_policy;
    1.66 @@ -685,7 +685,7 @@
    1.67        tty->print_cr("# --- schedule_local B%d, before: ---", _pre_order);
    1.68        for (uint i = 0;i < _nodes.size();i++) {
    1.69          tty->print("# ");
    1.70 -        _nodes[i]->fast_dump();
    1.71 +        get_node(i)->fast_dump();
    1.72        }
    1.73        tty->print_cr("#");
    1.74      }
    1.75 @@ -699,11 +699,11 @@
    1.76    uint phi_cnt = 1;
    1.77    uint i;
    1.78    for( i = 1; i<node_cnt; i++ ) { // Scan for Phi
    1.79 -    Node *n = _nodes[i];
    1.80 +    Node *n = get_node(i);
    1.81      if( n->is_Phi() ||          // Found a PhiNode or ParmNode
    1.82          (n->is_Proj()  && n->in(0) == head()) ) {
    1.83        // Move guy at 'phi_cnt' to the end; makes a hole at phi_cnt
    1.84 -      _nodes.map(i,_nodes[phi_cnt]);
    1.85 +      _nodes.map(i,get_node(phi_cnt));
    1.86        _nodes.map(phi_cnt++,n);  // swap Phi/Parm up front
    1.87      } else {                    // All others
    1.88        // Count block-local inputs to 'n'
    1.89 @@ -748,12 +748,12 @@
    1.90      }
    1.91    }
    1.92    for(uint i2=i; i2<_nodes.size(); i2++ ) // Trailing guys get zapped count
    1.93 -    ready_cnt.at_put(_nodes[i2]->_idx, 0);
    1.94 +    ready_cnt.at_put(get_node(i2)->_idx, 0);
    1.95  
    1.96    // All the prescheduled guys do not hold back internal nodes
    1.97    uint i3;
    1.98    for(i3 = 0; i3<phi_cnt; i3++ ) {  // For all pre-scheduled
    1.99 -    Node *n = _nodes[i3];       // Get pre-scheduled
   1.100 +    Node *n = get_node(i3);       // Get pre-scheduled
   1.101      for (DUIterator_Fast jmax, j = n->fast_outs(jmax); j < jmax; j++) {
   1.102        Node* m = n->fast_out(j);
   1.103        if (cfg->get_block_for_node(m) == this) { // Local-block user
   1.104 @@ -767,7 +767,7 @@
   1.105    // Make a worklist
   1.106    Node_List worklist;
   1.107    for(uint i4=i3; i4<node_cnt; i4++ ) {    // Put ready guys on worklist
   1.108 -    Node *m = _nodes[i4];
   1.109 +    Node *m = get_node(i4);
   1.110      if( !ready_cnt.at(m->_idx) ) {   // Zero ready count?
   1.111        if (m->is_iteratively_computed()) {
   1.112          // Push induction variable increments last to allow other uses
   1.113 @@ -789,12 +789,12 @@
   1.114    }
   1.115  
   1.116    // Warm up the 'next_call' heuristic bits
   1.117 -  needed_for_next_call(_nodes[0], next_call, cfg);
   1.118 +  needed_for_next_call(head(), next_call, cfg);
   1.119  
   1.120  #ifndef PRODUCT
   1.121      if (cfg->trace_opto_pipelining()) {
   1.122        for (uint j=0; j<_nodes.size(); j++) {
   1.123 -        Node     *n = _nodes[j];
   1.124 +        Node     *n = get_node(j);
   1.125          int     idx = n->_idx;
   1.126          tty->print("#   ready cnt:%3d  ", ready_cnt.at(idx));
   1.127          tty->print("latency:%3d  ", cfg->get_latency_for_node(n));
   1.128 @@ -851,7 +851,7 @@
   1.129  
   1.130        MachProjNode *proj = new (matcher.C) MachProjNode( n, 1, RegMask::Empty, MachProjNode::fat_proj );
   1.131        cfg->map_node_to_block(proj, this);
   1.132 -      _nodes.insert(phi_cnt++, proj);
   1.133 +      insert_node(proj, phi_cnt++);
   1.134  
   1.135        add_call_kills(proj, regs, matcher._c_reg_save_policy, false);
   1.136      }
   1.137 @@ -893,7 +893,7 @@
   1.138      tty->print_cr("# after schedule_local");
   1.139      for (uint i = 0;i < _nodes.size();i++) {
   1.140        tty->print("# ");
   1.141 -      _nodes[i]->fast_dump();
   1.142 +      get_node(i)->fast_dump();
   1.143      }
   1.144      tty->cr();
   1.145    }
   1.146 @@ -952,7 +952,7 @@
   1.147      // Check to see if the use_blk already has an identical phi inserted.
   1.148      // If it exists, it will be at the first position since all uses of a
   1.149      // def are processed together.
   1.150 -    Node *phi = use_blk->_nodes[1];
   1.151 +    Node *phi = use_blk->get_node(1);
   1.152      if( phi->is_Phi() ) {
   1.153        fixup = phi;
   1.154        for (uint k = 1; k < use_blk->num_preds(); k++) {
   1.155 @@ -967,7 +967,7 @@
   1.156      // If an existing PhiNode was not found, make a new one.
   1.157      if (fixup == NULL) {
   1.158        Node *new_phi = PhiNode::make(use_blk->head(), def);
   1.159 -      use_blk->_nodes.insert(1, new_phi);
   1.160 +      use_blk->insert_node(new_phi, 1);
   1.161        cfg->map_node_to_block(new_phi, use_blk);
   1.162        for (uint k = 1; k < use_blk->num_preds(); k++) {
   1.163          new_phi->set_req(k, inputs[k]);
   1.164 @@ -977,7 +977,7 @@
   1.165  
   1.166    } else {
   1.167      // Found the use just below the Catch.  Make it use the clone.
   1.168 -    fixup = use_blk->_nodes[n_clone_idx];
   1.169 +    fixup = use_blk->get_node(n_clone_idx);
   1.170    }
   1.171  
   1.172    return fixup;
   1.173 @@ -997,11 +997,11 @@
   1.174    for( uint k = 0; k < blk->_num_succs; k++ ) {
   1.175      // Get clone in each successor block
   1.176      Block *sb = blk->_succs[k];
   1.177 -    Node *clone = sb->_nodes[offset_idx+1];
   1.178 +    Node *clone = sb->get_node(offset_idx+1);
   1.179      assert( clone->Opcode() == use->Opcode(), "" );
   1.180  
   1.181      // Make use-clone reference the def-clone
   1.182 -    catch_cleanup_fix_all_inputs(clone, def, sb->_nodes[n_clone_idx]);
   1.183 +    catch_cleanup_fix_all_inputs(clone, def, sb->get_node(n_clone_idx));
   1.184    }
   1.185  }
   1.186  
   1.187 @@ -1022,11 +1022,11 @@
   1.188  
   1.189    // End of region to clone
   1.190    uint end = end_idx();
   1.191 -  if( !_nodes[end]->is_Catch() ) return;
   1.192 +  if( !get_node(end)->is_Catch() ) return;
   1.193    // Start of region to clone
   1.194    uint beg = end;
   1.195 -  while(!_nodes[beg-1]->is_MachProj() ||
   1.196 -        !_nodes[beg-1]->in(0)->is_MachCall() ) {
   1.197 +  while(!get_node(beg-1)->is_MachProj() ||
   1.198 +        !get_node(beg-1)->in(0)->is_MachCall() ) {
   1.199      beg--;
   1.200      assert(beg > 0,"Catch cleanup walking beyond block boundary");
   1.201    }
   1.202 @@ -1041,8 +1041,8 @@
   1.203      for( uint j = end; j > beg; j-- ) {
   1.204        // It is safe here to clone a node with anti_dependence
   1.205        // since clones dominate on each path.
   1.206 -      Node *clone = _nodes[j-1]->clone();
   1.207 -      sb->_nodes.insert( 1, clone );
   1.208 +      Node *clone = get_node(j-1)->clone();
   1.209 +      sb->insert_node(clone, 1);
   1.210        cfg->map_node_to_block(clone, sb);
   1.211      }
   1.212    }
   1.213 @@ -1051,7 +1051,7 @@
   1.214    // Fixup edges.  Check the def-use info per cloned Node
   1.215    for(uint i2 = beg; i2 < end; i2++ ) {
   1.216      uint n_clone_idx = i2-beg+1; // Index of clone of n in each successor block
   1.217 -    Node *n = _nodes[i2];        // Node that got cloned
   1.218 +    Node *n = get_node(i2);        // Node that got cloned
   1.219      // Need DU safe iterator because of edge manipulation in calls.
   1.220      Unique_Node_List *out = new Unique_Node_List(Thread::current()->resource_area());
   1.221      for (DUIterator_Fast j1max, j1 = n->fast_outs(j1max); j1 < j1max; j1++) {
   1.222 @@ -1081,8 +1081,8 @@
   1.223  
   1.224    // Remove the now-dead cloned ops
   1.225    for(uint i3 = beg; i3 < end; i3++ ) {
   1.226 -    _nodes[beg]->disconnect_inputs(NULL, C);
   1.227 -    _nodes.remove(beg);
   1.228 +    get_node(beg)->disconnect_inputs(NULL, C);
   1.229 +    remove_node(beg);
   1.230    }
   1.231  
   1.232    // If the successor blocks have a CreateEx node, move it back to the top
   1.233 @@ -1091,20 +1091,20 @@
   1.234      uint new_cnt = end - beg;
   1.235      // Remove any newly created, but dead, nodes.
   1.236      for( uint j = new_cnt; j > 0; j-- ) {
   1.237 -      Node *n = sb->_nodes[j];
   1.238 +      Node *n = sb->get_node(j);
   1.239        if (n->outcnt() == 0 &&
   1.240            (!n->is_Proj() || n->as_Proj()->in(0)->outcnt() == 1) ){
   1.241          n->disconnect_inputs(NULL, C);
   1.242 -        sb->_nodes.remove(j);
   1.243 +        sb->remove_node(j);
   1.244          new_cnt--;
   1.245        }
   1.246      }
   1.247      // If any newly created nodes remain, move the CreateEx node to the top
   1.248      if (new_cnt > 0) {
   1.249 -      Node *cex = sb->_nodes[1+new_cnt];
   1.250 +      Node *cex = sb->get_node(1+new_cnt);
   1.251        if( cex->is_Mach() && cex->as_Mach()->ideal_Opcode() == Op_CreateEx ) {
   1.252 -        sb->_nodes.remove(1+new_cnt);
   1.253 -        sb->_nodes.insert(1,cex);
   1.254 +        sb->remove_node(1+new_cnt);
   1.255 +        sb->insert_node(cex, 1);
   1.256        }
   1.257      }
   1.258    }

mercurial