[Nestmates] RFR: 8187768 and 8189940 - nest host resolution and exceptions
David Holmes
david.holmes at oracle.com
Fri Oct 27 08:04:49 UTC 2017
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
- 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