1.1 --- a/src/share/vm/opto/callGenerator.cpp Wed Nov 16 19:42:58 2011 -0800 1.2 +++ b/src/share/vm/opto/callGenerator.cpp Thu Nov 17 04:07:30 2011 -0800 1.3 @@ -318,17 +318,17 @@ 1.4 return new DirectCallGenerator(m, separate_io_proj); 1.5 } 1.6 1.7 -CallGenerator* CallGenerator::for_dynamic_call(ciMethod* m) { 1.8 - assert(m->is_method_handle_invoke() || m->is_method_handle_adapter(), "for_dynamic_call mismatch"); 1.9 - return new DynamicCallGenerator(m); 1.10 -} 1.11 - 1.12 CallGenerator* CallGenerator::for_virtual_call(ciMethod* m, int vtable_index) { 1.13 assert(!m->is_static(), "for_virtual_call mismatch"); 1.14 assert(!m->is_method_handle_invoke(), "should be a direct call"); 1.15 return new VirtualCallGenerator(m, vtable_index); 1.16 } 1.17 1.18 +CallGenerator* CallGenerator::for_dynamic_call(ciMethod* m) { 1.19 + assert(m->is_method_handle_invoke() || m->is_method_handle_adapter(), "for_dynamic_call mismatch"); 1.20 + return new DynamicCallGenerator(m); 1.21 +} 1.22 + 1.23 // Allow inlining decisions to be delayed 1.24 class LateInlineCallGenerator : public DirectCallGenerator { 1.25 CallGenerator* _inline_cg; 1.26 @@ -576,7 +576,9 @@ 1.27 kit.set_control(slow_ctl); 1.28 if (!kit.stopped()) { 1.29 slow_jvms = _if_missed->generate(kit.sync_jvms()); 1.30 - assert(slow_jvms != NULL, "miss path must not fail to generate"); 1.31 + if (kit.failing()) 1.32 + return NULL; // might happen because of NodeCountInliningCutoff 1.33 + assert(slow_jvms != NULL, "must be"); 1.34 kit.add_exception_states_from(slow_jvms); 1.35 kit.set_map(slow_jvms->map()); 1.36 if (!kit.stopped()) 1.37 @@ -682,6 +684,15 @@ 1.38 } 1.39 1.40 1.41 +CallGenerator* CallGenerator::for_method_handle_call(Node* method_handle, JVMState* jvms, 1.42 + ciMethod* caller, ciMethod* callee, ciCallProfile profile) { 1.43 + assert(callee->is_method_handle_invoke() || callee->is_method_handle_adapter(), "for_method_handle_call mismatch"); 1.44 + CallGenerator* cg = CallGenerator::for_method_handle_inline(method_handle, jvms, caller, callee, profile); 1.45 + if (cg != NULL) 1.46 + return cg; 1.47 + return CallGenerator::for_direct_call(callee); 1.48 +} 1.49 + 1.50 CallGenerator* CallGenerator::for_method_handle_inline(Node* method_handle, JVMState* jvms, 1.51 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { 1.52 if (method_handle->Opcode() == Op_ConP) { 1.53 @@ -721,8 +732,8 @@ 1.54 // Generate a guard so that each can be inlined. We might want to 1.55 // do more inputs at later point but this gets the most common 1.56 // case. 1.57 - CallGenerator* cg1 = for_method_handle_inline(method_handle->in(1), jvms, caller, callee, profile.rescale(1.0 - prob)); 1.58 - CallGenerator* cg2 = for_method_handle_inline(method_handle->in(2), jvms, caller, callee, profile.rescale(prob)); 1.59 + CallGenerator* cg1 = for_method_handle_call(method_handle->in(1), jvms, caller, callee, profile.rescale(1.0 - prob)); 1.60 + CallGenerator* cg2 = for_method_handle_call(method_handle->in(2), jvms, caller, callee, profile.rescale(prob)); 1.61 if (cg1 != NULL && cg2 != NULL) { 1.62 const TypeOopPtr* oop_ptr = method_handle->in(1)->bottom_type()->is_oopptr(); 1.63 ciObject* const_oop = oop_ptr->const_oop(); 1.64 @@ -733,6 +744,17 @@ 1.65 return NULL; 1.66 } 1.67 1.68 +CallGenerator* CallGenerator::for_invokedynamic_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, ciCallProfile profile) { 1.69 + assert(callee->is_method_handle_invoke() || callee->is_method_handle_adapter(), "for_invokedynamic_call mismatch"); 1.70 + // Get the CallSite object. 1.71 + ciBytecodeStream str(caller); 1.72 + str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci. 1.73 + ciCallSite* call_site = str.get_call_site(); 1.74 + CallGenerator* cg = CallGenerator::for_invokedynamic_inline(call_site, jvms, caller, callee, profile); 1.75 + if (cg != NULL) 1.76 + return cg; 1.77 + return CallGenerator::for_dynamic_call(callee); 1.78 +} 1.79 1.80 CallGenerator* CallGenerator::for_invokedynamic_inline(ciCallSite* call_site, JVMState* jvms, 1.81 ciMethod* caller, ciMethod* callee, ciCallProfile profile) { 1.82 @@ -819,7 +841,9 @@ 1.83 kit.set_control(slow_ctl); 1.84 if (!kit.stopped()) { 1.85 slow_jvms = _if_missed->generate(kit.sync_jvms()); 1.86 - assert(slow_jvms != NULL, "miss path must not fail to generate"); 1.87 + if (kit.failing()) 1.88 + return NULL; // might happen because of NodeCountInliningCutoff 1.89 + assert(slow_jvms != NULL, "must be"); 1.90 kit.add_exception_states_from(slow_jvms); 1.91 kit.set_map(slow_jvms->map()); 1.92 if (!kit.stopped())