src/share/vm/opto/doCall.cpp

changeset 3050
fdb992d83a87
parent 2981
aabf25fa3f05
child 3101
aa67216400d3
     1.1 --- a/src/share/vm/opto/doCall.cpp	Thu Aug 11 12:08:11 2011 -0700
     1.2 +++ b/src/share/vm/opto/doCall.cpp	Tue Aug 16 04:14:05 2011 -0700
     1.3 @@ -114,7 +114,7 @@
     1.4      if (cg != NULL)  return cg;
     1.5    }
     1.6  
     1.7 -  // Do MethodHandle calls.
     1.8 +  // Do method handle calls.
     1.9    // NOTE: This must happen before normal inlining logic below since
    1.10    // MethodHandle.invoke* are native methods which obviously don't
    1.11    // have bytecodes and so normal inlining fails.
    1.12 @@ -127,33 +127,25 @@
    1.13        if (cg != NULL) {
    1.14          return cg;
    1.15        }
    1.16 -
    1.17        return CallGenerator::for_direct_call(call_method);
    1.18      }
    1.19      else {
    1.20 -      // Get the MethodHandle from the CallSite.
    1.21 +      // Get the CallSite object.
    1.22        ciMethod* caller_method = jvms->method();
    1.23        ciBytecodeStream str(caller_method);
    1.24        str.force_bci(jvms->bci());  // Set the stream to the invokedynamic bci.
    1.25 -      ciCallSite*     call_site     = str.get_call_site();
    1.26 -      ciMethodHandle* method_handle = call_site->get_target();
    1.27 +      ciCallSite* call_site = str.get_call_site();
    1.28  
    1.29 -      // Set the callee to have access to the class and signature in
    1.30 -      // the MethodHandleCompiler.
    1.31 -      method_handle->set_callee(call_method);
    1.32 -      method_handle->set_caller(caller);
    1.33 -      method_handle->set_call_profile(profile);
    1.34 -
    1.35 -      // Get an adapter for the MethodHandle.
    1.36 -      ciMethod* target_method = method_handle->get_invokedynamic_adapter();
    1.37 -      if (target_method != NULL) {
    1.38 -        CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
    1.39 -        if (hit_cg != NULL && hit_cg->is_inline()) {
    1.40 -          CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method);
    1.41 -          return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor);
    1.42 +      // Inline constant and mutable call sites.  We don't inline
    1.43 +      // volatile call sites optimistically since they are specified
    1.44 +      // to change their value often and that would result in a lot of
    1.45 +      // deoptimizations and recompiles.
    1.46 +      if (call_site->is_constant_call_site() || call_site->is_mutable_call_site()) {
    1.47 +        CallGenerator* cg = CallGenerator::for_invokedynamic_inline(call_site, jvms, caller, call_method, profile);
    1.48 +        if (cg != NULL) {
    1.49 +          return cg;
    1.50          }
    1.51        }
    1.52 -
    1.53        // If something failed, generate a normal dynamic call.
    1.54        return CallGenerator::for_dynamic_call(call_method);
    1.55      }

mercurial