1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Fri Aug 23 18:04:35 2013 -0700 1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Wed Aug 21 13:34:45 2013 +0200 1.3 @@ -1667,9 +1667,8 @@ 1.4 const Bytecodes::Code bc_raw = stream()->cur_bc_raw(); 1.5 assert(declared_signature != NULL, "cannot be null"); 1.6 1.7 - // FIXME bail out for now 1.8 - if (Bytecodes::has_optional_appendix(bc_raw) && !will_link) { 1.9 - BAILOUT("unlinked call site (FIXME needs patching or recompile support)"); 1.10 + if (!C1PatchInvokeDynamic && Bytecodes::has_optional_appendix(bc_raw) && !will_link) { 1.11 + BAILOUT("unlinked call site (C1PatchInvokeDynamic is off)"); 1.12 } 1.13 1.14 // we have to make sure the argument size (incl. the receiver) 1.15 @@ -1713,10 +1712,23 @@ 1.16 code = target->is_static() ? Bytecodes::_invokestatic : Bytecodes::_invokespecial; 1.17 break; 1.18 } 1.19 + } else { 1.20 + if (bc_raw == Bytecodes::_invokehandle) { 1.21 + assert(!will_link, "should come here only for unlinked call"); 1.22 + code = Bytecodes::_invokespecial; 1.23 + } 1.24 } 1.25 1.26 // Push appendix argument (MethodType, CallSite, etc.), if one. 1.27 - if (stream()->has_appendix()) { 1.28 + bool patch_for_appendix = false; 1.29 + int patching_appendix_arg = 0; 1.30 + if (C1PatchInvokeDynamic && 1.31 + (Bytecodes::has_optional_appendix(bc_raw) && (!will_link || PatchALot))) { 1.32 + Value arg = append(new Constant(new ObjectConstant(compilation()->env()->unloaded_ciinstance()), copy_state_before())); 1.33 + apush(arg); 1.34 + patch_for_appendix = true; 1.35 + patching_appendix_arg = (will_link && stream()->has_appendix()) ? 0 : 1; 1.36 + } else if (stream()->has_appendix()) { 1.37 ciObject* appendix = stream()->get_appendix(); 1.38 Value arg = append(new Constant(new ObjectConstant(appendix))); 1.39 apush(arg); 1.40 @@ -1732,7 +1744,8 @@ 1.41 if (UseCHA && DeoptC1 && klass->is_loaded() && target->is_loaded() && 1.42 !(// %%% FIXME: Are both of these relevant? 1.43 target->is_method_handle_intrinsic() || 1.44 - target->is_compiled_lambda_form())) { 1.45 + target->is_compiled_lambda_form()) && 1.46 + !patch_for_appendix) { 1.47 Value receiver = NULL; 1.48 ciInstanceKlass* receiver_klass = NULL; 1.49 bool type_is_exact = false; 1.50 @@ -1850,7 +1863,8 @@ 1.51 // check if we could do inlining 1.52 if (!PatchALot && Inline && klass->is_loaded() && 1.53 (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized()) 1.54 - && target->is_loaded()) { 1.55 + && target->is_loaded() 1.56 + && !patch_for_appendix) { 1.57 // callee is known => check if we have static binding 1.58 assert(target->is_loaded(), "callee must be known"); 1.59 if (code == Bytecodes::_invokestatic || 1.60 @@ -1901,7 +1915,7 @@ 1.61 code == Bytecodes::_invokespecial || 1.62 code == Bytecodes::_invokevirtual || 1.63 code == Bytecodes::_invokeinterface; 1.64 - Values* args = state()->pop_arguments(target->arg_size_no_receiver()); 1.65 + Values* args = state()->pop_arguments(target->arg_size_no_receiver() + patching_appendix_arg); 1.66 Value recv = has_receiver ? apop() : NULL; 1.67 int vtable_index = Method::invalid_vtable_index; 1.68