src/share/vm/ci/bcEscapeAnalyzer.cpp

changeset 513
e1e86702e43e
parent 480
48a3fa21394b
child 589
09c2ba680204
     1.1 --- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu Mar 27 09:12:54 2008 -0700
     1.2 +++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Fri Mar 28 11:52:29 2008 -0700
     1.3 @@ -1247,8 +1247,14 @@
     1.4  
     1.5    initialize();
     1.6  
     1.7 -  // do not scan method if it has no object parameters
     1.8 -  if (_arg_local.is_empty()) {
     1.9 +  // Do not scan method if it has no object parameters and
    1.10 +  // does not returns an object (_return_allocated is set in initialize()).
    1.11 +  if (_arg_local.is_empty() && !_return_allocated) {
    1.12 +    // Clear all info since method's bytecode was not analysed and
    1.13 +    // set pessimistic escape information.
    1.14 +    clear_escape_info();
    1.15 +    methodData()->set_eflag(methodDataOopDesc::allocated_escapes);
    1.16 +    methodData()->set_eflag(methodDataOopDesc::unknown_modified);
    1.17      methodData()->set_eflag(methodDataOopDesc::estimated);
    1.18      return;
    1.19    }
    1.20 @@ -1259,45 +1265,8 @@
    1.21      success = do_analysis();
    1.22    }
    1.23  
    1.24 -  // dump result of bytecode analysis
    1.25 -#ifndef PRODUCT
    1.26 -  if (BCEATraceLevel >= 3) {
    1.27 -    tty->print("[EA] estimated escape information for");
    1.28 -    if (iid != vmIntrinsics::_none)
    1.29 -      tty->print(" intrinsic");
    1.30 -    method()->print_short_name();
    1.31 -    tty->print_cr(has_dependencies() ? " (not stored)" : "");
    1.32 -    tty->print("     non-escaping args:      ");
    1.33 -    _arg_local.print_on(tty);
    1.34 -    tty->print("     stack-allocatable args: ");
    1.35 -    _arg_stack.print_on(tty);
    1.36 -    if (_return_local) {
    1.37 -      tty->print("     returned args:          ");
    1.38 -      _arg_returned.print_on(tty);
    1.39 -    } else if (is_return_allocated()) {
    1.40 -      tty->print_cr("     allocated return values");
    1.41 -    } else {
    1.42 -      tty->print_cr("     non-local return values");
    1.43 -    }
    1.44 -    tty->print("     modified args: ");
    1.45 -    for (int i = 0; i < _arg_size; i++) {
    1.46 -      if (_arg_modified[i] == 0)
    1.47 -        tty->print("    0");
    1.48 -      else
    1.49 -        tty->print("    0x%x", _arg_modified[i]);
    1.50 -    }
    1.51 -    tty->cr();
    1.52 -    tty->print("     flags: ");
    1.53 -    if (_unknown_modified)
    1.54 -      tty->print(" unknown_modified");
    1.55 -    if (_return_allocated)
    1.56 -      tty->print(" return_allocated");
    1.57 -    tty->cr();
    1.58 -  }
    1.59 -
    1.60 -#endif
    1.61 -  // don't store interprocedural escape information if it introduces dependencies
    1.62 -  // or if method data is empty
    1.63 +  // don't store interprocedural escape information if it introduces
    1.64 +  // dependencies or if method data is empty
    1.65    //
    1.66    if (!has_dependencies() && !methodData()->is_empty()) {
    1.67      for (i = 0; i < _arg_size; i++) {
    1.68 @@ -1316,6 +1285,15 @@
    1.69      if (_return_local) {
    1.70        methodData()->set_eflag(methodDataOopDesc::return_local);
    1.71      }
    1.72 +    if (_return_allocated) {
    1.73 +      methodData()->set_eflag(methodDataOopDesc::return_allocated);
    1.74 +    }
    1.75 +    if (_allocated_escapes) {
    1.76 +      methodData()->set_eflag(methodDataOopDesc::allocated_escapes);
    1.77 +    }
    1.78 +    if (_unknown_modified) {
    1.79 +      methodData()->set_eflag(methodDataOopDesc::unknown_modified);
    1.80 +    }
    1.81      methodData()->set_eflag(methodDataOopDesc::estimated);
    1.82    }
    1.83  }
    1.84 @@ -1331,33 +1309,47 @@
    1.85      _arg_modified[i] = methodData()->arg_modified(i);
    1.86    }
    1.87    _return_local = methodData()->eflag_set(methodDataOopDesc::return_local);
    1.88 -
    1.89 -  // dump result of loaded escape information
    1.90 -#ifndef PRODUCT
    1.91 -  if (BCEATraceLevel >= 4) {
    1.92 -    tty->print("     non-escaping args:      ");
    1.93 -    _arg_local.print_on(tty);
    1.94 -    tty->print("     stack-allocatable args: ");
    1.95 -    _arg_stack.print_on(tty);
    1.96 -    if (_return_local) {
    1.97 -      tty->print("     returned args:          ");
    1.98 -      _arg_returned.print_on(tty);
    1.99 -    } else {
   1.100 -      tty->print_cr("     non-local return values");
   1.101 -    }
   1.102 -    tty->print("     modified args: ");
   1.103 -    for (int i = 0; i < _arg_size; i++) {
   1.104 -      if (_arg_modified[i] == 0)
   1.105 -        tty->print("    0");
   1.106 -      else
   1.107 -        tty->print("    0x%x", _arg_modified[i]);
   1.108 -    }
   1.109 -    tty->cr();
   1.110 -  }
   1.111 -#endif
   1.112 +  _return_allocated = methodData()->eflag_set(methodDataOopDesc::return_allocated);
   1.113 +  _allocated_escapes = methodData()->eflag_set(methodDataOopDesc::allocated_escapes);
   1.114 +  _unknown_modified = methodData()->eflag_set(methodDataOopDesc::unknown_modified);
   1.115  
   1.116  }
   1.117  
   1.118 +#ifndef PRODUCT
   1.119 +void BCEscapeAnalyzer::dump() {
   1.120 +  tty->print("[EA] estimated escape information for");
   1.121 +  method()->print_short_name();
   1.122 +  tty->print_cr(has_dependencies() ? " (not stored)" : "");
   1.123 +  tty->print("     non-escaping args:      ");
   1.124 +  _arg_local.print_on(tty);
   1.125 +  tty->print("     stack-allocatable args: ");
   1.126 +  _arg_stack.print_on(tty);
   1.127 +  if (_return_local) {
   1.128 +    tty->print("     returned args:          ");
   1.129 +    _arg_returned.print_on(tty);
   1.130 +  } else if (is_return_allocated()) {
   1.131 +    tty->print_cr("     return allocated value");
   1.132 +  } else {
   1.133 +    tty->print_cr("     return non-local value");
   1.134 +  }
   1.135 +  tty->print("     modified args: ");
   1.136 +  for (int i = 0; i < _arg_size; i++) {
   1.137 +    if (_arg_modified[i] == 0)
   1.138 +      tty->print("    0");
   1.139 +    else
   1.140 +      tty->print("    0x%x", _arg_modified[i]);
   1.141 +  }
   1.142 +  tty->cr();
   1.143 +  tty->print("     flags: ");
   1.144 +  if (_return_allocated)
   1.145 +    tty->print(" return_allocated");
   1.146 +  if (_allocated_escapes)
   1.147 +    tty->print(" allocated_escapes");
   1.148 +  if (_unknown_modified)
   1.149 +    tty->print(" unknown_modified");
   1.150 +  tty->cr();
   1.151 +}
   1.152 +#endif
   1.153  
   1.154  BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent)
   1.155      : _conservative(method == NULL || !EstimateArgEscape)
   1.156 @@ -1401,6 +1393,12 @@
   1.157        compute_escape_info();
   1.158        methodData()->update_escape_info();
   1.159      }
   1.160 +#ifndef PRODUCT
   1.161 +    if (BCEATraceLevel >= 3) {
   1.162 +      // dump escape information
   1.163 +      dump();
   1.164 +    }
   1.165 +#endif
   1.166    }
   1.167  }
   1.168  

mercurial