GCLocker has private bool _doing_gc. It is set to true around the gclocker call to heap()->collect() in jni_unlock. The only reference is in jni_lock, where it is used to extend the wait that conditionally blocks entry to the critical region. But all _doing_gc is doing there is effectively extending the blocking period from active && needs_gc to also include inactive && needs_gc, i.e. making the blocking period the same as the needs_gc period. So the blocking predicate can be changed to needs_gc() and the _doing_gc flag can then be removed.