1.1 --- a/src/share/vm/opto/callGenerator.cpp Mon May 06 19:49:23 2013 -0700 1.2 +++ b/src/share/vm/opto/callGenerator.cpp Wed May 08 15:08:01 2013 -0700 1.3 @@ -134,7 +134,7 @@ 1.4 kit.C->log()->elem("direct_call bci='%d'", jvms->bci()); 1.5 } 1.6 1.7 - CallStaticJavaNode *call = new (kit.C) CallStaticJavaNode(tf(), target, method(), kit.bci()); 1.8 + CallStaticJavaNode *call = new (kit.C) CallStaticJavaNode(kit.C, tf(), target, method(), kit.bci()); 1.9 _call_node = call; // Save the call node in case we need it later 1.10 if (!is_static) { 1.11 // Make an explicit receiver null_check as part of this call. 1.12 @@ -304,29 +304,34 @@ 1.13 1.14 void LateInlineCallGenerator::do_late_inline() { 1.15 // Can't inline it 1.16 - if (call_node() == NULL || call_node()->outcnt() == 0 || 1.17 - call_node()->in(0) == NULL || call_node()->in(0)->is_top()) { 1.18 + CallStaticJavaNode* call = call_node(); 1.19 + if (call == NULL || call->outcnt() == 0 || 1.20 + call->in(0) == NULL || call->in(0)->is_top()) { 1.21 return; 1.22 } 1.23 1.24 - const TypeTuple *r = call_node()->tf()->domain(); 1.25 + const TypeTuple *r = call->tf()->domain(); 1.26 for (int i1 = 0; i1 < method()->arg_size(); i1++) { 1.27 - if (call_node()->in(TypeFunc::Parms + i1)->is_top() && r->field_at(TypeFunc::Parms + i1) != Type::HALF) { 1.28 + if (call->in(TypeFunc::Parms + i1)->is_top() && r->field_at(TypeFunc::Parms + i1) != Type::HALF) { 1.29 assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing"); 1.30 return; 1.31 } 1.32 } 1.33 1.34 - if (call_node()->in(TypeFunc::Memory)->is_top()) { 1.35 + if (call->in(TypeFunc::Memory)->is_top()) { 1.36 assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing"); 1.37 return; 1.38 } 1.39 1.40 - CallStaticJavaNode* call = call_node(); 1.41 + Compile* C = Compile::current(); 1.42 + // Remove inlined methods from Compiler's lists. 1.43 + if (call->is_macro()) { 1.44 + C->remove_macro_node(call); 1.45 + } 1.46 1.47 // Make a clone of the JVMState that appropriate to use for driving a parse 1.48 - Compile* C = Compile::current(); 1.49 - JVMState* jvms = call->jvms()->clone_shallow(C); 1.50 + JVMState* old_jvms = call->jvms(); 1.51 + JVMState* jvms = old_jvms->clone_shallow(C); 1.52 uint size = call->req(); 1.53 SafePointNode* map = new (C) SafePointNode(size, jvms); 1.54 for (uint i1 = 0; i1 < size; i1++) { 1.55 @@ -340,16 +345,23 @@ 1.56 map->set_req(TypeFunc::Memory, mem); 1.57 } 1.58 1.59 - // Make enough space for the expression stack and transfer the incoming arguments 1.60 - int nargs = method()->arg_size(); 1.61 + uint nargs = method()->arg_size(); 1.62 + // blow away old call arguments 1.63 + Node* top = C->top(); 1.64 + for (uint i1 = 0; i1 < nargs; i1++) { 1.65 + map->set_req(TypeFunc::Parms + i1, top); 1.66 + } 1.67 jvms->set_map(map); 1.68 + 1.69 + // Make enough space in the expression stack to transfer 1.70 + // the incoming arguments and return value. 1.71 map->ensure_stack(jvms, jvms->method()->max_stack()); 1.72 - if (nargs > 0) { 1.73 - for (int i1 = 0; i1 < nargs; i1++) { 1.74 - map->set_req(i1 + jvms->argoff(), call->in(TypeFunc::Parms + i1)); 1.75 - } 1.76 + for (uint i1 = 0; i1 < nargs; i1++) { 1.77 + map->set_argument(jvms, i1, call->in(TypeFunc::Parms + i1)); 1.78 } 1.79 1.80 + // This check is done here because for_method_handle_inline() method 1.81 + // needs jvms for inlined state. 1.82 if (!do_late_inline_check(jvms)) { 1.83 map->disconnect_inputs(NULL, C); 1.84 return; 1.85 @@ -480,6 +492,26 @@ 1.86 return new LateInlineStringCallGenerator(method, inline_cg); 1.87 } 1.88 1.89 +class LateInlineBoxingCallGenerator : public LateInlineCallGenerator { 1.90 + 1.91 + public: 1.92 + LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) : 1.93 + LateInlineCallGenerator(method, inline_cg) {} 1.94 + 1.95 + virtual JVMState* generate(JVMState* jvms) { 1.96 + Compile *C = Compile::current(); 1.97 + C->print_inlining_skip(this); 1.98 + 1.99 + C->add_boxing_late_inline(this); 1.100 + 1.101 + JVMState* new_jvms = DirectCallGenerator::generate(jvms); 1.102 + return new_jvms; 1.103 + } 1.104 +}; 1.105 + 1.106 +CallGenerator* CallGenerator::for_boxing_late_inline(ciMethod* method, CallGenerator* inline_cg) { 1.107 + return new LateInlineBoxingCallGenerator(method, inline_cg); 1.108 +} 1.109 1.110 //---------------------------WarmCallGenerator-------------------------------- 1.111 // Internal class which handles initial deferral of inlining decisions.