RFR: JDK-8269650: Optimize gc-locker in [Get|Release]StringCritical for latin string
Thomas Schatzl
tschatzl at openjdk.java.net
Wed Jun 30 12:35:07 UTC 2021
On Wed, 30 Jun 2021 11:55:49 GMT, Hamlin Li <mli at openjdk.org> wrote:
> Currently, JNI GetStringCritical locks gc locker for all strings including latin and non-latin until ReleaseStringCritical.
> But for latin, it's not necessary to still lock gc locker after GetStringCritical, as it's copied anyway whether obj pining is supported or not, so it's fine to unlock gc locker after GetStringCritical.
Actually I think the *String* object can be unlocked regardless of `is_latin1` or not. The code returns the *char array* that the native code is going to process after all - which is not locked *at all* but probably should be. I filed [JDK-8269661](https://bugs.openjdk.java.net/browse/JDK-8269661) for this.
Which should probably be fixed first, because if the change correctly unconditionally unlocked the String object, Shenandoah would start to fail.
It probably works at this time because the String object and the char array are typically located in the same region anyway.
-------------
Changes requested by tschatzl (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4637
More information about the hotspot-dev
mailing list