12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "ci/bcEscapeAnalyzer.hpp"
26 #include "ci/ciCallSite.hpp"
27 #include "ci/ciMemberName.hpp"
28 #include "ci/ciMethodHandle.hpp"
29 #include "ci/ciObjArray.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "compiler/compileLog.hpp"
32 #include "opto/addnode.hpp"
33 #include "opto/callGenerator.hpp"
34 #include "opto/callnode.hpp"
35 #include "opto/castnode.hpp"
36 #include "opto/cfgnode.hpp"
37 #include "opto/parse.hpp"
38 #include "opto/rootnode.hpp"
39 #include "opto/runtime.hpp"
40 #include "opto/subnode.hpp"
41 #include "runtime/os.inline.hpp"
42 #include "runtime/sharedRuntime.hpp"
43 #include "utilities/debug.hpp"
44
45 // Utility function.
46 const TypeFunc* CallGenerator::tf() const {
47 return TypeFunc::make(method());
48 }
49
50 bool CallGenerator::is_inlined_method_handle_intrinsic(JVMState* jvms, ciMethod* m) {
51 return is_inlined_method_handle_intrinsic(jvms->method(), jvms->bci(), m);
52 }
53
54 bool CallGenerator::is_inlined_method_handle_intrinsic(ciMethod* caller, int bci, ciMethod* m) {
55 ciMethod* symbolic_info = caller->get_method_at_bci(bci);
56 return is_inlined_method_handle_intrinsic(symbolic_info, m);
57 }
58
59 bool CallGenerator::is_inlined_method_handle_intrinsic(ciMethod* symbolic_info, ciMethod* m) {
60 return symbolic_info->is_method_handle_intrinsic() && !m->is_method_handle_intrinsic();
61 }
62
63 //-----------------------------ParseGenerator---------------------------------
64 // Internal class which handles all direct bytecode traversal.
65 class ParseGenerator : public InlineCallGenerator {
66 private:
67 bool _is_osr;
68 float _expected_uses;
69
70 public:
71 ParseGenerator(ciMethod* method, float expected_uses, bool is_osr = false)
72 : InlineCallGenerator(method)
73 {
74 _is_osr = is_osr;
75 _expected_uses = expected_uses;
76 assert(InlineTree::check_can_parse(method) == nullptr, "parse must be possible");
77 }
78
79 virtual bool is_parse() const { return true; }
80 virtual JVMState* generate(JVMState* jvms);
81 bool is_osr() const { return _is_osr; }
82
101 GraphKit& exits = parser.exits();
102
103 if (C->failing()) {
104 while (exits.pop_exception_state() != nullptr) ;
105 return nullptr;
106 }
107
108 assert(exits.jvms()->same_calls_as(jvms), "sanity");
109
110 // Simply return the exit state of the parser,
111 // augmented by any exceptional states.
112 return exits.transfer_exceptions_into_jvms();
113 }
114
115 //---------------------------DirectCallGenerator------------------------------
116 // Internal class which handles all out-of-line calls w/o receiver type checks.
117 class DirectCallGenerator : public CallGenerator {
118 private:
119 CallStaticJavaNode* _call_node;
120 // Force separate memory and I/O projections for the exceptional
121 // paths to facilitate late inlinig.
122 bool _separate_io_proj;
123
124 protected:
125 void set_call_node(CallStaticJavaNode* call) { _call_node = call; }
126
127 public:
128 DirectCallGenerator(ciMethod* method, bool separate_io_proj)
129 : CallGenerator(method),
130 _separate_io_proj(separate_io_proj)
131 {
132 }
133 virtual JVMState* generate(JVMState* jvms);
134
135 virtual CallNode* call_node() const { return _call_node; }
136 virtual CallGenerator* with_call_node(CallNode* call) {
137 DirectCallGenerator* dcg = new DirectCallGenerator(method(), _separate_io_proj);
138 dcg->set_call_node(call->as_CallStaticJava());
139 return dcg;
140 }
141 };
142
143 JVMState* DirectCallGenerator::generate(JVMState* jvms) {
144 GraphKit kit(jvms);
145 bool is_static = method()->is_static();
146 address target = is_static ? SharedRuntime::get_resolve_static_call_stub()
147 : SharedRuntime::get_resolve_opt_virtual_call_stub();
148
149 if (kit.C->log() != nullptr) {
150 kit.C->log()->elem("direct_call bci='%d'", jvms->bci());
151 }
156 // additional information about the method being invoked should be attached
157 // to the call site to make resolution logic work
158 // (see SharedRuntime::resolve_static_call_C).
159 call->set_override_symbolic_info(true);
160 }
161 _call_node = call; // Save the call node in case we need it later
162 if (!is_static) {
163 // Make an explicit receiver null_check as part of this call.
164 // Since we share a map with the caller, his JVMS gets adjusted.
165 kit.null_check_receiver_before_call(method());
166 if (kit.stopped()) {
167 // And dump it back to the caller, decorated with any exceptions:
168 return kit.transfer_exceptions_into_jvms();
169 }
170 // Mark the call node as virtual, sort of:
171 call->set_optimized_virtual(true);
172 }
173 kit.set_arguments_for_java_call(call);
174 kit.set_edges_for_java_call(call, false, _separate_io_proj);
175 Node* ret = kit.set_results_for_java_call(call, _separate_io_proj);
176 if (is_late_inline() && !call->is_boxing_method() && ret->is_Proj()) {
177 // If late inlining for this call happens in a dead part of the graph it can leave a dead loop behind
178 ret->mark_not_dead_loop_safe();
179 }
180 kit.push_node(method()->return_type()->basic_type(), ret);
181 return kit.transfer_exceptions_into_jvms();
182 }
183
184 //--------------------------VirtualCallGenerator------------------------------
185 // Internal class which handles all out-of-line calls checking receiver type.
186 class VirtualCallGenerator : public CallGenerator {
187 private:
188 int _vtable_index;
189 bool _separate_io_proj;
190 CallDynamicJavaNode* _call_node;
191
192 protected:
193 void set_call_node(CallDynamicJavaNode* call) { _call_node = call; }
194
195 public:
196 VirtualCallGenerator(ciMethod* method, int vtable_index, bool separate_io_proj)
197 : CallGenerator(method), _vtable_index(vtable_index), _separate_io_proj(separate_io_proj), _call_node(nullptr)
198 {
199 assert(vtable_index == Method::invalid_vtable_index ||
200 vtable_index >= 0, "either invalid or usable");
201 }
202 virtual bool is_virtual() const { return true; }
203 virtual JVMState* generate(JVMState* jvms);
204
205 virtual CallNode* call_node() const { return _call_node; }
206 int vtable_index() const { return _vtable_index; }
207
208 virtual CallGenerator* with_call_node(CallNode* call) {
209 VirtualCallGenerator* cg = new VirtualCallGenerator(method(), _vtable_index, _separate_io_proj);
210 cg->set_call_node(call->as_CallDynamicJava());
211 return cg;
212 }
213 };
214
215 JVMState* VirtualCallGenerator::generate(JVMState* jvms) {
216 GraphKit kit(jvms);
217 Node* receiver = kit.argument(0);
218
219 if (kit.C->log() != nullptr) {
220 kit.C->log()->elem("virtual_call bci='%d'", jvms->bci());
221 }
222
223 // If the receiver is a constant null, do not torture the system
224 // by attempting to call through it. The compile will proceed
225 // correctly, but may bail out in final_graph_reshaping, because
226 // the call instruction will have a seemingly deficient out-count.
227 // (The bailout says something misleading about an "infinite loop".)
228 if (kit.gvn().type(receiver)->higher_equal(TypePtr::NULL_PTR)) {
229 assert(Bytecodes::is_invoke(kit.java_bc()), "%d: %s", kit.java_bc(), Bytecodes::name(kit.java_bc()));
230 ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
231 int arg_size = declared_method->signature()->arg_size_for_bc(kit.java_bc());
232 kit.inc_sp(arg_size); // restore arguments
233 kit.uncommon_trap(Deoptimization::Reason_null_check,
234 Deoptimization::Action_none,
235 nullptr, "null receiver");
236 return kit.transfer_exceptions_into_jvms();
237 }
238
258 assert(!method()->is_static(), "virtual call must not be to static");
259 assert(!method()->is_final(), "virtual call should not be to final");
260 assert(!method()->is_private(), "virtual call should not be to private");
261 assert(_vtable_index == Method::invalid_vtable_index || !UseInlineCaches,
262 "no vtable calls if +UseInlineCaches ");
263 address target = SharedRuntime::get_resolve_virtual_call_stub();
264 // Normal inline cache used for call
265 CallDynamicJavaNode* call = new CallDynamicJavaNode(tf(), target, method(), _vtable_index);
266 if (is_inlined_method_handle_intrinsic(jvms, method())) {
267 // To be able to issue a direct call (optimized virtual or virtual)
268 // and skip a call to MH.linkTo*/invokeBasic adapter, additional information
269 // about the method being invoked should be attached to the call site to
270 // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C).
271 call->set_override_symbolic_info(true);
272 }
273 _call_node = call; // Save the call node in case we need it later
274
275 kit.set_arguments_for_java_call(call);
276 kit.set_edges_for_java_call(call, false /*must_throw*/, _separate_io_proj);
277 Node* ret = kit.set_results_for_java_call(call, _separate_io_proj);
278 if (is_late_inline() && ret->is_Proj()) {
279 // If late inlining for this call happens in a dead part of the graph it can leave a dead loop behind
280 ret->mark_not_dead_loop_safe();
281 }
282 kit.push_node(method()->return_type()->basic_type(), ret);
283
284 // Represent the effect of an implicit receiver null_check
285 // as part of this call. Since we share a map with the caller,
286 // his JVMS gets adjusted.
287 kit.cast_not_null(receiver);
288 return kit.transfer_exceptions_into_jvms();
289 }
290
291 CallGenerator* CallGenerator::for_inline(ciMethod* m, float expected_uses) {
292 if (InlineTree::check_can_parse(m) != nullptr) return nullptr;
293 return new ParseGenerator(m, expected_uses);
294 }
295
296 // As a special case, the JVMS passed to this CallGenerator is
297 // for the method execution already in progress, not just the JVMS
298 // of the caller. Thus, this CallGenerator cannot be mixed with others!
299 CallGenerator* CallGenerator::for_osr(ciMethod* m, int osr_bci) {
300 if (InlineTree::check_can_parse(m) != nullptr) return nullptr;
301 float past_uses = m->interpreter_invocation_count();
344 // parse is finished.
345 if (!is_mh_late_inline()) {
346 C->add_late_inline(this);
347 }
348
349 // Emit the CallStaticJava and request separate projections so
350 // that the late inlining logic can distinguish between fall
351 // through and exceptional uses of the memory and io projections
352 // as is done for allocations and macro expansion.
353 return DirectCallGenerator::generate(jvms);
354 }
355
356 virtual void set_unique_id(jlong id) {
357 _unique_id = id;
358 }
359
360 virtual jlong unique_id() const {
361 return _unique_id;
362 }
363
364 virtual CallGenerator* with_call_node(CallNode* call) {
365 LateInlineCallGenerator* cg = new LateInlineCallGenerator(method(), _inline_cg, _is_pure_call);
366 cg->set_call_node(call->as_CallStaticJava());
367 return cg;
368 }
369 };
370
371 CallGenerator* CallGenerator::for_late_inline(ciMethod* method, CallGenerator* inline_cg) {
372 return new LateInlineCallGenerator(method, inline_cg);
373 }
374
375 class LateInlineMHCallGenerator : public LateInlineCallGenerator {
376 ciMethod* _caller;
377 bool _input_not_const;
378
379 virtual bool do_late_inline_check(Compile* C, JVMState* jvms);
380
381 public:
382 LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) :
383 LateInlineCallGenerator(callee, nullptr), _caller(caller), _input_not_const(input_not_const) {}
405 cg->set_call_node(call->as_CallStaticJava());
406 return cg;
407 }
408 };
409
410 bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms) {
411 // When inlining a virtual call, the null check at the call and the call itself can throw. These 2 paths have different
412 // expression stacks which causes late inlining to break. The MH invoker is not expected to be called from a method with
413 // exception handlers. When there is no exception handler, GraphKit::builtin_throw() pops the stack which solves the issue
414 // of late inlining with exceptions.
415 assert(!jvms->method()->has_exception_handlers() ||
416 (method()->intrinsic_id() != vmIntrinsics::_linkToVirtual &&
417 method()->intrinsic_id() != vmIntrinsics::_linkToInterface), "no exception handler expected");
418 // Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call.
419 bool allow_inline = C->inlining_incrementally();
420 bool input_not_const = true;
421 CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), allow_inline, input_not_const);
422 assert(!input_not_const, "sanity"); // shouldn't have been scheduled for inlining in the first place
423
424 if (cg != nullptr) {
425 if (!allow_inline) {
426 C->inline_printer()->record(cg->method(), call_node()->jvms(), InliningResult::FAILURE,
427 "late method handle call resolution");
428 }
429 assert(!cg->is_late_inline() || cg->is_mh_late_inline() || cg->is_virtual_late_inline() ||
430 AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining");
431 _inline_cg = cg;
432 return true;
433 } else {
434 // Method handle call which has a constant appendix argument should be either inlined or replaced with a direct call
435 // unless there's a signature mismatch between caller and callee. If the failure occurs, there's not much to be improved later,
436 // so don't reinstall the generator to avoid pushing the generator between IGVN and incremental inlining indefinitely.
437 return false;
438 }
439 }
440
441 CallGenerator* CallGenerator::for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const) {
442 assert(IncrementalInlineMH, "required");
443 Compile::current()->mark_has_mh_late_inlines();
444 CallGenerator* cg = new LateInlineMHCallGenerator(caller, callee, input_not_const);
565
566 void LateInlineMHCallGenerator::do_late_inline() {
567 CallGenerator::do_late_inline_helper();
568 }
569
570 void LateInlineVirtualCallGenerator::do_late_inline() {
571 assert(_callee != nullptr, "required"); // set up in CallDynamicJavaNode::Ideal
572 CallGenerator::do_late_inline_helper();
573 }
574
575 void CallGenerator::do_late_inline_helper() {
576 assert(is_late_inline(), "only late inline allowed");
577
578 // Can't inline it
579 CallNode* call = call_node();
580 if (call == nullptr || call->outcnt() == 0 ||
581 call->in(0) == nullptr || call->in(0)->is_top()) {
582 return;
583 }
584
585 const TypeTuple *r = call->tf()->domain();
586 for (int i1 = 0; i1 < method()->arg_size(); i1++) {
587 if (call->in(TypeFunc::Parms + i1)->is_top() && r->field_at(TypeFunc::Parms + i1) != Type::HALF) {
588 assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
589 return;
590 }
591 }
592
593 if (call->in(TypeFunc::Memory)->is_top()) {
594 assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
595 return;
596 }
597 if (call->in(TypeFunc::Memory)->is_MergeMem()) {
598 MergeMemNode* merge_mem = call->in(TypeFunc::Memory)->as_MergeMem();
599 if (merge_mem->base_memory() == merge_mem->empty_memory()) {
600 return; // dead path
601 }
602 }
603
604 // check for unreachable loop
605 CallProjections callprojs;
606 // Similar to incremental inlining, don't assert that all call
607 // projections are still there for post-parse call devirtualization.
608 bool do_asserts = !is_mh_late_inline() && !is_virtual_late_inline();
609 call->extract_projections(&callprojs, true, do_asserts);
610 if ((callprojs.fallthrough_catchproj == call->in(0)) ||
611 (callprojs.catchall_catchproj == call->in(0)) ||
612 (callprojs.fallthrough_memproj == call->in(TypeFunc::Memory)) ||
613 (callprojs.catchall_memproj == call->in(TypeFunc::Memory)) ||
614 (callprojs.fallthrough_ioproj == call->in(TypeFunc::I_O)) ||
615 (callprojs.catchall_ioproj == call->in(TypeFunc::I_O)) ||
616 (callprojs.resproj != nullptr && call->find_edge(callprojs.resproj) != -1) ||
617 (callprojs.exobj != nullptr && call->find_edge(callprojs.exobj) != -1)) {
618 return;
619 }
620
621 Compile* C = Compile::current();
622
623 uint endoff = call->jvms()->endoff();
624 if (C->inlining_incrementally()) {
625 // No reachability edges should be present when incremental inlining takes place.
626 // Inlining logic doesn't expect any extra edges past debug info and fails with
627 // an assert in SafePointNode::grow_stack.
628 assert(endoff == call->req(), "reachability edges not supported");
629 } else {
630 if (call->req() > endoff) { // reachability edges present
631 assert(OptimizeReachabilityFences, "required");
632 return; // keep the original call node as the holder of reachability info
633 }
634 }
635
636 // Remove inlined methods from Compiler's lists.
637 if (call->is_macro()) {
638 C->remove_macro_node(call);
639 }
640
641 // The call is marked as pure (no important side effects), but result isn't used.
642 // It's safe to remove the call.
643 bool result_not_used = (callprojs.resproj == nullptr || callprojs.resproj->outcnt() == 0);
644
645 if (is_pure_call() && result_not_used) {
646 GraphKit kit(call->jvms());
647 kit.replace_call(call, C->top(), true, do_asserts);
648 } else {
649 // Make a clone of the JVMState that appropriate to use for driving a parse
650 JVMState* old_jvms = call->jvms();
651 JVMState* jvms = old_jvms->clone_shallow(C);
652 uint size = call->req();
653 SafePointNode* map = new SafePointNode(size, jvms);
654 for (uint i1 = 0; i1 < size; i1++) {
655 map->init_req(i1, call->in(i1));
656 }
657 // Call node has in(ReturnAdr) set to top() node.
658 // We have to set map->in(ReturnAdr) to correct value
659 // because it is used by uncommon traps.
660 Node* ret_adr = C->start()->proj_out_or_null(TypeFunc::ReturnAdr);
661 precond(ret_adr != nullptr);
662 map->set_req(TypeFunc::ReturnAdr, ret_adr);
663
664 // Make sure the state is a MergeMem for parsing.
665 if (!map->in(TypeFunc::Memory)->is_MergeMem()) {
666 Node* mem = MergeMemNode::make(map->in(TypeFunc::Memory));
667 C->initial_gvn()->set_type_bottom(mem);
668 map->set_req(TypeFunc::Memory, mem);
669 }
670
671 uint nargs = method()->arg_size();
672 // blow away old call arguments
673 Node* top = C->top();
674 for (uint i1 = 0; i1 < nargs; i1++) {
675 map->set_req(TypeFunc::Parms + i1, top);
676 }
677 jvms->set_map(map);
678 precond(ret_adr == jvms->map()->returnadr());
679
680 // Make enough space in the expression stack to transfer
681 // the incoming arguments and return value.
682 map->ensure_stack(jvms, jvms->method()->max_stack());
683 for (uint i1 = 0; i1 < nargs; i1++) {
684 map->set_argument(jvms, i1, call->in(TypeFunc::Parms + i1));
685 }
686
687 C->log_late_inline(this);
688
689 // JVMState is ready, so time to perform some checks and prepare for inlining attempt.
690 if (!do_late_inline_check(C, jvms)) {
691 map->disconnect_inputs(C);
692 return;
693 }
694
695 // Setup default node notes to be picked up by the inlining
696 Node_Notes* old_nn = C->node_notes_at(call->_idx);
697 if (old_nn != nullptr) {
698 Node_Notes* entry_nn = old_nn->clone(C);
699 entry_nn->set_jvms(jvms);
700 C->set_default_node_notes(entry_nn);
701 }
702
703 // Now perform the inlining using the synthesized JVMState
704 JVMState* new_jvms = inline_cg()->generate(jvms);
705 if (new_jvms == nullptr) return; // no change
706 if (C->failing()) return;
707
708 if (is_mh_late_inline()) {
709 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (method handle)");
710 } else if (is_string_late_inline()) {
711 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (string method)");
712 } else if (is_boxing_late_inline()) {
713 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (boxing method)");
714 } else if (is_vector_reboxing_late_inline()) {
715 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (vector reboxing method)");
716 } else {
717 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded");
718 }
719
720 // Capture any exceptional control flow
721 GraphKit kit(new_jvms);
722
723 // Find the result object
724 Node* result = C->top();
725 int result_size = method()->return_type()->size();
726 if (result_size != 0 && !kit.stopped()) {
727 result = (result_size == 1) ? kit.pop() : kit.pop_pair();
728 }
729
730 if (call->is_CallStaticJava() && call->as_CallStaticJava()->is_boxing_method()) {
731 result = kit.must_be_not_null(result, false);
732 }
733
734 if (inline_cg()->is_inline()) {
735 C->set_has_loops(C->has_loops() || inline_cg()->method()->has_loops());
736 C->env()->notice_inlined_method(inline_cg()->method());
737 }
738 C->set_inlining_progress(true);
739 C->set_do_cleanup(kit.stopped()); // path is dead; needs cleanup
740 kit.replace_call(call, result, true, do_asserts);
741 }
742 }
743
744 class LateInlineStringCallGenerator : public LateInlineCallGenerator {
745
746 public:
747 LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
748 LateInlineCallGenerator(method, inline_cg) {}
749
750 virtual JVMState* generate(JVMState* jvms) {
751 Compile *C = Compile::current();
752
753 C->log_inline_id(this);
754
755 C->add_string_late_inline(this);
756
757 JVMState* new_jvms = DirectCallGenerator::generate(jvms);
758 return new_jvms;
759 }
982 // Merge memory
983 kit.merge_memory(slow_map->merged_memory(), region, 2);
984 // Transform new memory Phis.
985 for (MergeMemStream mms(kit.merged_memory()); mms.next_non_empty();) {
986 Node* phi = mms.memory();
987 if (phi->is_Phi() && phi->in(0) == region) {
988 mms.set_memory(gvn.transform(phi));
989 }
990 }
991 uint tos = kit.jvms()->stkoff() + kit.sp();
992 uint limit = slow_map->req();
993 for (uint i = TypeFunc::Parms; i < limit; i++) {
994 // Skip unused stack slots; fast forward to monoff();
995 if (i == tos) {
996 i = kit.jvms()->monoff();
997 if( i >= limit ) break;
998 }
999 Node* m = kit.map()->in(i);
1000 Node* n = slow_map->in(i);
1001 if (m != n) {
1002 const Type* t = gvn.type(m)->meet_speculative(gvn.type(n));
1003 Node* phi = PhiNode::make(region, m, t);
1004 phi->set_req(2, n);
1005 kit.map()->set_req(i, gvn.transform(phi));
1006 }
1007 }
1008 return kit.transfer_exceptions_into_jvms();
1009 }
1010
1011
1012 CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline) {
1013 assert(callee->is_method_handle_intrinsic(), "for_method_handle_call mismatch");
1014 bool input_not_const;
1015 CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, allow_inline, input_not_const);
1016 Compile* C = Compile::current();
1017 bool should_delay = C->should_delay_inlining();
1018 if (cg != nullptr) {
1019 if (should_delay && IncrementalInlineMH) {
1020 return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
1021 } else {
1022 return cg;
1023 }
1024 }
1025 int bci = jvms->bci();
1026 ciCallProfile profile = caller->call_profile_at_bci(bci);
1027 int call_site_count = caller->scale_count(profile.count());
1028
1029 if (IncrementalInlineMH && call_site_count > 0 &&
1030 (should_delay || input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())) {
1031 return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
1032 } else {
1033 // Out-of-line call.
1034 return CallGenerator::for_direct_call(callee);
1035 }
1036 }
1037
1038 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline, bool& input_not_const) {
1039 GraphKit kit(jvms);
1040 PhaseGVN& gvn = kit.gvn();
1041 Compile* C = kit.C;
1042 vmIntrinsics::ID iid = callee->intrinsic_id();
1043 input_not_const = true;
1044 if (StressMethodHandleLinkerInlining) {
1045 allow_inline = false;
1046 }
1047 switch (iid) {
1048 case vmIntrinsics::_invokeBasic:
1049 {
1050 // Get MethodHandle receiver:
1051 Node* receiver = kit.argument(0);
1052 if (receiver->Opcode() == Op_ConP) {
1053 input_not_const = false;
1054 const TypeOopPtr* recv_toop = receiver->bottom_type()->isa_oopptr();
1055 if (recv_toop != nullptr) {
1056 ciMethod* target = recv_toop->const_oop()->as_method_handle()->get_vmtarget();
1057 const int vtable_index = Method::invalid_vtable_index;
1065 false /* call_does_dispatch */,
1066 jvms,
1067 allow_inline,
1068 PROB_ALWAYS);
1069 return cg;
1070 } else {
1071 assert(receiver->bottom_type() == TypePtr::NULL_PTR, "not a null: %s",
1072 Type::str(receiver->bottom_type()));
1073 print_inlining_failure(C, callee, jvms, "receiver is always null");
1074 }
1075 } else {
1076 print_inlining_failure(C, callee, jvms, "receiver not constant");
1077 }
1078 } break;
1079
1080 case vmIntrinsics::_linkToVirtual:
1081 case vmIntrinsics::_linkToStatic:
1082 case vmIntrinsics::_linkToSpecial:
1083 case vmIntrinsics::_linkToInterface:
1084 {
1085 // Get MemberName argument:
1086 Node* member_name = kit.argument(callee->arg_size() - 1);
1087 if (member_name->Opcode() == Op_ConP) {
1088 input_not_const = false;
1089 const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
1090 ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget();
1091
1092 if (!ciMethod::is_consistent_info(callee, target)) {
1093 print_inlining_failure(C, callee, jvms, "signatures mismatch");
1094 return nullptr;
1095 }
1096
1097 // In lambda forms we erase signature types to avoid resolving issues
1098 // involving class loaders. When we optimize a method handle invoke
1099 // to a direct call we must cast the receiver and arguments to its
1100 // actual types.
1101 ciSignature* signature = target->signature();
1102 const int receiver_skip = target->is_static() ? 0 : 1;
1103 // Cast receiver to its type.
1104 if (!target->is_static()) {
1105 Node* recv = kit.argument(0);
1106 Node* casted_recv = kit.maybe_narrow_object_type(recv, signature->accessing_klass());
1107 if (casted_recv->is_top()) {
1108 print_inlining_failure(C, callee, jvms, "argument types mismatch");
1109 return nullptr; // FIXME: effectively dead; issue a halt node instead
1110 } else if (casted_recv != recv) {
1111 kit.set_argument(0, casted_recv);
1112 }
1113 }
1114 // Cast reference arguments to its type.
1115 for (int i = 0, j = 0; i < signature->count(); i++) {
1116 ciType* t = signature->type_at(i);
1117 if (t->is_klass()) {
1118 Node* arg = kit.argument(receiver_skip + j);
1119 Node* casted_arg = kit.maybe_narrow_object_type(arg, t->as_klass());
1120 if (casted_arg->is_top()) {
1121 print_inlining_failure(C, callee, jvms, "argument types mismatch");
1122 return nullptr; // FIXME: effectively dead; issue a halt node instead
1123 } else if (casted_arg != arg) {
1124 kit.set_argument(receiver_skip + j, casted_arg);
1125 }
1126 }
1127 j += t->size(); // long and double take two slots
1128 }
1129
1130 // Try to get the most accurate receiver type
1131 const bool is_virtual = (iid == vmIntrinsics::_linkToVirtual);
1132 const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
1133 int vtable_index = Method::invalid_vtable_index;
1134 bool call_does_dispatch = false;
1135
1136 ciKlass* speculative_receiver_type = nullptr;
1137 if (is_virtual_or_interface) {
1138 ciInstanceKlass* klass = target->holder();
1139 Node* receiver_node = kit.argument(0);
1140 const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
1141 // call_does_dispatch and vtable_index are out-parameters. They might be changed.
1142 // optimize_virtual_call() takes 2 different holder
1143 // arguments for a corner case that doesn't apply here (see
1144 // Parse::do_call())
1145 target = C->optimize_virtual_call(caller, klass, klass,
1146 target, receiver_type, is_virtual,
1147 call_does_dispatch, vtable_index, // out-parameters
1148 false /* check_access */);
1149 // We lack profiling at this call but type speculation may
1150 // provide us with a type
1151 speculative_receiver_type = (receiver_type != nullptr) ? receiver_type->speculative_type() : nullptr;
1152 }
1153 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms,
1154 allow_inline,
1155 PROB_ALWAYS,
1156 speculative_receiver_type);
1157 return cg;
1158 } else {
1159 print_inlining_failure(C, callee, jvms, "member_name not constant");
1160 }
1161 } break;
1162
1163 case vmIntrinsics::_linkToNative:
1164 print_inlining_failure(C, callee, jvms, "native call");
1165 break;
1166
1167 default:
1168 fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
1169 break;
1170 }
1171 return nullptr;
1172 }
1173
1174 //------------------------PredicatedIntrinsicGenerator------------------------------
1175 // Internal class which handles all predicated Intrinsic calls.
1176 class PredicatedIntrinsicGenerator : public CallGenerator {
1208 // do_intrinsic(0)
1209 // else
1210 // if (predicate(1))
1211 // do_intrinsic(1)
1212 // ...
1213 // else
1214 // do_java_comp
1215
1216 GraphKit kit(jvms);
1217 PhaseGVN& gvn = kit.gvn();
1218
1219 CompileLog* log = kit.C->log();
1220 if (log != nullptr) {
1221 log->elem("predicated_intrinsic bci='%d' method='%d'",
1222 jvms->bci(), log->identify(method()));
1223 }
1224
1225 if (!method()->is_static()) {
1226 // We need an explicit receiver null_check before checking its type in predicate.
1227 // We share a map with the caller, so his JVMS gets adjusted.
1228 Node* receiver = kit.null_check_receiver_before_call(method());
1229 if (kit.stopped()) {
1230 return kit.transfer_exceptions_into_jvms();
1231 }
1232 }
1233
1234 int n_predicates = _intrinsic->predicates_count();
1235 assert(n_predicates > 0, "sanity");
1236
1237 JVMState** result_jvms = NEW_RESOURCE_ARRAY(JVMState*, (n_predicates+1));
1238
1239 // Region for normal compilation code if intrinsic failed.
1240 Node* slow_region = new RegionNode(1);
1241
1242 int results = 0;
1243 for (int predicate = 0; (predicate < n_predicates) && !kit.stopped(); predicate++) {
1244 #ifdef ASSERT
1245 JVMState* old_jvms = kit.jvms();
1246 SafePointNode* old_map = kit.map();
1247 Node* old_io = old_map->i_o();
1248 Node* old_mem = old_map->memory();
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "ci/bcEscapeAnalyzer.hpp"
26 #include "ci/ciCallSite.hpp"
27 #include "ci/ciMemberName.hpp"
28 #include "ci/ciMethodHandle.hpp"
29 #include "ci/ciObjArray.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "compiler/compileLog.hpp"
32 #include "oops/accessDecorators.hpp"
33 #include "opto/addnode.hpp"
34 #include "opto/callGenerator.hpp"
35 #include "opto/callnode.hpp"
36 #include "opto/castnode.hpp"
37 #include "opto/cfgnode.hpp"
38 #include "opto/inlinetypenode.hpp"
39 #include "opto/parse.hpp"
40 #include "opto/rootnode.hpp"
41 #include "opto/runtime.hpp"
42 #include "opto/subnode.hpp"
43 #include "runtime/os.inline.hpp"
44 #include "runtime/sharedRuntime.hpp"
45 #include "utilities/debug.hpp"
46
47 // Utility function.
48 const TypeFunc* CallGenerator::tf() const {
49 return TypeFunc::make(method());
50 }
51
52 bool CallGenerator::is_inlined_method_handle_intrinsic(JVMState* jvms, ciMethod* m) {
53 return is_inlined_method_handle_intrinsic(jvms->method(), jvms->bci(), m);
54 }
55
56 bool CallGenerator::is_inlined_method_handle_intrinsic(ciMethod* caller, int bci, ciMethod* m) {
57 ciMethod* symbolic_info = caller->get_method_at_bci(bci);
58 return is_inlined_method_handle_intrinsic(symbolic_info, m);
59 }
60
61 bool CallGenerator::is_inlined_method_handle_intrinsic(ciMethod* symbolic_info, ciMethod* m) {
62 return symbolic_info->is_method_handle_intrinsic() && !m->is_method_handle_intrinsic();
63 }
64
65 // If late inlining for this call happens in a dead part of the graph it can leave a dead loop behind
66 void CallGenerator::mark_projs_not_dead_loop_safe(Node* ret) const {
67 if (!is_late_inline()) {
68 return;
69 }
70 CallNode* call = call_node();
71 if (ret->is_Proj() && ret->in(0) == call) {
72 ret->mark_not_dead_loop_safe();
73 } else if (ret->isa_InlineType()) {
74 InlineTypeNode* vt = ret->as_InlineType();
75 Node* oop = vt->get_oop();
76 if (oop->is_Proj() && oop->in(0) == call) {
77 oop->mark_not_dead_loop_safe();
78 }
79 Node* null_marker = vt->get_null_marker();
80 if (null_marker->is_Proj() && null_marker->in(0) == call) {
81 null_marker->mark_not_dead_loop_safe();
82 }
83
84 for (uint i = 0; i < vt->field_count(); i++) {
85 Node* field = vt->field_value(i);
86 if (field->is_Proj() && field->in(0) == call) {
87 field->mark_not_dead_loop_safe();
88 }
89 }
90 }
91 }
92
93 //-----------------------------ParseGenerator---------------------------------
94 // Internal class which handles all direct bytecode traversal.
95 class ParseGenerator : public InlineCallGenerator {
96 private:
97 bool _is_osr;
98 float _expected_uses;
99
100 public:
101 ParseGenerator(ciMethod* method, float expected_uses, bool is_osr = false)
102 : InlineCallGenerator(method)
103 {
104 _is_osr = is_osr;
105 _expected_uses = expected_uses;
106 assert(InlineTree::check_can_parse(method) == nullptr, "parse must be possible");
107 }
108
109 virtual bool is_parse() const { return true; }
110 virtual JVMState* generate(JVMState* jvms);
111 bool is_osr() const { return _is_osr; }
112
131 GraphKit& exits = parser.exits();
132
133 if (C->failing()) {
134 while (exits.pop_exception_state() != nullptr) ;
135 return nullptr;
136 }
137
138 assert(exits.jvms()->same_calls_as(jvms), "sanity");
139
140 // Simply return the exit state of the parser,
141 // augmented by any exceptional states.
142 return exits.transfer_exceptions_into_jvms();
143 }
144
145 //---------------------------DirectCallGenerator------------------------------
146 // Internal class which handles all out-of-line calls w/o receiver type checks.
147 class DirectCallGenerator : public CallGenerator {
148 private:
149 CallStaticJavaNode* _call_node;
150 // Force separate memory and I/O projections for the exceptional
151 // paths to facilitate late inlining.
152 bool _separate_io_proj;
153
154 protected:
155 void set_call_node(CallStaticJavaNode* call) { _call_node = call; }
156
157 public:
158 DirectCallGenerator(ciMethod* method, bool separate_io_proj)
159 : CallGenerator(method),
160 _call_node(nullptr),
161 _separate_io_proj(separate_io_proj)
162 {
163 if (InlineTypeReturnedAsFields && method->is_method_handle_intrinsic()) {
164 // If that call has not been optimized by the time optimizations are over,
165 // we'll need to add a call to create an inline type instance from the klass
166 // returned by the call (see PhaseMacroExpand::expand_mh_intrinsic_return).
167 // Separating memory and I/O projections for exceptions is required to
168 // perform that graph transformation.
169 _separate_io_proj = true;
170 }
171 }
172 virtual JVMState* generate(JVMState* jvms);
173
174 virtual CallNode* call_node() const { return _call_node; }
175 virtual CallGenerator* with_call_node(CallNode* call) {
176 DirectCallGenerator* dcg = new DirectCallGenerator(method(), _separate_io_proj);
177 dcg->set_call_node(call->as_CallStaticJava());
178 return dcg;
179 }
180 };
181
182 JVMState* DirectCallGenerator::generate(JVMState* jvms) {
183 GraphKit kit(jvms);
184 bool is_static = method()->is_static();
185 address target = is_static ? SharedRuntime::get_resolve_static_call_stub()
186 : SharedRuntime::get_resolve_opt_virtual_call_stub();
187
188 if (kit.C->log() != nullptr) {
189 kit.C->log()->elem("direct_call bci='%d'", jvms->bci());
190 }
195 // additional information about the method being invoked should be attached
196 // to the call site to make resolution logic work
197 // (see SharedRuntime::resolve_static_call_C).
198 call->set_override_symbolic_info(true);
199 }
200 _call_node = call; // Save the call node in case we need it later
201 if (!is_static) {
202 // Make an explicit receiver null_check as part of this call.
203 // Since we share a map with the caller, his JVMS gets adjusted.
204 kit.null_check_receiver_before_call(method());
205 if (kit.stopped()) {
206 // And dump it back to the caller, decorated with any exceptions:
207 return kit.transfer_exceptions_into_jvms();
208 }
209 // Mark the call node as virtual, sort of:
210 call->set_optimized_virtual(true);
211 }
212 kit.set_arguments_for_java_call(call);
213 kit.set_edges_for_java_call(call, false, _separate_io_proj);
214 Node* ret = kit.set_results_for_java_call(call, _separate_io_proj);
215 if (!call->is_boxing_method()) {
216 mark_projs_not_dead_loop_safe(ret);
217 }
218 kit.push_node(method()->return_type()->basic_type(), ret);
219 return kit.transfer_exceptions_into_jvms();
220 }
221
222 //--------------------------VirtualCallGenerator------------------------------
223 // Internal class which handles all out-of-line calls checking receiver type.
224 class VirtualCallGenerator : public CallGenerator {
225 private:
226 int _vtable_index;
227 bool _separate_io_proj;
228 CallDynamicJavaNode* _call_node;
229
230 protected:
231 void set_call_node(CallDynamicJavaNode* call) { _call_node = call; }
232
233 public:
234 VirtualCallGenerator(ciMethod* method, int vtable_index, bool separate_io_proj)
235 : CallGenerator(method), _vtable_index(vtable_index), _separate_io_proj(separate_io_proj), _call_node(nullptr)
236 {
237 assert(vtable_index == Method::invalid_vtable_index ||
238 vtable_index >= 0, "either invalid or usable");
239 }
240 virtual bool is_virtual() const { return true; }
241 virtual JVMState* generate(JVMState* jvms);
242
243 virtual CallNode* call_node() const { return _call_node; }
244 int vtable_index() const { return _vtable_index; }
245
246 virtual CallGenerator* with_call_node(CallNode* call) {
247 VirtualCallGenerator* cg = new VirtualCallGenerator(method(), _vtable_index, _separate_io_proj);
248 cg->set_call_node(call->as_CallDynamicJava());
249 return cg;
250 }
251 };
252
253 JVMState* VirtualCallGenerator::generate(JVMState* jvms) {
254 GraphKit kit(jvms);
255 Node* receiver = kit.argument(0);
256 if (kit.C->log() != nullptr) {
257 kit.C->log()->elem("virtual_call bci='%d'", jvms->bci());
258 }
259
260 // If the receiver is a constant null, do not torture the system
261 // by attempting to call through it. The compile will proceed
262 // correctly, but may bail out in final_graph_reshaping, because
263 // the call instruction will have a seemingly deficient out-count.
264 // (The bailout says something misleading about an "infinite loop".)
265 if (kit.gvn().type(receiver)->higher_equal(TypePtr::NULL_PTR)) {
266 assert(Bytecodes::is_invoke(kit.java_bc()), "%d: %s", kit.java_bc(), Bytecodes::name(kit.java_bc()));
267 ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
268 int arg_size = declared_method->signature()->arg_size_for_bc(kit.java_bc());
269 kit.inc_sp(arg_size); // restore arguments
270 kit.uncommon_trap(Deoptimization::Reason_null_check,
271 Deoptimization::Action_none,
272 nullptr, "null receiver");
273 return kit.transfer_exceptions_into_jvms();
274 }
275
295 assert(!method()->is_static(), "virtual call must not be to static");
296 assert(!method()->is_final(), "virtual call should not be to final");
297 assert(!method()->is_private(), "virtual call should not be to private");
298 assert(_vtable_index == Method::invalid_vtable_index || !UseInlineCaches,
299 "no vtable calls if +UseInlineCaches ");
300 address target = SharedRuntime::get_resolve_virtual_call_stub();
301 // Normal inline cache used for call
302 CallDynamicJavaNode* call = new CallDynamicJavaNode(tf(), target, method(), _vtable_index);
303 if (is_inlined_method_handle_intrinsic(jvms, method())) {
304 // To be able to issue a direct call (optimized virtual or virtual)
305 // and skip a call to MH.linkTo*/invokeBasic adapter, additional information
306 // about the method being invoked should be attached to the call site to
307 // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C).
308 call->set_override_symbolic_info(true);
309 }
310 _call_node = call; // Save the call node in case we need it later
311
312 kit.set_arguments_for_java_call(call);
313 kit.set_edges_for_java_call(call, false /*must_throw*/, _separate_io_proj);
314 Node* ret = kit.set_results_for_java_call(call, _separate_io_proj);
315 mark_projs_not_dead_loop_safe(ret);
316 kit.push_node(method()->return_type()->basic_type(), ret);
317
318 // Represent the effect of an implicit receiver null_check
319 // as part of this call. Since we share a map with the caller,
320 // his JVMS gets adjusted.
321 kit.cast_not_null(receiver);
322 return kit.transfer_exceptions_into_jvms();
323 }
324
325 CallGenerator* CallGenerator::for_inline(ciMethod* m, float expected_uses) {
326 if (InlineTree::check_can_parse(m) != nullptr) return nullptr;
327 return new ParseGenerator(m, expected_uses);
328 }
329
330 // As a special case, the JVMS passed to this CallGenerator is
331 // for the method execution already in progress, not just the JVMS
332 // of the caller. Thus, this CallGenerator cannot be mixed with others!
333 CallGenerator* CallGenerator::for_osr(ciMethod* m, int osr_bci) {
334 if (InlineTree::check_can_parse(m) != nullptr) return nullptr;
335 float past_uses = m->interpreter_invocation_count();
378 // parse is finished.
379 if (!is_mh_late_inline()) {
380 C->add_late_inline(this);
381 }
382
383 // Emit the CallStaticJava and request separate projections so
384 // that the late inlining logic can distinguish between fall
385 // through and exceptional uses of the memory and io projections
386 // as is done for allocations and macro expansion.
387 return DirectCallGenerator::generate(jvms);
388 }
389
390 virtual void set_unique_id(jlong id) {
391 _unique_id = id;
392 }
393
394 virtual jlong unique_id() const {
395 return _unique_id;
396 }
397
398 virtual CallGenerator* inline_cg() {
399 return _inline_cg;
400 }
401
402 virtual CallGenerator* with_call_node(CallNode* call) {
403 LateInlineCallGenerator* cg = new LateInlineCallGenerator(method(), _inline_cg, _is_pure_call);
404 cg->set_call_node(call->as_CallStaticJava());
405 return cg;
406 }
407 };
408
409 CallGenerator* CallGenerator::for_late_inline(ciMethod* method, CallGenerator* inline_cg) {
410 return new LateInlineCallGenerator(method, inline_cg);
411 }
412
413 class LateInlineMHCallGenerator : public LateInlineCallGenerator {
414 ciMethod* _caller;
415 bool _input_not_const;
416
417 virtual bool do_late_inline_check(Compile* C, JVMState* jvms);
418
419 public:
420 LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) :
421 LateInlineCallGenerator(callee, nullptr), _caller(caller), _input_not_const(input_not_const) {}
443 cg->set_call_node(call->as_CallStaticJava());
444 return cg;
445 }
446 };
447
448 bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms) {
449 // When inlining a virtual call, the null check at the call and the call itself can throw. These 2 paths have different
450 // expression stacks which causes late inlining to break. The MH invoker is not expected to be called from a method with
451 // exception handlers. When there is no exception handler, GraphKit::builtin_throw() pops the stack which solves the issue
452 // of late inlining with exceptions.
453 assert(!jvms->method()->has_exception_handlers() ||
454 (method()->intrinsic_id() != vmIntrinsics::_linkToVirtual &&
455 method()->intrinsic_id() != vmIntrinsics::_linkToInterface), "no exception handler expected");
456 // Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call.
457 bool allow_inline = C->inlining_incrementally();
458 bool input_not_const = true;
459 CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), allow_inline, input_not_const);
460 assert(!input_not_const, "sanity"); // shouldn't have been scheduled for inlining in the first place
461
462 if (cg != nullptr) {
463 // AlwaysIncrementalInline causes for_method_handle_inline() to
464 // return a LateInlineCallGenerator. Extract the
465 // InlineCallGenerator from it.
466 if (AlwaysIncrementalInline && cg->is_late_inline() && !cg->is_virtual_late_inline()) {
467 cg = cg->inline_cg();
468 assert(cg != nullptr, "inline call generator expected");
469 }
470
471 if (!allow_inline) {
472 C->inline_printer()->record(cg->method(), call_node()->jvms(), InliningResult::FAILURE,
473 "late method handle call resolution");
474 }
475 assert(!cg->is_late_inline() || cg->is_mh_late_inline() || cg->is_virtual_late_inline() ||
476 AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining");
477 _inline_cg = cg;
478 return true;
479 } else {
480 // Method handle call which has a constant appendix argument should be either inlined or replaced with a direct call
481 // unless there's a signature mismatch between caller and callee. If the failure occurs, there's not much to be improved later,
482 // so don't reinstall the generator to avoid pushing the generator between IGVN and incremental inlining indefinitely.
483 return false;
484 }
485 }
486
487 CallGenerator* CallGenerator::for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const) {
488 assert(IncrementalInlineMH, "required");
489 Compile::current()->mark_has_mh_late_inlines();
490 CallGenerator* cg = new LateInlineMHCallGenerator(caller, callee, input_not_const);
611
612 void LateInlineMHCallGenerator::do_late_inline() {
613 CallGenerator::do_late_inline_helper();
614 }
615
616 void LateInlineVirtualCallGenerator::do_late_inline() {
617 assert(_callee != nullptr, "required"); // set up in CallDynamicJavaNode::Ideal
618 CallGenerator::do_late_inline_helper();
619 }
620
621 void CallGenerator::do_late_inline_helper() {
622 assert(is_late_inline(), "only late inline allowed");
623
624 // Can't inline it
625 CallNode* call = call_node();
626 if (call == nullptr || call->outcnt() == 0 ||
627 call->in(0) == nullptr || call->in(0)->is_top()) {
628 return;
629 }
630
631 const TypeTuple* r = call->tf()->domain_cc();
632 for (uint i1 = TypeFunc::Parms; i1 < r->cnt(); i1++) {
633 if (call->in(i1)->is_top() && r->field_at(i1) != Type::HALF) {
634 assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
635 return;
636 }
637 }
638
639 if (call->in(TypeFunc::Memory)->is_top()) {
640 assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
641 return;
642 }
643 if (call->in(TypeFunc::Memory)->is_MergeMem()) {
644 MergeMemNode* merge_mem = call->in(TypeFunc::Memory)->as_MergeMem();
645 if (merge_mem->base_memory() == merge_mem->empty_memory()) {
646 return; // dead path
647 }
648 }
649
650 // check for unreachable loop
651 // Similar to incremental inlining, don't assert that all call
652 // projections are still there for post-parse call devirtualization.
653 bool do_asserts = !is_mh_late_inline() && !is_virtual_late_inline();
654 CallProjections* callprojs = call->extract_projections(true, do_asserts);
655 if ((callprojs->fallthrough_catchproj == call->in(0)) ||
656 (callprojs->catchall_catchproj == call->in(0)) ||
657 (callprojs->fallthrough_memproj == call->in(TypeFunc::Memory)) ||
658 (callprojs->catchall_memproj == call->in(TypeFunc::Memory)) ||
659 (callprojs->fallthrough_ioproj == call->in(TypeFunc::I_O)) ||
660 (callprojs->catchall_ioproj == call->in(TypeFunc::I_O)) ||
661 (callprojs->exobj != nullptr && call->find_edge(callprojs->exobj) != -1)) {
662 return;
663 }
664
665 Compile* C = Compile::current();
666
667 uint endoff = call->jvms()->endoff();
668 if (C->inlining_incrementally()) {
669 // No reachability edges should be present when incremental inlining takes place.
670 // Inlining logic doesn't expect any extra edges past debug info and fails with
671 // an assert in SafePointNode::grow_stack.
672 assert(endoff == call->req(), "reachability edges not supported");
673 } else {
674 if (call->req() > endoff) { // reachability edges present
675 assert(OptimizeReachabilityFences, "required");
676 return; // keep the original call node as the holder of reachability info
677 }
678 }
679
680 // Remove inlined methods from Compiler's lists.
681 if (call->is_macro()) {
682 C->remove_macro_node(call);
683 }
684
685
686 bool result_not_used = true;
687 for (uint i = 0; i < callprojs->nb_resproj; i++) {
688 if (callprojs->resproj[i] != nullptr) {
689 if (callprojs->resproj[i]->outcnt() != 0) {
690 result_not_used = false;
691 }
692 if (call->find_edge(callprojs->resproj[i]) != -1) {
693 return;
694 }
695 }
696 }
697
698 if (is_pure_call() && result_not_used) {
699 // The call is marked as pure (no important side effects), but result isn't used.
700 // It's safe to remove the call.
701 GraphKit kit(call->jvms());
702 kit.replace_call(call, C->top(), true, do_asserts);
703 } else {
704 // Make a clone of the JVMState that appropriate to use for driving a parse
705 JVMState* old_jvms = call->jvms();
706 JVMState* jvms = old_jvms->clone_shallow(C);
707 uint size = call->req();
708 SafePointNode* map = new SafePointNode(size, jvms);
709 for (uint i1 = 0; i1 < size; i1++) {
710 map->init_req(i1, call->in(i1));
711 }
712 // Call node has in(ReturnAdr) set to top() node.
713 // We have to set map->in(ReturnAdr) to correct value
714 // because it is used by uncommon traps.
715 Node* ret_adr = C->start()->proj_out_or_null(TypeFunc::ReturnAdr);
716 precond(ret_adr != nullptr);
717 map->set_req(TypeFunc::ReturnAdr, ret_adr);
718
719 PhaseGVN& gvn = *C->initial_gvn();
720 // Make sure the state is a MergeMem for parsing.
721 if (!map->in(TypeFunc::Memory)->is_MergeMem()) {
722 Node* mem = MergeMemNode::make(map->in(TypeFunc::Memory));
723 gvn.set_type_bottom(mem);
724 map->set_req(TypeFunc::Memory, mem);
725 }
726
727 // blow away old call arguments
728 for (uint i1 = TypeFunc::Parms; i1 < r->cnt(); i1++) {
729 map->set_req(i1, C->top());
730 }
731 jvms->set_map(map);
732 precond(ret_adr == jvms->map()->returnadr());
733
734 // Make enough space in the expression stack to transfer
735 // the incoming arguments and return value.
736 map->ensure_stack(jvms, jvms->method()->max_stack());
737 const TypeTuple* domain_sig = call->_tf->domain_sig();
738 uint nargs = method()->arg_size();
739 assert(domain_sig->cnt() - TypeFunc::Parms == nargs, "inconsistent signature");
740
741 uint j = TypeFunc::Parms;
742 int arg_num = 0;
743 for (uint i1 = 0; i1 < nargs; i1++) {
744 const Type* t = domain_sig->field_at(TypeFunc::Parms + i1);
745 if (t->is_inlinetypeptr() && !method()->mismatch() && method()->is_scalarized_arg(arg_num)) {
746 // Inline type arguments are not passed by reference: we get an argument per
747 // field of the inline type. Build InlineTypeNodes from the inline type arguments.
748 GraphKit arg_kit(jvms, &gvn);
749 Node* vt = InlineTypeNode::make_from_multi(&arg_kit, call, t->inline_klass(), j, /* in= */ true, /* null_free= */ !t->maybe_null());
750 // GraphKit::access_load_at() may be called from InlineTypeNode::make_from_multi() and it may change the map
751 // that arg_kit uses.
752 map = arg_kit.map();
753 map->set_control(arg_kit.control());
754 map->set_argument(jvms, i1, vt);
755 } else {
756 map->set_argument(jvms, i1, call->in(j++));
757 }
758 if (t != Type::HALF) {
759 arg_num++;
760 }
761 }
762
763 C->log_late_inline(this);
764
765 // JVMState is ready, so time to perform some checks and prepare for inlining attempt.
766 if (!do_late_inline_check(C, jvms)) {
767 map->disconnect_inputs(C);
768 return;
769 }
770
771 // Check if we are late inlining a method handle call that returns an inline type as fields.
772 Node* buffer_oop = nullptr;
773 ciMethod* inline_method = inline_cg()->method();
774 ciType* return_type = inline_method->return_type();
775 if (!call->tf()->returns_inline_type_as_fields() &&
776 return_type->is_inlinetype() && return_type->as_inline_klass()->can_be_returned_as_fields()) {
777 assert(is_mh_late_inline(), "Unexpected return type");
778
779 // Allocate a buffer for the inline type returned as fields because the caller expects an oop return.
780 // Do this before the method handle call in case the buffer allocation triggers deoptimization and
781 // we need to "re-execute" the call in the interpreter (to make sure the call is only executed once).
782 GraphKit arg_kit(jvms, &gvn);
783 {
784 PreserveReexecuteState preexecs(&arg_kit);
785 arg_kit.jvms()->set_should_reexecute(true);
786 arg_kit.inc_sp(nargs);
787 Node* klass_node = arg_kit.makecon(TypeKlassPtr::make(return_type->as_inline_klass()));
788 buffer_oop = arg_kit.new_instance(klass_node, nullptr, nullptr, /* deoptimize_on_exception */ true);
789 }
790 jvms = arg_kit.transfer_exceptions_into_jvms();
791 }
792
793 // Setup default node notes to be picked up by the inlining
794 Node_Notes* old_nn = C->node_notes_at(call->_idx);
795 if (old_nn != nullptr) {
796 Node_Notes* entry_nn = old_nn->clone(C);
797 entry_nn->set_jvms(jvms);
798 C->set_default_node_notes(entry_nn);
799 }
800
801 // Now perform the inlining using the synthesized JVMState
802 JVMState* new_jvms = inline_cg()->generate(jvms);
803 if (new_jvms == nullptr) return; // no change
804 if (C->failing()) return;
805
806 if (is_mh_late_inline()) {
807 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (method handle)");
808 } else if (is_string_late_inline()) {
809 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (string method)");
810 } else if (is_boxing_late_inline()) {
811 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (boxing method)");
812 } else if (is_vector_reboxing_late_inline()) {
813 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded (vector reboxing method)");
814 } else {
815 C->inline_printer()->record(method(), jvms, InliningResult::SUCCESS, "late inline succeeded");
816 }
817
818 // Capture any exceptional control flow
819 GraphKit kit(new_jvms);
820
821 // Find the result object
822 Node* result = C->top();
823 int result_size = method()->return_type()->size();
824 if (result_size != 0 && !kit.stopped()) {
825 result = (result_size == 1) ? kit.pop() : kit.pop_pair();
826 }
827
828 if (call->is_CallStaticJava() && call->as_CallStaticJava()->is_boxing_method()
829 && !call->tf()->returns_inline_type_as_fields()) {
830 result = kit.must_be_not_null(result, false);
831 }
832
833 if (inline_cg()->is_inline()) {
834 C->set_has_loops(C->has_loops() || inline_method->has_loops());
835 C->env()->notice_inlined_method(inline_method);
836 }
837 C->set_inlining_progress(true);
838 C->set_do_cleanup(kit.stopped()); // path is dead; needs cleanup
839
840 // Handle inline type returns
841 InlineTypeNode* vt = result->isa_InlineType();
842 if (vt != nullptr) {
843 if (call->tf()->returns_inline_type_as_fields()) {
844 vt->replace_call_results(&kit, call, C);
845 } else {
846 // Result might still be allocated (for example, if it has been stored to a non-flat field)
847 if (!vt->is_allocated(&kit.gvn())) {
848 assert(buffer_oop != nullptr, "should have allocated a buffer");
849 RegionNode* region = new RegionNode(3);
850
851 // Check if result is null
852 Node* null_ctl = kit.top();
853 kit.null_check_common(vt->get_null_marker(), T_INT, false, &null_ctl);
854 region->init_req(1, null_ctl);
855 PhiNode* oop = PhiNode::make(region, kit.gvn().zerocon(T_OBJECT), TypeInstPtr::make(TypePtr::BotPTR, vt->type()->inline_klass()));
856 Node* init_mem = kit.reset_memory();
857 PhiNode* mem = PhiNode::make(region, init_mem, Type::MEMORY, TypePtr::BOTTOM);
858
859 // Not null, initialize the buffer
860 kit.set_all_memory(init_mem);
861
862 Node* payload_ptr = kit.basic_plus_adr(buffer_oop, kit.gvn().type(vt)->inline_klass()->payload_offset());
863 vt->store_flat(&kit, buffer_oop, payload_ptr, false, true, true, IN_HEAP | MO_UNORDERED);
864 // Do not let stores that initialize this buffer be reordered with a subsequent
865 // store that would make this buffer accessible by other threads.
866 AllocateNode* alloc = AllocateNode::Ideal_allocation(buffer_oop);
867 assert(alloc != nullptr, "must have an allocation node");
868 kit.insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
869 region->init_req(2, kit.control());
870 oop->init_req(2, buffer_oop);
871 mem->init_req(2, kit.merged_memory());
872
873 // Update oop input to buffer
874 kit.gvn().hash_delete(vt);
875 vt->set_oop(kit.gvn(), kit.gvn().transform(oop));
876 vt->set_is_buffered(kit.gvn());
877 vt = kit.gvn().transform(vt)->as_InlineType();
878
879 kit.set_control(kit.gvn().transform(region));
880 kit.set_all_memory(kit.gvn().transform(mem));
881 kit.record_for_igvn(region);
882 kit.record_for_igvn(oop);
883 kit.record_for_igvn(mem);
884 }
885 result = vt;
886 }
887 DEBUG_ONLY(buffer_oop = nullptr);
888 } else {
889 assert(result->is_top() || !call->tf()->returns_inline_type_as_fields() || !call->as_CallJava()->method()->return_type()->is_loaded(), "Unexpected return value");
890 }
891 assert(kit.stopped() || buffer_oop == nullptr, "unused buffer allocation");
892
893 kit.replace_call(call, result, true, do_asserts);
894 }
895 }
896
897 class LateInlineStringCallGenerator : public LateInlineCallGenerator {
898
899 public:
900 LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
901 LateInlineCallGenerator(method, inline_cg) {}
902
903 virtual JVMState* generate(JVMState* jvms) {
904 Compile *C = Compile::current();
905
906 C->log_inline_id(this);
907
908 C->add_string_late_inline(this);
909
910 JVMState* new_jvms = DirectCallGenerator::generate(jvms);
911 return new_jvms;
912 }
1135 // Merge memory
1136 kit.merge_memory(slow_map->merged_memory(), region, 2);
1137 // Transform new memory Phis.
1138 for (MergeMemStream mms(kit.merged_memory()); mms.next_non_empty();) {
1139 Node* phi = mms.memory();
1140 if (phi->is_Phi() && phi->in(0) == region) {
1141 mms.set_memory(gvn.transform(phi));
1142 }
1143 }
1144 uint tos = kit.jvms()->stkoff() + kit.sp();
1145 uint limit = slow_map->req();
1146 for (uint i = TypeFunc::Parms; i < limit; i++) {
1147 // Skip unused stack slots; fast forward to monoff();
1148 if (i == tos) {
1149 i = kit.jvms()->monoff();
1150 if( i >= limit ) break;
1151 }
1152 Node* m = kit.map()->in(i);
1153 Node* n = slow_map->in(i);
1154 if (m != n) {
1155 #ifdef ASSERT
1156 if (m->is_InlineType() != n->is_InlineType()) {
1157 InlineTypeNode* unique_vt = m->is_InlineType() ? m->as_InlineType() : n->as_InlineType();
1158 assert(unique_vt->is_allocated(&gvn), "InlineType can be merged with an oop only if it is allocated");
1159 }
1160 #endif
1161 const Type* t = gvn.type(m)->meet_speculative(gvn.type(n));
1162 Node* phi = PhiNode::make(region, m, t);
1163 phi->set_req(2, n);
1164 kit.map()->set_req(i, gvn.transform(phi));
1165 }
1166 }
1167 return kit.transfer_exceptions_into_jvms();
1168 }
1169
1170
1171 CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline) {
1172 assert(callee->is_method_handle_intrinsic(), "for_method_handle_call mismatch");
1173 bool input_not_const;
1174 CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, allow_inline, input_not_const);
1175 Compile* C = Compile::current();
1176 bool should_delay = C->should_delay_inlining();
1177 if (cg != nullptr) {
1178 if (should_delay && IncrementalInlineMH) {
1179 return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
1180 } else {
1181 return cg;
1182 }
1183 }
1184 int bci = jvms->bci();
1185 ciCallProfile profile = caller->call_profile_at_bci(bci);
1186 int call_site_count = caller->scale_count(profile.count());
1187
1188 if (IncrementalInlineMH && (AlwaysIncrementalInline ||
1189 (call_site_count > 0 && (should_delay || input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())))) {
1190 return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
1191 } else {
1192 // Out-of-line call.
1193 return CallGenerator::for_direct_call(callee);
1194 }
1195 }
1196
1197
1198 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline, bool& input_not_const) {
1199 GraphKit kit(jvms);
1200 PhaseGVN& gvn = kit.gvn();
1201 Compile* C = kit.C;
1202 vmIntrinsics::ID iid = callee->intrinsic_id();
1203 input_not_const = true;
1204 if (StressMethodHandleLinkerInlining) {
1205 allow_inline = false;
1206 }
1207 switch (iid) {
1208 case vmIntrinsics::_invokeBasic:
1209 {
1210 // Get MethodHandle receiver:
1211 Node* receiver = kit.argument(0);
1212 if (receiver->Opcode() == Op_ConP) {
1213 input_not_const = false;
1214 const TypeOopPtr* recv_toop = receiver->bottom_type()->isa_oopptr();
1215 if (recv_toop != nullptr) {
1216 ciMethod* target = recv_toop->const_oop()->as_method_handle()->get_vmtarget();
1217 const int vtable_index = Method::invalid_vtable_index;
1225 false /* call_does_dispatch */,
1226 jvms,
1227 allow_inline,
1228 PROB_ALWAYS);
1229 return cg;
1230 } else {
1231 assert(receiver->bottom_type() == TypePtr::NULL_PTR, "not a null: %s",
1232 Type::str(receiver->bottom_type()));
1233 print_inlining_failure(C, callee, jvms, "receiver is always null");
1234 }
1235 } else {
1236 print_inlining_failure(C, callee, jvms, "receiver not constant");
1237 }
1238 } break;
1239
1240 case vmIntrinsics::_linkToVirtual:
1241 case vmIntrinsics::_linkToStatic:
1242 case vmIntrinsics::_linkToSpecial:
1243 case vmIntrinsics::_linkToInterface:
1244 {
1245 int nargs = callee->arg_size();
1246 // Get MemberName argument:
1247 Node* member_name = kit.argument(nargs - 1);
1248 if (member_name->Opcode() == Op_ConP) {
1249 input_not_const = false;
1250 const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
1251 ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget();
1252
1253 if (!ciMethod::is_consistent_info(callee, target)) {
1254 print_inlining_failure(C, callee, jvms, "signatures mismatch");
1255 return nullptr;
1256 }
1257
1258 // In lambda forms we erase signature types to avoid resolving issues
1259 // involving class loaders. When we optimize a method handle invoke
1260 // to a direct call we must cast the receiver and arguments to its
1261 // actual types.
1262 ciSignature* signature = target->signature();
1263 const int receiver_skip = target->is_static() ? 0 : 1;
1264 // Cast receiver to its type.
1265 if (!target->is_static()) {
1266 Node* recv = kit.argument(0);
1267 Node* casted_recv = kit.maybe_narrow_object_type(recv, signature->accessing_klass(), target->receiver_maybe_larval());
1268 if (casted_recv->is_top()) {
1269 print_inlining_failure(C, callee, jvms, "argument types mismatch");
1270 return nullptr; // FIXME: effectively dead; issue a halt node instead
1271 } else if (casted_recv != recv) {
1272 kit.set_argument(0, casted_recv);
1273 }
1274 }
1275 // Cast reference arguments to its type.
1276 for (int i = 0, j = 0; i < signature->count(); i++) {
1277 ciType* t = signature->type_at(i);
1278 if (t->is_klass()) {
1279 Node* arg = kit.argument(receiver_skip + j);
1280 Node* casted_arg = kit.maybe_narrow_object_type(arg, t->as_klass(), false);
1281 if (casted_arg->is_top()) {
1282 print_inlining_failure(C, callee, jvms, "argument types mismatch");
1283 return nullptr; // FIXME: effectively dead; issue a halt node instead
1284 } else if (casted_arg != arg) {
1285 kit.set_argument(receiver_skip + j, casted_arg);
1286 }
1287 }
1288 j += t->size(); // long and double take two slots
1289 }
1290
1291 // Try to get the most accurate receiver type
1292 const bool is_virtual = (iid == vmIntrinsics::_linkToVirtual);
1293 const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
1294 int vtable_index = Method::invalid_vtable_index;
1295 bool call_does_dispatch = false;
1296
1297 ciKlass* speculative_receiver_type = nullptr;
1298 if (is_virtual_or_interface) {
1299 ciInstanceKlass* klass = target->holder();
1300 Node* receiver_node = kit.argument(0);
1301 const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
1302 // call_does_dispatch and vtable_index are out-parameters. They might be changed.
1303 // optimize_virtual_call() takes 2 different holder
1304 // arguments for a corner case that doesn't apply here (see
1305 // Parse::do_call())
1306 target = C->optimize_virtual_call(caller, klass, klass,
1307 target, receiver_type, is_virtual,
1308 call_does_dispatch, vtable_index, // out-parameters
1309 false /* check_access */);
1310 // We lack profiling at this call but type speculation may
1311 // provide us with a type
1312 speculative_receiver_type = (receiver_type != nullptr) ? receiver_type->speculative_type() : nullptr;
1313 }
1314 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms,
1315 allow_inline,
1316 PROB_ALWAYS,
1317 speculative_receiver_type,
1318 true);
1319 return cg;
1320 } else {
1321 print_inlining_failure(C, callee, jvms, "member_name not constant");
1322 }
1323 } break;
1324
1325 case vmIntrinsics::_linkToNative:
1326 print_inlining_failure(C, callee, jvms, "native call");
1327 break;
1328
1329 default:
1330 fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
1331 break;
1332 }
1333 return nullptr;
1334 }
1335
1336 //------------------------PredicatedIntrinsicGenerator------------------------------
1337 // Internal class which handles all predicated Intrinsic calls.
1338 class PredicatedIntrinsicGenerator : public CallGenerator {
1370 // do_intrinsic(0)
1371 // else
1372 // if (predicate(1))
1373 // do_intrinsic(1)
1374 // ...
1375 // else
1376 // do_java_comp
1377
1378 GraphKit kit(jvms);
1379 PhaseGVN& gvn = kit.gvn();
1380
1381 CompileLog* log = kit.C->log();
1382 if (log != nullptr) {
1383 log->elem("predicated_intrinsic bci='%d' method='%d'",
1384 jvms->bci(), log->identify(method()));
1385 }
1386
1387 if (!method()->is_static()) {
1388 // We need an explicit receiver null_check before checking its type in predicate.
1389 // We share a map with the caller, so his JVMS gets adjusted.
1390 kit.null_check_receiver_before_call(method());
1391 if (kit.stopped()) {
1392 return kit.transfer_exceptions_into_jvms();
1393 }
1394 }
1395
1396 int n_predicates = _intrinsic->predicates_count();
1397 assert(n_predicates > 0, "sanity");
1398
1399 JVMState** result_jvms = NEW_RESOURCE_ARRAY(JVMState*, (n_predicates+1));
1400
1401 // Region for normal compilation code if intrinsic failed.
1402 Node* slow_region = new RegionNode(1);
1403
1404 int results = 0;
1405 for (int predicate = 0; (predicate < n_predicates) && !kit.stopped(); predicate++) {
1406 #ifdef ASSERT
1407 JVMState* old_jvms = kit.jvms();
1408 SafePointNode* old_map = kit.map();
1409 Node* old_io = old_map->i_o();
1410 Node* old_mem = old_map->memory();
|