equal
deleted
inserted
replaced
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. |