RFR: 8284811: Shrink critical section of JNICritical_lock [v2]

Albert Mingkun Yang ayang at openjdk.java.net
Mon Apr 18 09:20:51 UTC 2022


On Wed, 13 Apr 2022 21:39:41 GMT, David Holmes <dholmes at openjdk.org> wrote:

> I think I agree that _debug_jni_lock_count is not really adding anything ... but perhaps there is a subtlety we are overlooking. Digging into the history of the code may shed more light.

I tracked it down to https://bugs.openjdk.java.net/browse/JDK-7129164. `_debug_jni_lock_count` tracks #threads in critical-region all the time, while `_jni_lock_count` tracks the same info but is valid only inside a safepoint. The `!needs_gc() ||` prefix seems to suggest the `_jni_lock_count` is valid only in the presence of a pending GC request. However, the currently implementation of safepoint mechanism calculates the correct value of `_jni_lock_count` unconditionally.

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

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



More information about the hotspot-gc-dev mailing list