RFR: 8261031: Move some ClassLoader name checking to native/VM [v3]

Claes Redestad redestad at openjdk.java.net
Thu Feb 11 12:44:54 UTC 2021


On Thu, 4 Feb 2021 13:14:16 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Consolidate verifyClassname and verifyFixClassname
>
> Changes requested by coleenp (Reviewer).

I tried to consolidate all name checking into the native layer for the remaining methods, but there are places where we are calling the JNI code with internalized names directly through `JavaLangAccess.defineClass`, so we'd need a way to differentiate these. Seems simpler to leave the `checkName` in `preDefineClass` for now.

For the JNI code consolidating verifyFixClassname and verifyClassname into a single method seems to be the most straightforward simplification possible, since these are currently called back to back. Since ASCII like `/` is never a component of a multibyte character in UTF-8 we can do the fix-up pass without validation, then do the full verification. This simplifies the code and might speed it up marginally.

Also added some cleanup to the cleanup code as suggested by @tstuefe in #2407

-------------

PR: https://git.openjdk.java.net/jdk/pull/2378


More information about the core-libs-dev mailing list