812 813 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) { 814 GraphKit kit(jvms); 815 PhaseGVN& gvn = kit.gvn(); 816 Compile* C = kit.C; 817 vmIntrinsics::ID iid = callee->intrinsic_id(); 818 input_not_const = true; 819 switch (iid) { 820 case vmIntrinsics::_invokeBasic: 821 { 822 // Get MethodHandle receiver: 823 Node* receiver = kit.argument(0); 824 if (receiver->Opcode() == Op_ConP) { 825 input_not_const = false; 826 const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr(); 827 ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget(); 828 guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove 829 const int vtable_index = Method::invalid_vtable_index; 830 CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, true, true); 831 assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 832 return cg; 833 } else { 834 const char* msg = "receiver not constant"; 835 if (PrintInlining) C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg); 836 C->log_inline_failure(msg); 837 } 838 } 839 break; 840 841 case vmIntrinsics::_linkToVirtual: 842 case vmIntrinsics::_linkToStatic: 843 case vmIntrinsics::_linkToSpecial: 844 case vmIntrinsics::_linkToInterface: 845 { 846 // Get MemberName argument: 847 Node* member_name = kit.argument(callee->arg_size() - 1); 848 if (member_name->Opcode() == Op_ConP) { 849 input_not_const = false; 850 const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr(); 851 ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget(); 852 | 812 813 CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) { 814 GraphKit kit(jvms); 815 PhaseGVN& gvn = kit.gvn(); 816 Compile* C = kit.C; 817 vmIntrinsics::ID iid = callee->intrinsic_id(); 818 input_not_const = true; 819 switch (iid) { 820 case vmIntrinsics::_invokeBasic: 821 { 822 // Get MethodHandle receiver: 823 Node* receiver = kit.argument(0); 824 if (receiver->Opcode() == Op_ConP) { 825 input_not_const = false; 826 const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr(); 827 ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget(); 828 guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove 829 const int vtable_index = Method::invalid_vtable_index; 830 CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, NULL, true, true); 831 assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here"); 832 // Don't replace MH::invokeBasic adapter call with a direct call for non-inlined case. 833 // It doesn't play well with LambdaForm customization. Unless the target LambdaForm 834 // has been already customized, an updated version won't be called until recompilation. 835 if (cg != NULL && cg->is_inline()) { 836 return cg; 837 } 838 } else { 839 const char* msg = "receiver not constant"; 840 if (PrintInlining) C->print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg); 841 C->log_inline_failure(msg); 842 } 843 } 844 break; 845 846 case vmIntrinsics::_linkToVirtual: 847 case vmIntrinsics::_linkToStatic: 848 case vmIntrinsics::_linkToSpecial: 849 case vmIntrinsics::_linkToInterface: 850 { 851 // Get MemberName argument: 852 Node* member_name = kit.argument(callee->arg_size() - 1); 853 if (member_name->Opcode() == Op_ConP) { 854 input_not_const = false; 855 const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr(); 856 ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget(); 857 |