[Nestmates] RFR: 8187768 and 8189940 - nest host resolution and exceptions

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Nov 1 13:53:42 UTC 2017


Looks good - sorry for the delay.

Not sure about this message: "nest-host is not an instance class". That 
term doesn't make a lot of sense in terms of Java, nor bytecode. 
Basically, what you want to rule out here is some spurious Class_info 
which contains something that is not a class - e.g. an array type or 
even a value type. Perhaps you can rephrase by leaving out the term 
"instance" - e.g. "nest-host is not a class" ?

Maurizio


On 31/10/17 21:23, David Holmes wrote:
> As I need to move on I'll push these changes today even though no one 
> has had an opportunity to provide feedback.
>
> David
>
> On 30/10/2017 11:24 AM, David Holmes wrote:
>> On 27/10/2017 6:04 PM, David Holmes wrote:
>>> Combined webrev: http://cr.openjdk.java.net/~dholmes/8187768/webrev/
>>>
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8187768
>>>
>>> 8187768: [Nestmates] Improve exception information related to 
>>> bad/missing nest-host class
>>>
>>> This work implements the latest specification proposal for nest-host 
>>> resolution and validation exceptions:
>>>
>>> http://cr.openjdk.java.net/~dlsmith/nestmates.html
>>>
>>> and also provides better diagnostic information for the exceptions 
>>> that occur. Key features:
>>>
>>> - instanceKlass::nest_host():
>>>    - passes through most resolution related exceptions
>>>    - replaces NoClassDefFoundError with a  new NCDFE with the 
>>> original as the cause and a message "Unable to load nest-host class 
>>> of %s" to give context to the exception
>>>    - throws IllegalAccessError when nest membership validation fails 
>>> (as per updated spec) with appropriate error message
>>
>> I realized that nest_host() should only throw IllegalAccessError when 
>> called from has_nestmate_access_to(). I'll address that when adding 
>> the reflection API support.
>>
>> David
>> -----
>>
>>> - Reflection::verify_field_access can now more obviously result in 
>>> pending exceptions
>>> - All callers of Reflection::verify_field_access watch for pending 
>>> exceptions and don't replace them with their own IllegalAccessErrors.
>>> - runtime/Nestmates/membership tests have been completely rewritten 
>>> to test updated spec - including the need to test for failures in 
>>> the calling class's nest-host resolution and in the target class's 
>>> nest-host resolution.
>>>
>>> While working here I rediscovered the Xcomp problem where the JIT 
>>> tries to load a nest-host class when not allowed to:
>>>
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8189940
>>> 8189940:  [Nestmates] VM Compiler thread needs to load nest-host class!
>>>
>>> The fix here was to check in InstanceKlass::nest_host() if we are on 
>>> a thread that can't call java, and that we may have to load a 
>>> nest-host class. In that case we return NULL, causing 
>>> has_nestmate_access_to to return false, it's callers post 
>>> IllegalAccessError and the JIT sees that failure and falls back to 
>>> going through the interpreter to complete its work.
>>>
>>> runtime/Nestmates tests all pass in normal and Xcomp mode now.
>>>
>>> Thanks,
>>> David




More information about the valhalla-dev mailing list