Example #1
0
CallGenerator* CallGenerator::for_invokedynamic_inline(ciCallSite* call_site, JVMState* jvms,
                                                       ciMethod* caller, ciMethod* callee, ciCallProfile profile) {
  ciMethodHandle* method_handle = call_site->get_target();

  // Set the callee to have access to the class and signature in the
  // MethodHandleCompiler.
  method_handle->set_callee(callee);
  method_handle->set_caller(caller);
  method_handle->set_call_profile(profile);

  // Get an adapter for the MethodHandle.
  ciMethod* target_method = method_handle->get_invokedynamic_adapter();
  if (target_method != NULL) {
    Compile *C = Compile::current();
    CallGenerator* cg = C->call_generator(target_method, -1, false, jvms, true, PROB_ALWAYS);
    if (cg != NULL && cg->is_inline()) {
      // Add a dependence for invalidation of the optimization.
      if (!call_site->is_constant_call_site()) {
        C->dependencies()->assert_call_site_target_value(call_site, method_handle);
      }
      return cg;
    }
  }
  return NULL;
}