src/share/vm/memory/gcLocker.hpp

changeset 9806
758c07667682
parent 6876
710a3c8b516e
parent 9787
9f28a4cac6d9
equal deleted inserted replaced
9762:c97db0855565 9806:758c07667682
24 24
25 #ifndef SHARE_VM_MEMORY_GCLOCKER_HPP 25 #ifndef SHARE_VM_MEMORY_GCLOCKER_HPP
26 #define SHARE_VM_MEMORY_GCLOCKER_HPP 26 #define SHARE_VM_MEMORY_GCLOCKER_HPP
27 27
28 #include "gc_interface/collectedHeap.hpp" 28 #include "gc_interface/collectedHeap.hpp"
29 #include "gc_interface/gcCause.hpp"
29 #include "memory/genCollectedHeap.hpp" 30 #include "memory/genCollectedHeap.hpp"
30 #include "memory/universe.hpp" 31 #include "memory/universe.hpp"
31 #include "oops/oop.hpp" 32 #include "oops/oop.hpp"
32 #include "runtime/thread.inline.hpp" 33 #include "runtime/thread.inline.hpp"
33 #ifdef TARGET_OS_FAMILY_linux 34 #ifdef TARGET_OS_FAMILY_linux
55 // unlocking. 56 // unlocking.
56 static volatile jint _jni_lock_count; // number of jni active instances. 57 static volatile jint _jni_lock_count; // number of jni active instances.
57 static volatile bool _needs_gc; // heap is filling, we need a GC 58 static volatile bool _needs_gc; // heap is filling, we need a GC
58 // note: bool is typedef'd as jint 59 // note: bool is typedef'd as jint
59 static volatile bool _doing_gc; // unlock_critical() is doing a GC 60 static volatile bool _doing_gc; // unlock_critical() is doing a GC
61 static uint _total_collections; // value for _gc_locker collection
60 62
61 #ifdef ASSERT 63 #ifdef ASSERT
62 // This lock count is updated for all operations and is used to 64 // This lock count is updated for all operations and is used to
63 // validate the jni_lock_count that is computed during safepoints. 65 // validate the jni_lock_count that is computed during safepoints.
64 static volatile jint _debug_jni_lock_count; 66 static volatile jint _debug_jni_lock_count;
113 verify_critical_count(); 115 verify_critical_count();
114 } 116 }
115 117
116 // Sets _needs_gc if is_active() is true. Returns is_active(). 118 // Sets _needs_gc if is_active() is true. Returns is_active().
117 static bool check_active_before_gc(); 119 static bool check_active_before_gc();
120
121 // Return true if the designated collection is a GCLocker request
122 // that should be discarded. Returns true if cause == GCCause::_gc_locker
123 // and the given total collection value indicates a collection has been
124 // done since the GCLocker request was made.
125 static bool should_discard(GCCause::Cause cause, uint total_collections);
118 126
119 // Stalls the caller (who should not be in a jni critical section) 127 // Stalls the caller (who should not be in a jni critical section)
120 // until needs_gc() clears. Note however that needs_gc() may be 128 // until needs_gc() clears. Note however that needs_gc() may be
121 // set at a subsequent safepoint and/or cleared under the 129 // set at a subsequent safepoint and/or cleared under the
122 // JNICritical_lock, so the caller may not safely assert upon 130 // JNICritical_lock, so the caller may not safely assert upon

mercurial