src/share/vm/memory/gcLocker.inline.hpp

changeset 6619
9c3dc501b5eb
parent 3576
ad3b47344802
child 6876
710a3c8b516e
equal deleted inserted replaced
6618:cb1b723cbca8 6619:9c3dc501b5eb
25 #ifndef SHARE_VM_MEMORY_GCLOCKER_INLINE_HPP 25 #ifndef SHARE_VM_MEMORY_GCLOCKER_INLINE_HPP
26 #define SHARE_VM_MEMORY_GCLOCKER_INLINE_HPP 26 #define SHARE_VM_MEMORY_GCLOCKER_INLINE_HPP
27 27
28 #include "memory/gcLocker.hpp" 28 #include "memory/gcLocker.hpp"
29 29
30 inline void GC_locker::lock() {
31 // cast away volatile
32 Atomic::inc(&_lock_count);
33 CHECK_UNHANDLED_OOPS_ONLY(
34 if (CheckUnhandledOops) { Thread::current()->_gc_locked_out_count++; })
35 assert(Universe::heap() == NULL ||
36 !Universe::heap()->is_gc_active(), "locking failed");
37 }
38
39 inline void GC_locker::unlock() {
40 // cast away volatile
41 Atomic::dec(&_lock_count);
42 CHECK_UNHANDLED_OOPS_ONLY(
43 if (CheckUnhandledOops) { Thread::current()->_gc_locked_out_count--; })
44 }
45
46 inline void GC_locker::lock_critical(JavaThread* thread) { 30 inline void GC_locker::lock_critical(JavaThread* thread) {
47 if (!thread->in_critical()) { 31 if (!thread->in_critical()) {
48 if (needs_gc()) { 32 if (needs_gc()) {
49 // jni_lock call calls enter_critical under the lock so that the 33 // jni_lock call calls enter_critical under the lock so that the
50 // global lock count and per thread count are in agreement. 34 // global lock count and per thread count are in agreement.

mercurial