src/share/vm/ci/bcEscapeAnalyzer.cpp

changeset 2003
8099e71601df
parent 1907
c18cbe5936b8
child 2102
53dbe853fb3a
     1.1 --- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Jul 14 14:29:14 2010 -0700
     1.2 +++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Jul 14 14:47:34 2010 -0700
     1.3 @@ -106,7 +106,7 @@
     1.4  void BCEscapeAnalyzer::set_returned(ArgumentMap vars) {
     1.5    for (int i = 0; i < _arg_size; i++) {
     1.6      if (vars.contains(i))
     1.7 -      _arg_returned.set_bit(i);
     1.8 +      _arg_returned.set(i);
     1.9    }
    1.10    _return_local = _return_local && !(vars.contains_unknown() || vars.contains_allocated());
    1.11    _return_allocated = _return_allocated && vars.contains_allocated() && !(vars.contains_unknown() || vars.contains_vars());
    1.12 @@ -126,16 +126,16 @@
    1.13    if (_conservative)
    1.14      return true;
    1.15    for (int i = 0; i < _arg_size; i++) {
    1.16 -    if (vars.contains(i) && _arg_stack.at(i))
    1.17 +    if (vars.contains(i) && _arg_stack.test(i))
    1.18        return true;
    1.19    }
    1.20    return false;
    1.21  }
    1.22  
    1.23 -void BCEscapeAnalyzer::clear_bits(ArgumentMap vars, BitMap &bm) {
    1.24 +void BCEscapeAnalyzer::clear_bits(ArgumentMap vars, VectorSet &bm) {
    1.25    for (int i = 0; i < _arg_size; i++) {
    1.26      if (vars.contains(i)) {
    1.27 -      bm.clear_bit(i);
    1.28 +      bm >>= i;
    1.29      }
    1.30    }
    1.31  }
    1.32 @@ -1157,15 +1157,15 @@
    1.33    ciSignature* sig = method()->signature();
    1.34    int j = 0;
    1.35    if (!method()->is_static()) {
    1.36 -    _arg_local.set_bit(0);
    1.37 -    _arg_stack.set_bit(0);
    1.38 +    _arg_local.set(0);
    1.39 +    _arg_stack.set(0);
    1.40      j++;
    1.41    }
    1.42    for (i = 0; i < sig->count(); i++) {
    1.43      ciType* t = sig->type_at(i);
    1.44      if (!t->is_primitive_type()) {
    1.45 -      _arg_local.set_bit(j);
    1.46 -      _arg_stack.set_bit(j);
    1.47 +      _arg_local.set(j);
    1.48 +      _arg_stack.set(j);
    1.49      }
    1.50      j += t->size();
    1.51    }
    1.52 @@ -1198,9 +1198,9 @@
    1.53      set_modified(var, OFFSET_ANY, 4);
    1.54      set_global_escape(var);
    1.55    }
    1.56 -  _arg_local.clear();
    1.57 -  _arg_stack.clear();
    1.58 -  _arg_returned.clear();
    1.59 +  _arg_local.Clear();
    1.60 +  _arg_stack.Clear();
    1.61 +  _arg_returned.Clear();
    1.62    _return_local = false;
    1.63    _return_allocated = false;
    1.64    _allocated_escapes = true;
    1.65 @@ -1254,7 +1254,7 @@
    1.66  
    1.67    // Do not scan method if it has no object parameters and
    1.68    // does not returns an object (_return_allocated is set in initialize()).
    1.69 -  if (_arg_local.is_empty() && !_return_allocated) {
    1.70 +  if (_arg_local.Size() == 0 && !_return_allocated) {
    1.71      // Clear all info since method's bytecode was not analysed and
    1.72      // set pessimistic escape information.
    1.73      clear_escape_info();
    1.74 @@ -1275,14 +1275,14 @@
    1.75    //
    1.76    if (!has_dependencies() && !methodData()->is_empty()) {
    1.77      for (i = 0; i < _arg_size; i++) {
    1.78 -      if (_arg_local.at(i)) {
    1.79 -        assert(_arg_stack.at(i), "inconsistent escape info");
    1.80 +      if (_arg_local.test(i)) {
    1.81 +        assert(_arg_stack.test(i), "inconsistent escape info");
    1.82          methodData()->set_arg_local(i);
    1.83          methodData()->set_arg_stack(i);
    1.84 -      } else if (_arg_stack.at(i)) {
    1.85 +      } else if (_arg_stack.test(i)) {
    1.86          methodData()->set_arg_stack(i);
    1.87        }
    1.88 -      if (_arg_returned.at(i)) {
    1.89 +      if (_arg_returned.test(i)) {
    1.90          methodData()->set_arg_returned(i);
    1.91        }
    1.92        methodData()->set_arg_modified(i, _arg_modified[i]);
    1.93 @@ -1308,9 +1308,12 @@
    1.94  
    1.95    // read escape information from method descriptor
    1.96    for (int i = 0; i < _arg_size; i++) {
    1.97 -    _arg_local.at_put(i, methodData()->is_arg_local(i));
    1.98 -    _arg_stack.at_put(i, methodData()->is_arg_stack(i));
    1.99 -    _arg_returned.at_put(i, methodData()->is_arg_returned(i));
   1.100 +    if (methodData()->is_arg_local(i))
   1.101 +      _arg_local.set(i);
   1.102 +    if (methodData()->is_arg_stack(i))
   1.103 +      _arg_stack.set(i);
   1.104 +    if (methodData()->is_arg_returned(i))
   1.105 +      _arg_returned.set(i);
   1.106      _arg_modified[i] = methodData()->arg_modified(i);
   1.107    }
   1.108    _return_local = methodData()->eflag_set(methodDataOopDesc::return_local);
   1.109 @@ -1358,26 +1361,26 @@
   1.110  
   1.111  BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent)
   1.112      : _conservative(method == NULL || !EstimateArgEscape)
   1.113 +    , _arena(CURRENT_ENV->arena())
   1.114      , _method(method)
   1.115      , _methodData(method ? method->method_data() : NULL)
   1.116      , _arg_size(method ? method->arg_size() : 0)
   1.117 -    , _stack()
   1.118 -    , _arg_local(_arg_size)
   1.119 -    , _arg_stack(_arg_size)
   1.120 -    , _arg_returned(_arg_size)
   1.121 -    , _dirty(_arg_size)
   1.122 +    , _arg_local(_arena)
   1.123 +    , _arg_stack(_arena)
   1.124 +    , _arg_returned(_arena)
   1.125 +    , _dirty(_arena)
   1.126      , _return_local(false)
   1.127      , _return_allocated(false)
   1.128      , _allocated_escapes(false)
   1.129      , _unknown_modified(false)
   1.130 -    , _dependencies()
   1.131 +    , _dependencies(_arena, 4, 0, NULL)
   1.132      , _parent(parent)
   1.133      , _level(parent == NULL ? 0 : parent->level() + 1) {
   1.134    if (!_conservative) {
   1.135 -    _arg_local.clear();
   1.136 -    _arg_stack.clear();
   1.137 -    _arg_returned.clear();
   1.138 -    _dirty.clear();
   1.139 +    _arg_local.Clear();
   1.140 +    _arg_stack.Clear();
   1.141 +    _arg_returned.Clear();
   1.142 +    _dirty.Clear();
   1.143      Arena* arena = CURRENT_ENV->arena();
   1.144      _arg_modified = (uint *) arena->Amalloc(_arg_size * sizeof(uint));
   1.145      Copy::zero_to_bytes(_arg_modified, _arg_size * sizeof(uint));
   1.146 @@ -1414,8 +1417,8 @@
   1.147      deps->assert_evol_method(method());
   1.148    }
   1.149    for (int i = 0; i < _dependencies.length(); i+=2) {
   1.150 -    ciKlass *k = _dependencies[i]->as_klass();
   1.151 -    ciMethod *m = _dependencies[i+1]->as_method();
   1.152 +    ciKlass *k = _dependencies.at(i)->as_klass();
   1.153 +    ciMethod *m = _dependencies.at(i+1)->as_method();
   1.154      deps->assert_unique_concrete_method(k, m);
   1.155    }
   1.156  }

mercurial