[Nestmates] RFR (XS) 8193112: [Nestmates] Remove nestmate access check from invokespecial interface invocation check

David Holmes david.holmes at oracle.com
Wed Dec 6 20:46:13 UTC 2017


Thanks Karen!

David

On 7/12/2017 12:17 AM, Karen Kinnear wrote:
> Thanks David.
> 
> To the best of my understanding this reverts linktime_special_method to pre-nestmates which
> is correct.
> 
> Good catch,
> Karen
>> On Dec 5, 2017, at 11:37 PM, David Holmes <david.holmes at oracle.com> wrote:
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8193112
>> webrev: http://cr.openjdk.java.net/~dholmes/8193112/webrev/
>>
>> While working on test coverage I discovered this leftover code fragment from the initial invokespecial changes. The nestmate access check is not reachable in this context, with correctly verified code, and so the change is reverted to the original code.
>>
>> Thanks,
>> David
>>
>> -- old/src/hotspot/share/interpreter/linkResolver.cpp	2017-12-05 23:33:03.756495932 -0500
>> +++ new/src/hotspot/share/interpreter/linkResolver.cpp	2017-12-05 23:33:01.616373994 -0500
>> @@ -1146,8 +1146,7 @@
>>      return NULL;
>>    }
>>
>> -  // check that invokespecial's interface method reference is in a direct superinterface,
>> -  // unless we are dealing with nestmates.
>> +  // check that invokespecial's interface method reference is in an indirect superinterface
>>    Klass* current_klass = link_info.current_klass();
>>    if (current_klass != NULL && resolved_klass->is_interface()) {
>>      InstanceKlass* ck = InstanceKlass::cast(current_klass);
>> @@ -1159,13 +1158,11 @@
>> SystemDictionary::reflect_MagicAccessorImpl_klass());
>>
>>      if (!is_reflect &&
>> -        !klass_to_check->is_same_or_direct_interface(resolved_klass) &&
>> -        (ck == klass_to_check && // don't check nestmate access for anonymous classes
>> - !klass_to_check->has_nestmate_access_to(InstanceKlass::cast(resolved_klass), THREAD))) {
>> +        !klass_to_check->is_same_or_direct_interface(resolved_klass)) {
>>        ResourceMark rm(THREAD);
>>        char buf[200];
>>        jio_snprintf(buf, sizeof(buf),
>> -                   "Interface method reference: %s, is not in a direct superinterface of %s",
>> +                   "Interface method reference: %s, is in an indirect superinterface of %s",
>>                     Method::name_and_sig_as_C_string(resolved_klass,
>>     resolved_method->name(),
>>     resolved_method->signature()),
> 


More information about the valhalla-dev mailing list