src/share/vm/opto/gcm.cpp

changeset 2040
0e35fa8ebccd
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/opto/gcm.cpp	Fri Jul 30 10:21:15 2010 -0700
     1.2 +++ b/src/share/vm/opto/gcm.cpp	Tue Aug 03 15:55:03 2010 -0700
     1.3 @@ -841,7 +841,7 @@
     1.4  #ifndef PRODUCT
     1.5    if (trace_opto_pipelining()) {
     1.6      tty->print("# latency_to_inputs: node_latency[%d] = %d for node",
     1.7 -               n->_idx, _node_latency.at_grow(n->_idx));
     1.8 +               n->_idx, _node_latency->at_grow(n->_idx));
     1.9      dump();
    1.10    }
    1.11  #endif
    1.12 @@ -853,7 +853,7 @@
    1.13      return;
    1.14  
    1.15    uint nlen = n->len();
    1.16 -  uint use_latency = _node_latency.at_grow(n->_idx);
    1.17 +  uint use_latency = _node_latency->at_grow(n->_idx);
    1.18    uint use_pre_order = _bbs[n->_idx]->_pre_order;
    1.19  
    1.20    for ( uint j=0; j<nlen; j++ ) {
    1.21 @@ -884,15 +884,15 @@
    1.22      uint delta_latency = n->latency(j);
    1.23      uint current_latency = delta_latency + use_latency;
    1.24  
    1.25 -    if (_node_latency.at_grow(def->_idx) < current_latency) {
    1.26 -      _node_latency.at_put_grow(def->_idx, current_latency);
    1.27 +    if (_node_latency->at_grow(def->_idx) < current_latency) {
    1.28 +      _node_latency->at_put_grow(def->_idx, current_latency);
    1.29      }
    1.30  
    1.31  #ifndef PRODUCT
    1.32      if (trace_opto_pipelining()) {
    1.33        tty->print_cr("#      %d + edge_latency(%d) == %d -> %d, node_latency[%d] = %d",
    1.34                      use_latency, j, delta_latency, current_latency, def->_idx,
    1.35 -                    _node_latency.at_grow(def->_idx));
    1.36 +                    _node_latency->at_grow(def->_idx));
    1.37      }
    1.38  #endif
    1.39    }
    1.40 @@ -926,7 +926,7 @@
    1.41        return 0;
    1.42  
    1.43      uint nlen = use->len();
    1.44 -    uint nl = _node_latency.at_grow(use->_idx);
    1.45 +    uint nl = _node_latency->at_grow(use->_idx);
    1.46  
    1.47      for ( uint j=0; j<nlen; j++ ) {
    1.48        if (use->in(j) == n) {
    1.49 @@ -962,7 +962,7 @@
    1.50  #ifndef PRODUCT
    1.51    if (trace_opto_pipelining()) {
    1.52      tty->print("# latency_from_outputs: node_latency[%d] = %d for node",
    1.53 -               n->_idx, _node_latency.at_grow(n->_idx));
    1.54 +               n->_idx, _node_latency->at_grow(n->_idx));
    1.55      dump();
    1.56    }
    1.57  #endif
    1.58 @@ -975,7 +975,7 @@
    1.59      if (latency < l) latency = l;
    1.60    }
    1.61  
    1.62 -  _node_latency.at_put_grow(n->_idx, latency);
    1.63 +  _node_latency->at_put_grow(n->_idx, latency);
    1.64  }
    1.65  
    1.66  //------------------------------hoist_to_cheaper_block-------------------------
    1.67 @@ -985,9 +985,9 @@
    1.68    const double delta = 1+PROB_UNLIKELY_MAG(4);
    1.69    Block* least       = LCA;
    1.70    double least_freq  = least->_freq;
    1.71 -  uint target        = _node_latency.at_grow(self->_idx);
    1.72 -  uint start_latency = _node_latency.at_grow(LCA->_nodes[0]->_idx);
    1.73 -  uint end_latency   = _node_latency.at_grow(LCA->_nodes[LCA->end_idx()]->_idx);
    1.74 +  uint target        = _node_latency->at_grow(self->_idx);
    1.75 +  uint start_latency = _node_latency->at_grow(LCA->_nodes[0]->_idx);
    1.76 +  uint end_latency   = _node_latency->at_grow(LCA->_nodes[LCA->end_idx()]->_idx);
    1.77    bool in_latency    = (target <= start_latency);
    1.78    const Block* root_block = _bbs[_root->_idx];
    1.79  
    1.80 @@ -1005,7 +1005,7 @@
    1.81  #ifndef PRODUCT
    1.82    if (trace_opto_pipelining()) {
    1.83      tty->print("# Find cheaper block for latency %d: ",
    1.84 -      _node_latency.at_grow(self->_idx));
    1.85 +      _node_latency->at_grow(self->_idx));
    1.86      self->dump();
    1.87      tty->print_cr("#   B%d: start latency for [%4d]=%d, end latency for [%4d]=%d, freq=%g",
    1.88        LCA->_pre_order,
    1.89 @@ -1032,9 +1032,9 @@
    1.90      if (mach && LCA == root_block)
    1.91        break;
    1.92  
    1.93 -    uint start_lat = _node_latency.at_grow(LCA->_nodes[0]->_idx);
    1.94 +    uint start_lat = _node_latency->at_grow(LCA->_nodes[0]->_idx);
    1.95      uint end_idx   = LCA->end_idx();
    1.96 -    uint end_lat   = _node_latency.at_grow(LCA->_nodes[end_idx]->_idx);
    1.97 +    uint end_lat   = _node_latency->at_grow(LCA->_nodes[end_idx]->_idx);
    1.98      double LCA_freq = LCA->_freq;
    1.99  #ifndef PRODUCT
   1.100      if (trace_opto_pipelining()) {
   1.101 @@ -1073,7 +1073,7 @@
   1.102        tty->print_cr("#  Change latency for [%4d] from %d to %d", self->_idx, target, end_latency);
   1.103      }
   1.104  #endif
   1.105 -    _node_latency.at_put_grow(self->_idx, end_latency);
   1.106 +    _node_latency->at_put_grow(self->_idx, end_latency);
   1.107      partial_latency_of_defs(self);
   1.108    }
   1.109  
   1.110 @@ -1255,8 +1255,7 @@
   1.111  
   1.112    // Compute the latency information (via backwards walk) for all the
   1.113    // instructions in the graph
   1.114 -  GrowableArray<uint> node_latency;
   1.115 -  _node_latency = node_latency;
   1.116 +  _node_latency = new GrowableArray<uint>(); // resource_area allocation
   1.117  
   1.118    if( C->do_scheduling() )
   1.119      ComputeLatenciesBackwards(visited, stack);
   1.120 @@ -1341,6 +1340,8 @@
   1.121      }
   1.122    }
   1.123  #endif
   1.124 +  // Dead.
   1.125 +  _node_latency = (GrowableArray<uint> *)0xdeadbeef;
   1.126  }
   1.127  
   1.128  

mercurial