895 SystemDictionary::Object_klass()) { |
895 SystemDictionary::Object_klass()) { |
896 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec |
896 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec |
897 // (see also CallInfo::set_interface for details) |
897 // (see also CallInfo::set_interface for details) |
898 assert(info.call_kind() == CallInfo::vtable_call || |
898 assert(info.call_kind() == CallInfo::vtable_call || |
899 info.call_kind() == CallInfo::direct_call, ""); |
899 info.call_kind() == CallInfo::direct_call, ""); |
900 methodHandle rm = info.resolved_method(); |
900 Method* rm = info.resolved_method(); |
901 assert(rm->is_final() || info.has_vtable_index(), |
901 assert(rm->is_final() || info.has_vtable_index(), |
902 "should have been set already"); |
902 "should have been set already"); |
903 } else if (!info.resolved_method()->has_itable_index()) { |
903 } else if (!info.resolved_method()->has_itable_index()) { |
904 // Resolved something like CharSequence.toString. Use vtable not itable. |
904 // Resolved something like CharSequence.toString. Use vtable not itable. |
905 assert(info.call_kind() != CallInfo::itable_call, ""); |
905 assert(info.call_kind() != CallInfo::itable_call, ""); |
919 // Get sender or sender's unsafe_anonymous_host, and only set cpCache entry to resolved if |
919 // Get sender or sender's unsafe_anonymous_host, and only set cpCache entry to resolved if |
920 // it is not an interface. The receiver for invokespecial calls within interface |
920 // it is not an interface. The receiver for invokespecial calls within interface |
921 // methods must be checked for every call. |
921 // methods must be checked for every call. |
922 InstanceKlass* sender = pool->pool_holder(); |
922 InstanceKlass* sender = pool->pool_holder(); |
923 sender = sender->is_unsafe_anonymous() ? sender->unsafe_anonymous_host() : sender; |
923 sender = sender->is_unsafe_anonymous() ? sender->unsafe_anonymous_host() : sender; |
|
924 methodHandle resolved_method(THREAD, info.resolved_method()); |
924 |
925 |
925 switch (info.call_kind()) { |
926 switch (info.call_kind()) { |
926 case CallInfo::direct_call: |
927 case CallInfo::direct_call: |
927 cp_cache_entry->set_direct_call( |
928 cp_cache_entry->set_direct_call( |
928 bytecode, |
929 bytecode, |
929 info.resolved_method(), |
930 resolved_method, |
930 sender->is_interface()); |
931 sender->is_interface()); |
931 break; |
932 break; |
932 case CallInfo::vtable_call: |
933 case CallInfo::vtable_call: |
933 cp_cache_entry->set_vtable_call( |
934 cp_cache_entry->set_vtable_call( |
934 bytecode, |
935 bytecode, |
935 info.resolved_method(), |
936 resolved_method, |
936 info.vtable_index()); |
937 info.vtable_index()); |
937 break; |
938 break; |
938 case CallInfo::itable_call: |
939 case CallInfo::itable_call: |
939 cp_cache_entry->set_itable_call( |
940 cp_cache_entry->set_itable_call( |
940 bytecode, |
941 bytecode, |
941 info.resolved_klass(), |
942 info.resolved_klass(), |
942 info.resolved_method(), |
943 resolved_method, |
943 info.itable_index()); |
944 info.itable_index()); |
944 break; |
945 break; |
945 default: ShouldNotReachHere(); |
946 default: ShouldNotReachHere(); |
946 } |
947 } |
947 } |
948 } |