hotspot/src/share/vm/memory/gcLocker.cpp
changeset 25351 7c198a690050
parent 24424 2658d7834c6e
child 30154 39cd4e2ccf1c
equal deleted inserted replaced
25350:6423a57e5451 25351:7c198a690050
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "memory/gcLocker.inline.hpp"
    26 #include "memory/gcLocker.inline.hpp"
    27 #include "memory/resourceArea.hpp"
    27 #include "memory/resourceArea.hpp"
    28 #include "memory/sharedHeap.hpp"
    28 #include "memory/sharedHeap.hpp"
       
    29 #include "runtime/atomic.inline.hpp"
    29 #include "runtime/thread.inline.hpp"
    30 #include "runtime/thread.inline.hpp"
    30 
    31 
    31 volatile jint GC_locker::_jni_lock_count = 0;
    32 volatile jint GC_locker::_jni_lock_count = 0;
    32 volatile bool GC_locker::_needs_gc       = false;
    33 volatile bool GC_locker::_needs_gc       = false;
    33 volatile bool GC_locker::_doing_gc       = false;
    34 volatile bool GC_locker::_doing_gc       = false;
    56         }
    57         }
    57       }
    58       }
    58     }
    59     }
    59     assert(_jni_lock_count == count, "must be equal");
    60     assert(_jni_lock_count == count, "must be equal");
    60   }
    61   }
       
    62 }
       
    63 
       
    64 // In debug mode track the locking state at all times
       
    65 void GC_locker::increment_debug_jni_lock_count() {
       
    66   assert(_debug_jni_lock_count >= 0, "bad value");
       
    67   Atomic::inc(&_debug_jni_lock_count);
       
    68 }
       
    69 
       
    70 void GC_locker::decrement_debug_jni_lock_count() {
       
    71   assert(_debug_jni_lock_count > 0, "bad value");
       
    72   Atomic::dec(&_debug_jni_lock_count);
    61 }
    73 }
    62 #endif
    74 #endif
    63 
    75 
    64 bool GC_locker::check_active_before_gc() {
    76 bool GC_locker::check_active_before_gc() {
    65   assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint");
    77   assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint");