src/hotspot/share/gc/shared/gcLocker.inline.hpp
changeset 49594 898ef81cbc0e
parent 47216 71c04702a3d5
child 53244 9807daeb47c4
equal deleted inserted replaced
49593:4dd58ecc9912 49594:898ef81cbc0e
    24 
    24 
    25 #ifndef SHARE_VM_GC_SHARED_GCLOCKER_INLINE_HPP
    25 #ifndef SHARE_VM_GC_SHARED_GCLOCKER_INLINE_HPP
    26 #define SHARE_VM_GC_SHARED_GCLOCKER_INLINE_HPP
    26 #define SHARE_VM_GC_SHARED_GCLOCKER_INLINE_HPP
    27 
    27 
    28 #include "gc/shared/gcLocker.hpp"
    28 #include "gc/shared/gcLocker.hpp"
       
    29 #include "runtime/thread.hpp"
    29 
    30 
    30 inline void GCLocker::lock_critical(JavaThread* thread) {
    31 void GCLocker::lock_critical(JavaThread* thread) {
    31   if (!thread->in_critical()) {
    32   if (!thread->in_critical()) {
    32     if (needs_gc()) {
    33     if (needs_gc()) {
    33       // jni_lock call calls enter_critical under the lock so that the
    34       // jni_lock call calls enter_critical under the lock so that the
    34       // global lock count and per thread count are in agreement.
    35       // global lock count and per thread count are in agreement.
    35       jni_lock(thread);
    36       jni_lock(thread);
    38     increment_debug_jni_lock_count();
    39     increment_debug_jni_lock_count();
    39   }
    40   }
    40   thread->enter_critical();
    41   thread->enter_critical();
    41 }
    42 }
    42 
    43 
    43 inline void GCLocker::unlock_critical(JavaThread* thread) {
    44 void GCLocker::unlock_critical(JavaThread* thread) {
    44   if (thread->in_last_critical()) {
    45   if (thread->in_last_critical()) {
    45     if (needs_gc()) {
    46     if (needs_gc()) {
    46       // jni_unlock call calls exit_critical under the lock so that
    47       // jni_unlock call calls exit_critical under the lock so that
    47       // the global lock count and per thread count are in agreement.
    48       // the global lock count and per thread count are in agreement.
    48       jni_unlock(thread);
    49       jni_unlock(thread);