src/share/vm/ci/ciMethod.cpp

changeset 3969
1d7922586cf6
parent 3917
8150fa46d2ed
child 4021
7f813940ac35
     1.1 --- a/src/share/vm/ci/ciMethod.cpp	Mon Jul 23 13:04:59 2012 -0700
     1.2 +++ b/src/share/vm/ci/ciMethod.cpp	Tue Jul 24 10:51:00 2012 -0700
     1.3 @@ -769,39 +769,37 @@
     1.4  // invokedynamic support
     1.5  
     1.6  // ------------------------------------------------------------------
     1.7 -// ciMethod::is_method_handle_invoke
     1.8 +// ciMethod::is_method_handle_intrinsic
     1.9  //
    1.10 -// Return true if the method is an instance of one of the two
    1.11 -// signature-polymorphic MethodHandle methods, invokeExact or invokeGeneric.
    1.12 -bool ciMethod::is_method_handle_invoke() const {
    1.13 -  if (!is_loaded()) {
    1.14 -    bool flag = (holder()->name() == ciSymbol::java_lang_invoke_MethodHandle() &&
    1.15 -                 methodOopDesc::is_method_handle_invoke_name(name()->sid()));
    1.16 -    return flag;
    1.17 -  }
    1.18 -  VM_ENTRY_MARK;
    1.19 -  return get_methodOop()->is_method_handle_invoke();
    1.20 +// Return true if the method is an instance of the JVM-generated
    1.21 +// signature-polymorphic MethodHandle methods, _invokeBasic, _linkToVirtual, etc.
    1.22 +bool ciMethod::is_method_handle_intrinsic() const {
    1.23 +  vmIntrinsics::ID iid = _intrinsic_id;  // do not check if loaded
    1.24 +  return (MethodHandles::is_signature_polymorphic(iid) &&
    1.25 +          MethodHandles::is_signature_polymorphic_intrinsic(iid));
    1.26  }
    1.27  
    1.28  // ------------------------------------------------------------------
    1.29 -// ciMethod::is_method_handle_adapter
    1.30 +// ciMethod::is_compiled_lambda_form
    1.31  //
    1.32  // Return true if the method is a generated MethodHandle adapter.
    1.33 -// These are built by MethodHandleCompiler.
    1.34 -bool ciMethod::is_method_handle_adapter() const {
    1.35 -  if (!is_loaded())  return false;
    1.36 -  VM_ENTRY_MARK;
    1.37 -  return get_methodOop()->is_method_handle_adapter();
    1.38 +// These are built by Java code.
    1.39 +bool ciMethod::is_compiled_lambda_form() const {
    1.40 +  vmIntrinsics::ID iid = _intrinsic_id;  // do not check if loaded
    1.41 +  return iid == vmIntrinsics::_compiledLambdaForm;
    1.42  }
    1.43  
    1.44 -ciInstance* ciMethod::method_handle_type() {
    1.45 -  check_is_loaded();
    1.46 -  VM_ENTRY_MARK;
    1.47 -  oop mtype = get_methodOop()->method_handle_type();
    1.48 -  return CURRENT_THREAD_ENV->get_object(mtype)->as_instance();
    1.49 +// ------------------------------------------------------------------
    1.50 +// ciMethod::has_member_arg
    1.51 +//
    1.52 +// Return true if the method is a linker intrinsic like _linkToVirtual.
    1.53 +// These are built by the JVM.
    1.54 +bool ciMethod::has_member_arg() const {
    1.55 +  vmIntrinsics::ID iid = _intrinsic_id;  // do not check if loaded
    1.56 +  return (MethodHandles::is_signature_polymorphic(iid) &&
    1.57 +          MethodHandles::has_member_arg(iid));
    1.58  }
    1.59  
    1.60 -
    1.61  // ------------------------------------------------------------------
    1.62  // ciMethod::ensure_method_data
    1.63  //
    1.64 @@ -1024,28 +1022,13 @@
    1.65  // ------------------------------------------------------------------
    1.66  // ciMethod::code_size_for_inlining
    1.67  //
    1.68 -// Code size for inlining decisions.
    1.69 -//
    1.70 -// Don't fully count method handle adapters against inlining budgets:
    1.71 -// the metric we use here is the number of call sites in the adapter
    1.72 -// as they are probably the instructions which generate some code.
    1.73 +// Code size for inlining decisions.  This method returns a code
    1.74 +// size of 1 for methods which has the ForceInline annotation.
    1.75  int ciMethod::code_size_for_inlining() {
    1.76    check_is_loaded();
    1.77 -
    1.78 -  // Method handle adapters
    1.79 -  if (is_method_handle_adapter()) {
    1.80 -    // Count call sites
    1.81 -    int call_site_count = 0;
    1.82 -    ciBytecodeStream iter(this);
    1.83 -    while (iter.next() != ciBytecodeStream::EOBC()) {
    1.84 -      if (Bytecodes::is_invoke(iter.cur_bc())) {
    1.85 -        call_site_count++;
    1.86 -      }
    1.87 -    }
    1.88 -    return call_site_count;
    1.89 +  if (get_methodOop()->force_inline()) {
    1.90 +    return 1;
    1.91    }
    1.92 -
    1.93 -  // Normal method
    1.94    return code_size();
    1.95  }
    1.96  
    1.97 @@ -1127,7 +1110,8 @@
    1.98      constantPoolHandle pool (THREAD, get_methodOop()->constants());
    1.99      methodHandle spec_method;
   1.100      KlassHandle  spec_klass;
   1.101 -    LinkResolver::resolve_method(spec_method, spec_klass, pool, refinfo_index, THREAD);
   1.102 +    Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
   1.103 +    LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD);
   1.104      if (HAS_PENDING_EXCEPTION) {
   1.105        CLEAR_PENDING_EXCEPTION;
   1.106        return false;
   1.107 @@ -1207,8 +1191,16 @@
   1.108  //
   1.109  // Print the name of this method, without signature.
   1.110  void ciMethod::print_short_name(outputStream* st) {
   1.111 -  check_is_loaded();
   1.112 -  GUARDED_VM_ENTRY(get_methodOop()->print_short_name(st);)
   1.113 +  if (is_loaded()) {
   1.114 +    GUARDED_VM_ENTRY(get_methodOop()->print_short_name(st););
   1.115 +  } else {
   1.116 +    // Fall back if method is not loaded.
   1.117 +    holder()->print_name_on(st);
   1.118 +    st->print("::");
   1.119 +    name()->print_symbol_on(st);
   1.120 +    if (WizardMode)
   1.121 +      signature()->as_symbol()->print_symbol_on(st);
   1.122 +  }
   1.123  }
   1.124  
   1.125  // ------------------------------------------------------------------
   1.126 @@ -1223,6 +1215,7 @@
   1.127    holder()->print_name_on(st);
   1.128    st->print(" signature=");
   1.129    signature()->as_symbol()->print_symbol_on(st);
   1.130 +  st->print(" arg_size=%d", arg_size());
   1.131    if (is_loaded()) {
   1.132      st->print(" loaded=true flags=");
   1.133      flags().print_member_flags(st);

mercurial