- Factor GC_locker::lock_critical and GC_locker::unlock_critical into fast
path and slow path. The fast path isn't protected by JNICritical_lock.
jni_lock() and jni_unlock() are changed to be atomic operations.
- Nested cases are optimized so no jni_lock()/jni_unlock() are done.
- Instead of being set during heap expansion, GC_locker::_needs_gc is set
when a GC attempt is aborted because GC_locker is active. _needs_gc is
also only set at a safepoint.
- A GC_locker::_doing_gc is added to prevent starvation from happening when
MutexUnlocker in unlock_critical() drops JNICritical_lock and can be grabbed
by lock_critical() immediately.