701 // static invocation mode is required for _linkToVirtual, etc.: 702 ref_kind == JVM_REF_invokeStatic)) { 703 vmIntrinsics::ID iid = signature_polymorphic_name_id(name); 704 if (iid != vmIntrinsics::_none && 705 ((ref_kind == JVM_REF_invokeStatic) == is_signature_polymorphic_static(iid))) { 706 // Virtual methods invoke and invokeExact, plus internal invokers like _invokeBasic. 707 // For a static reference it could an internal linkage routine like _linkToVirtual, etc. 708 mh_invoke_id = iid; 709 } 710 } 711 712 // convert the external string or reflective type to an internal signature 713 TempNewSymbol type = lookup_signature(type_str(), (mh_invoke_id != vmIntrinsics::_none), CHECK_(empty)); 714 if (type == NULL) return empty; // no such signature exists in the VM 715 716 // Time to do the lookup. 717 switch (flags & ALL_KINDS) { 718 case IS_METHOD: 719 { 720 CallInfo result; 721 LinkInfo link_info(defc, name, type, caller, caller.not_null()); 722 { 723 assert(!HAS_PENDING_EXCEPTION, ""); 724 if (ref_kind == JVM_REF_invokeStatic) { 725 LinkResolver::resolve_static_call(result, 726 link_info, false, THREAD); 727 } else if (ref_kind == JVM_REF_invokeInterface) { 728 LinkResolver::resolve_interface_call(result, Handle(), defc, 729 link_info, false, THREAD); 730 } else if (mh_invoke_id != vmIntrinsics::_none) { 731 assert(!is_signature_polymorphic_static(mh_invoke_id), ""); 732 LinkResolver::resolve_handle_call(result, link_info, THREAD); 733 } else if (ref_kind == JVM_REF_invokeSpecial) { 734 LinkResolver::resolve_special_call(result, 735 link_info, THREAD); 736 } else if (ref_kind == JVM_REF_invokeVirtual) { 737 LinkResolver::resolve_virtual_call(result, Handle(), defc, 738 link_info, false, THREAD); 739 } else { 740 assert(false, "ref_kind=%d", ref_kind); 741 } 742 if (HAS_PENDING_EXCEPTION) { 743 return empty; 744 } 745 } 746 if (result.resolved_appendix().not_null()) { 747 // The resolved MemberName must not be accompanied by an appendix argument, 748 // since there is no way to bind this value into the MemberName. 749 // Caller is responsible to prevent this from happening. 750 THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty); 751 } 752 oop mname2 = init_method_MemberName(mname, result); 753 return Handle(THREAD, mname2); 754 } 755 case IS_CONSTRUCTOR: 756 { 757 CallInfo result; 758 LinkInfo link_info(defc, name, type, caller, caller.not_null()); 759 { 760 assert(!HAS_PENDING_EXCEPTION, ""); 761 if (name == vmSymbols::object_initializer_name()) { 762 LinkResolver::resolve_special_call(result, link_info, THREAD); 763 } else { 764 break; // will throw after end of switch 765 } 766 if (HAS_PENDING_EXCEPTION) { 767 return empty; 768 } 769 } 770 assert(result.is_statically_bound(), ""); 771 oop mname2 = init_method_MemberName(mname, result); 772 return Handle(THREAD, mname2); 773 } 774 case IS_FIELD: 775 { 776 fieldDescriptor result; // find_field initializes fd if found 777 { 778 assert(!HAS_PENDING_EXCEPTION, ""); 779 LinkInfo link_info(defc, name, type, caller, /*check_access*/false); 780 LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD); 781 if (HAS_PENDING_EXCEPTION) { 782 return empty; 783 } 784 } 785 oop mname2 = init_field_MemberName(mname, result, ref_kind_is_setter(ref_kind)); 786 return Handle(THREAD, mname2); 787 } 788 default: 789 THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty); 790 } 791 792 return empty; 793 } 794 795 // Conversely, a member name which is only initialized from JVM internals 796 // may have null defc, name, and type fields. 797 // Resolving it plants a vmtarget/vmindex in it, 798 // which refers directly to JVM internals. 799 void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) { | 701 // static invocation mode is required for _linkToVirtual, etc.: 702 ref_kind == JVM_REF_invokeStatic)) { 703 vmIntrinsics::ID iid = signature_polymorphic_name_id(name); 704 if (iid != vmIntrinsics::_none && 705 ((ref_kind == JVM_REF_invokeStatic) == is_signature_polymorphic_static(iid))) { 706 // Virtual methods invoke and invokeExact, plus internal invokers like _invokeBasic. 707 // For a static reference it could an internal linkage routine like _linkToVirtual, etc. 708 mh_invoke_id = iid; 709 } 710 } 711 712 // convert the external string or reflective type to an internal signature 713 TempNewSymbol type = lookup_signature(type_str(), (mh_invoke_id != vmIntrinsics::_none), CHECK_(empty)); 714 if (type == NULL) return empty; // no such signature exists in the VM 715 716 // Time to do the lookup. 717 switch (flags & ALL_KINDS) { 718 case IS_METHOD: 719 { 720 CallInfo result; 721 LinkInfo link_info(defc, name, type, caller, NULL, caller.not_null()); 722 { 723 assert(!HAS_PENDING_EXCEPTION, ""); 724 if (ref_kind == JVM_REF_invokeStatic) { 725 LinkResolver::resolve_static_call(result, 726 link_info, false, THREAD); 727 } else if (ref_kind == JVM_REF_invokeInterface) { 728 LinkResolver::resolve_interface_call(result, Handle(), defc, 729 link_info, false, THREAD); 730 } else if (mh_invoke_id != vmIntrinsics::_none) { 731 assert(!is_signature_polymorphic_static(mh_invoke_id), ""); 732 LinkResolver::resolve_handle_call(result, link_info, THREAD); 733 } else if (ref_kind == JVM_REF_invokeSpecial) { 734 LinkResolver::resolve_special_call(result, 735 link_info, THREAD); 736 } else if (ref_kind == JVM_REF_invokeVirtual) { 737 LinkResolver::resolve_virtual_call(result, Handle(), defc, 738 link_info, false, THREAD); 739 } else { 740 assert(false, "ref_kind=%d", ref_kind); 741 } 742 if (HAS_PENDING_EXCEPTION) { 743 return empty; 744 } 745 } 746 if (result.resolved_appendix().not_null()) { 747 // The resolved MemberName must not be accompanied by an appendix argument, 748 // since there is no way to bind this value into the MemberName. 749 // Caller is responsible to prevent this from happening. 750 THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty); 751 } 752 oop mname2 = init_method_MemberName(mname, result); 753 return Handle(THREAD, mname2); 754 } 755 case IS_CONSTRUCTOR: 756 { 757 CallInfo result; 758 LinkInfo link_info(defc, name, type, caller, NULL, caller.not_null()); 759 { 760 assert(!HAS_PENDING_EXCEPTION, ""); 761 if (name == vmSymbols::object_initializer_name()) { 762 LinkResolver::resolve_special_call(result, link_info, THREAD); 763 } else { 764 break; // will throw after end of switch 765 } 766 if (HAS_PENDING_EXCEPTION) { 767 return empty; 768 } 769 } 770 assert(result.is_statically_bound(), ""); 771 oop mname2 = init_method_MemberName(mname, result); 772 return Handle(THREAD, mname2); 773 } 774 case IS_FIELD: 775 { 776 fieldDescriptor result; // find_field initializes fd if found 777 { 778 assert(!HAS_PENDING_EXCEPTION, ""); 779 LinkInfo link_info(defc, name, type, caller, NULL, /*check_access*/false); 780 LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD); 781 if (HAS_PENDING_EXCEPTION) { 782 return empty; 783 } 784 } 785 oop mname2 = init_field_MemberName(mname, result, ref_kind_is_setter(ref_kind)); 786 return Handle(THREAD, mname2); 787 } 788 default: 789 THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty); 790 } 791 792 return empty; 793 } 794 795 // Conversely, a member name which is only initialized from JVM internals 796 // may have null defc, name, and type fields. 797 // Resolving it plants a vmtarget/vmindex in it, 798 // which refers directly to JVM internals. 799 void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) { |