hotspot/src/share/vm/memory/gcLocker.cpp
changeset 25351 7c198a690050
parent 24424 2658d7834c6e
child 30154 39cd4e2ccf1c
--- a/hotspot/src/share/vm/memory/gcLocker.cpp	Thu Jun 19 13:31:14 2014 +0200
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp	Wed Jun 04 11:56:44 2014 +0200
@@ -26,6 +26,7 @@
 #include "memory/gcLocker.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/sharedHeap.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
 volatile jint GC_locker::_jni_lock_count = 0;
@@ -59,6 +60,17 @@
     assert(_jni_lock_count == count, "must be equal");
   }
 }
+
+// In debug mode track the locking state at all times
+void GC_locker::increment_debug_jni_lock_count() {
+  assert(_debug_jni_lock_count >= 0, "bad value");
+  Atomic::inc(&_debug_jni_lock_count);
+}
+
+void GC_locker::decrement_debug_jni_lock_count() {
+  assert(_debug_jni_lock_count > 0, "bad value");
+  Atomic::dec(&_debug_jni_lock_count);
+}
 #endif
 
 bool GC_locker::check_active_before_gc() {