Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/ci/bcEscapeAnalyzer.cpp
          +++ new/src/share/vm/ci/bcEscapeAnalyzer.cpp
   1    1  /*
   2      - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
        2 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   3    3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4    4   *
   5    5   * This code is free software; you can redistribute it and/or modify it
   6    6   * under the terms of the GNU General Public License version 2 only, as
   7    7   * published by the Free Software Foundation.
   8    8   *
   9    9   * This code is distributed in the hope that it will be useful, but WITHOUT
  10   10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11   11   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12   12   * version 2 for more details (a copy is included in the LICENSE file that
↓ open down ↓ 213 lines elided ↑ open up ↑
 226  226  
 227  227    // some methods are obviously bindable without any type checks so
 228  228    // convert them directly to an invokespecial.
 229  229    if (target->is_loaded() && !target->is_abstract() &&
 230  230        target->can_be_statically_bound() && code == Bytecodes::_invokevirtual) {
 231  231      code = Bytecodes::_invokespecial;
 232  232    }
 233  233  
 234  234    // compute size of arguments
 235  235    int arg_size = target->arg_size();
      236 +  if (code == Bytecodes::_invokedynamic) {
      237 +    assert(!target->is_static(), "receiver explicit in method");
      238 +    arg_size--;  // implicit, not really on stack
      239 +  }
 236  240    if (!target->is_loaded() && code == Bytecodes::_invokestatic) {
 237  241      arg_size--;
 238  242    }
 239  243    int arg_base = MAX2(state._stack_height - arg_size, 0);
 240  244  
 241  245    // direct recursive calls are skipped if they can be bound statically without introducing
 242  246    // dependencies and if parameters are passed at the same position as in the current method
 243  247    // other calls are skipped if there are no unescaped arguments passed to them
 244  248    bool directly_recursive = (method() == target) &&
 245  249                 (code != Bytecodes::_invokevirtual || target->is_final_method() || state._stack[arg_base] .is_empty());
 246  250  
 247  251    // check if analysis of callee can safely be skipped
 248  252    bool skip_callee = true;
 249  253    for (i = state._stack_height - 1; i >= arg_base && skip_callee; i--) {
 250  254      ArgumentMap arg = state._stack[i];
 251  255      skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base));
 252  256    }
      257 +  // For now we conservatively skip invokedynamic.
      258 +  if (code == Bytecodes::_invokedynamic) {
      259 +    skip_callee = true;
      260 +  }
 253  261    if (skip_callee) {
 254  262      TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8()));
 255  263      for (i = 0; i < arg_size; i++) {
 256  264        set_method_escape(state.raw_pop());
 257  265      }
 258  266      _unknown_modified = true;  // assume the worst since we don't analyze the called method
 259  267      return;
 260  268    }
 261  269  
 262  270    // determine actual method (use CHA if necessary)
↓ open down ↓ 1175 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX