< prev index next >
src/share/vm/memory/gcLocker.hpp
Print this page
@@ -222,26 +222,40 @@
Thread *_thread;
public:
#ifdef ASSERT
No_Safepoint_Verifier(bool activated = true, bool verifygc = true ) :
No_GC_Verifier(verifygc),
- _activated(activated) {
+ _activated(false) {
_thread = Thread::current();
- if (_activated) {
+ if (activated) {
+ enable();
+ }
+ }
+
+ void enable() {
+ assert(!_activated, "expected");
_thread->_allow_allocation_count++;
_thread->_allow_safepoint_count++;
+ _activated = true;
}
+
+ void disable() {
+ assert(_activated, "expected");
+ _thread->_allow_allocation_count--;
+ _thread->_allow_safepoint_count--;
+ _activated = false;
}
~No_Safepoint_Verifier() {
if (_activated) {
- _thread->_allow_allocation_count--;
- _thread->_allow_safepoint_count--;
+ disable();
}
}
#else
No_Safepoint_Verifier(bool activated = true, bool verifygc = true) : No_GC_Verifier(verifygc){}
+ void enable() {}
+ void disable() {}
~No_Safepoint_Verifier() {}
#endif
};
// A Pause_No_Safepoint_Verifier is used to temporarily pause the
< prev index next >