663 // static invocation mode is required for _linkToVirtual, etc.: 664 ref_kind == JVM_REF_invokeStatic)) { 665 vmIntrinsics::ID iid = signature_polymorphic_name_id(name); 666 if (iid != vmIntrinsics::_none && 667 ((ref_kind == JVM_REF_invokeStatic) == is_signature_polymorphic_static(iid))) { 668 // Virtual methods invoke and invokeExact, plus internal invokers like _invokeBasic. 669 // For a static reference it could an internal linkage routine like _linkToVirtual, etc. 670 mh_invoke_id = iid; 671 } 672 } 673 674 // convert the external string or reflective type to an internal signature 675 TempNewSymbol type = lookup_signature(type_str(), (mh_invoke_id != vmIntrinsics::_none), CHECK_(empty)); 676 if (type == NULL) return empty; // no such signature exists in the VM 677 678 // Time to do the lookup. 679 switch (flags & ALL_KINDS) { 680 case IS_METHOD: 681 { 682 CallInfo result; 683 LinkInfo link_info(defc, name, type, caller, caller.not_null()); 684 { 685 assert(!HAS_PENDING_EXCEPTION, ""); 686 if (ref_kind == JVM_REF_invokeStatic) { 687 LinkResolver::resolve_static_call(result, 688 link_info, false, THREAD); 689 } else if (ref_kind == JVM_REF_invokeInterface) { 690 LinkResolver::resolve_interface_call(result, Handle(), defc, 691 link_info, false, THREAD); 692 } else if (mh_invoke_id != vmIntrinsics::_none) { 693 assert(!is_signature_polymorphic_static(mh_invoke_id), ""); 694 LinkResolver::resolve_handle_call(result, link_info, THREAD); 695 } else if (ref_kind == JVM_REF_invokeSpecial) { 696 LinkResolver::resolve_special_call(result, 697 link_info, THREAD); 698 } else if (ref_kind == JVM_REF_invokeVirtual) { 699 LinkResolver::resolve_virtual_call(result, Handle(), defc, 700 link_info, false, THREAD); 701 } else { 702 assert(false, "ref_kind=%d", ref_kind); 703 } 704 if (HAS_PENDING_EXCEPTION) { 705 return empty; 706 } 707 } 708 if (result.resolved_appendix().not_null()) { 709 // The resolved MemberName must not be accompanied by an appendix argument, 710 // since there is no way to bind this value into the MemberName. 711 // Caller is responsible to prevent this from happening. 712 THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty); 713 } 714 oop mname2 = init_method_MemberName(mname, result); 715 return Handle(THREAD, mname2); 716 } 717 case IS_CONSTRUCTOR: 718 { 719 CallInfo result; 720 LinkInfo link_info(defc, name, type, caller, caller.not_null()); 721 { 722 assert(!HAS_PENDING_EXCEPTION, ""); 723 if (name == vmSymbols::object_initializer_name()) { 724 LinkResolver::resolve_special_call(result, link_info, THREAD); 725 } else { 726 break; // will throw after end of switch 727 } 728 if (HAS_PENDING_EXCEPTION) { 729 return empty; 730 } 731 } 732 assert(result.is_statically_bound(), ""); 733 oop mname2 = init_method_MemberName(mname, result); 734 return Handle(THREAD, mname2); 735 } 736 case IS_FIELD: 737 { 738 fieldDescriptor result; // find_field initializes fd if found 739 { 740 assert(!HAS_PENDING_EXCEPTION, ""); 741 LinkInfo link_info(defc, name, type, caller, /*check_access*/false); 742 LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD); 743 if (HAS_PENDING_EXCEPTION) { 744 return empty; 745 } 746 } 747 oop mname2 = init_field_MemberName(mname, result, ref_kind_is_setter(ref_kind)); 748 return Handle(THREAD, mname2); 749 } 750 default: 751 THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty); 752 } 753 754 return empty; 755 } 756 757 // Conversely, a member name which is only initialized from JVM internals 758 // may have null defc, name, and type fields. 759 // Resolving it plants a vmtarget/vmindex in it, 760 // which refers directly to JVM internals. 761 void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) { | 663 // static invocation mode is required for _linkToVirtual, etc.: 664 ref_kind == JVM_REF_invokeStatic)) { 665 vmIntrinsics::ID iid = signature_polymorphic_name_id(name); 666 if (iid != vmIntrinsics::_none && 667 ((ref_kind == JVM_REF_invokeStatic) == is_signature_polymorphic_static(iid))) { 668 // Virtual methods invoke and invokeExact, plus internal invokers like _invokeBasic. 669 // For a static reference it could an internal linkage routine like _linkToVirtual, etc. 670 mh_invoke_id = iid; 671 } 672 } 673 674 // convert the external string or reflective type to an internal signature 675 TempNewSymbol type = lookup_signature(type_str(), (mh_invoke_id != vmIntrinsics::_none), CHECK_(empty)); 676 if (type == NULL) return empty; // no such signature exists in the VM 677 678 // Time to do the lookup. 679 switch (flags & ALL_KINDS) { 680 case IS_METHOD: 681 { 682 CallInfo result; 683 LinkInfo link_info(defc, name, type, caller); 684 { 685 assert(!HAS_PENDING_EXCEPTION, ""); 686 if (ref_kind == JVM_REF_invokeStatic) { 687 LinkResolver::resolve_static_call(result, 688 link_info, false, THREAD); 689 } else if (ref_kind == JVM_REF_invokeInterface) { 690 LinkResolver::resolve_interface_call(result, Handle(), defc, 691 link_info, false, THREAD); 692 } else if (mh_invoke_id != vmIntrinsics::_none) { 693 assert(!is_signature_polymorphic_static(mh_invoke_id), ""); 694 LinkResolver::resolve_handle_call(result, link_info, THREAD); 695 } else if (ref_kind == JVM_REF_invokeSpecial) { 696 LinkResolver::resolve_special_call(result, 697 link_info, THREAD); 698 } else if (ref_kind == JVM_REF_invokeVirtual) { 699 LinkResolver::resolve_virtual_call(result, Handle(), defc, 700 link_info, false, THREAD); 701 } else { 702 assert(false, "ref_kind=%d", ref_kind); 703 } 704 if (HAS_PENDING_EXCEPTION) { 705 return empty; 706 } 707 } 708 if (result.resolved_appendix().not_null()) { 709 // The resolved MemberName must not be accompanied by an appendix argument, 710 // since there is no way to bind this value into the MemberName. 711 // Caller is responsible to prevent this from happening. 712 THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty); 713 } 714 oop mname2 = init_method_MemberName(mname, result); 715 return Handle(THREAD, mname2); 716 } 717 case IS_CONSTRUCTOR: 718 { 719 CallInfo result; 720 LinkInfo link_info(defc, name, type, caller); 721 { 722 assert(!HAS_PENDING_EXCEPTION, ""); 723 if (name == vmSymbols::object_initializer_name()) { 724 LinkResolver::resolve_special_call(result, link_info, THREAD); 725 } else { 726 break; // will throw after end of switch 727 } 728 if (HAS_PENDING_EXCEPTION) { 729 return empty; 730 } 731 } 732 assert(result.is_statically_bound(), ""); 733 oop mname2 = init_method_MemberName(mname, result); 734 return Handle(THREAD, mname2); 735 } 736 case IS_FIELD: 737 { 738 fieldDescriptor result; // find_field initializes fd if found 739 { 740 assert(!HAS_PENDING_EXCEPTION, ""); 741 LinkInfo link_info(defc, name, type, caller, LinkInfo::skip_access_check); 742 LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD); 743 if (HAS_PENDING_EXCEPTION) { 744 return empty; 745 } 746 } 747 oop mname2 = init_field_MemberName(mname, result, ref_kind_is_setter(ref_kind)); 748 return Handle(THREAD, mname2); 749 } 750 default: 751 THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty); 752 } 753 754 return empty; 755 } 756 757 // Conversely, a member name which is only initialized from JVM internals 758 // may have null defc, name, and type fields. 759 // Resolving it plants a vmtarget/vmindex in it, 760 // which refers directly to JVM internals. 761 void MethodHandles::expand_MemberName(Handle mname, int suppress, TRAPS) { |