< prev index next >

src/hotspot/share/runtime/safepointVerifiers.cpp

Print this page

        

*** 21,78 **** * questions. * */ #include "precompiled.hpp" - #include "runtime/safepointVerifiers.hpp" #include "gc/shared/collectedHeap.hpp" #include "memory/universe.hpp" #include "utilities/debug.hpp" - // Implementation of NoGCVerifier - #ifdef ASSERT ! NoGCVerifier::NoGCVerifier(bool verifygc) { ! _verifygc = verifygc; ! if (_verifygc) { ! CollectedHeap* h = Universe::heap(); ! assert(!h->is_gc_active(), "GC active during NoGCVerifier"); ! _old_invocations = h->total_collections(); ! } } ! ! NoGCVerifier::~NoGCVerifier() { ! if (_verifygc) { ! CollectedHeap* h = Universe::heap(); ! assert(!h->is_gc_active(), "GC active during NoGCVerifier"); ! if (_old_invocations != h->total_collections()) { ! fatal("collection in a NoGCVerifier secured function"); ! } ! } } ! PauseNoGCVerifier::PauseNoGCVerifier(NoGCVerifier * ngcv) { ! _ngcv = ngcv; ! if (_ngcv->_verifygc) { ! // if we were verifying, then make sure that nothing is ! // wrong before we "pause" verification ! CollectedHeap* h = Universe::heap(); ! assert(!h->is_gc_active(), "GC active during NoGCVerifier"); ! if (_ngcv->_old_invocations != h->total_collections()) { ! fatal("collection in a NoGCVerifier secured function"); ! } ! } } ! ! PauseNoGCVerifier::~PauseNoGCVerifier() { ! if (_ngcv->_verifygc) { ! // if we were verifying before, then reenable verification ! CollectedHeap* h = Universe::heap(); ! assert(!h->is_gc_active(), "GC active during NoGCVerifier"); ! _ngcv->_old_invocations = h->total_collections(); ! } } ! ! #endif --- 21,51 ---- * questions. * */ #include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" #include "memory/universe.hpp" + #include "runtime/safepoint.hpp" + #include "runtime/safepointVerifiers.hpp" #include "utilities/debug.hpp" #ifdef ASSERT ! NoSafepointVerifier::NoSafepointVerifier() : _thread(Thread::current()) { ! _thread->_allow_safepoint_count++; } ! NoSafepointVerifier::~NoSafepointVerifier() { ! _thread->_allow_safepoint_count--; } ! PauseNoSafepointVerifier::PauseNoSafepointVerifier(NoSafepointVerifier* nsv) ! : _nsv(nsv) { ! assert(_nsv->_thread == Thread::current(), "must be"); ! _nsv->_thread->_allow_safepoint_count--; } ! PauseNoSafepointVerifier::~PauseNoSafepointVerifier() { ! _nsv->_thread->_allow_safepoint_count++; } ! #endif // ASSERT
< prev index next >