src/share/vm/memory/gcLocker.hpp

Print this page

        

*** 52,90 **** // currently in a critical region. It's only kept up to date when // _needs_gc is true. The current value is computed during // safepointing and decremented during the slow path of GC_locker // unlocking. static volatile jint _jni_lock_count; // number of jni active instances. - - static volatile jint _lock_count; // number of other active instances static volatile bool _needs_gc; // heap is filling, we need a GC // note: bool is typedef'd as jint static volatile bool _doing_gc; // unlock_critical() is doing a GC #ifdef ASSERT // This lock count is updated for all operations and is used to // validate the jni_lock_count that is computed during safepoints. static volatile jint _debug_jni_lock_count; #endif - // Accessors - static bool is_jni_active() { - assert(_needs_gc, "only valid when _needs_gc is set"); - return _jni_lock_count > 0; - } - // At a safepoint, visit all threads and count the number of active // critical sections. This is used to ensure that all active // critical sections are exited before a new one is started. static void verify_critical_count() NOT_DEBUG_RETURN; static void jni_lock(JavaThread* thread); static void jni_unlock(JavaThread* thread); static bool is_active_internal() { verify_critical_count(); ! return _lock_count > 0 || _jni_lock_count > 0; } public: // Accessors static bool is_active() { --- 52,82 ---- // currently in a critical region. It's only kept up to date when // _needs_gc is true. The current value is computed during // safepointing and decremented during the slow path of GC_locker // unlocking. static volatile jint _jni_lock_count; // number of jni active instances. static volatile bool _needs_gc; // heap is filling, we need a GC // note: bool is typedef'd as jint static volatile bool _doing_gc; // unlock_critical() is doing a GC #ifdef ASSERT // This lock count is updated for all operations and is used to // validate the jni_lock_count that is computed during safepoints. static volatile jint _debug_jni_lock_count; #endif // At a safepoint, visit all threads and count the number of active // critical sections. This is used to ensure that all active // critical sections are exited before a new one is started. static void verify_critical_count() NOT_DEBUG_RETURN; static void jni_lock(JavaThread* thread); static void jni_unlock(JavaThread* thread); static bool is_active_internal() { verify_critical_count(); ! return _jni_lock_count > 0; } public: // Accessors static bool is_active() {
*** 130,143 **** // JNICritical_lock, so the caller may not safely assert upon // return from this method that "!needs_gc()" since that is // not a stable predicate. static void stall_until_clear(); - // Non-structured GC locking: currently needed for JNI. Use with care! - static void lock(); - static void unlock(); - // The following two methods are used for JNI critical regions. // If we find that we failed to perform a GC because the GC_locker // was active, arrange for one as soon as possible by allowing // all threads in critical regions to complete, but not allowing // other critical regions to be entered. The reasons for that are: --- 122,131 ----