< prev index next >
src/hotspot/share/gc/shared/concurrentGCPhaseManager.cpp
Print this page
*** 48,113 ****
_stack(stack)
{
assert_ConcurrentGC_thread();
assert_not_enter_unconstrained(phase);
assert(stack != NULL, "precondition");
! MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
if (stack->_top != NULL) {
assert(stack->_top->_active, "precondition");
_prev = stack->_top;
}
stack->_top = this;
ml.notify_all();
}
ConcurrentGCPhaseManager::~ConcurrentGCPhaseManager() {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
assert_manager_is_tos(this, _stack, "This");
wait_when_requested_impl();
_stack->_top = _prev;
ml.notify_all();
}
bool ConcurrentGCPhaseManager::is_requested() const {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
assert_manager_is_tos(this, _stack, "This");
return _active && (_stack->_requested_phase == _phase);
}
bool ConcurrentGCPhaseManager::wait_when_requested_impl() const {
assert_ConcurrentGC_thread();
assert_lock_strong(CGCPhaseManager_lock);
bool waited = false;
while (_active && (_stack->_requested_phase == _phase)) {
waited = true;
CGCPhaseManager_lock->wait(Mutex::_no_safepoint_check_flag);
}
return waited;
}
bool ConcurrentGCPhaseManager::wait_when_requested() const {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
assert_manager_is_tos(this, _stack, "This");
return wait_when_requested_impl();
}
void ConcurrentGCPhaseManager::set_phase(int phase, bool force) {
assert_ConcurrentGC_thread();
assert_not_enter_unconstrained(phase);
! MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
assert_manager_is_tos(this, _stack, "This");
if (!force) wait_when_requested_impl();
_phase = phase;
ml.notify_all();
}
void ConcurrentGCPhaseManager::deactivate() {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
assert_manager_is_tos(this, _stack, "This");
_active = false;
ml.notify_all();
}
--- 48,114 ----
_stack(stack)
{
assert_ConcurrentGC_thread();
assert_not_enter_unconstrained(phase);
assert(stack != NULL, "precondition");
! MonitorLockerEx ml(CGCPhaseManager_lock);
if (stack->_top != NULL) {
assert(stack->_top->_active, "precondition");
_prev = stack->_top;
}
stack->_top = this;
ml.notify_all();
}
ConcurrentGCPhaseManager::~ConcurrentGCPhaseManager() {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock);
assert_manager_is_tos(this, _stack, "This");
wait_when_requested_impl();
_stack->_top = _prev;
ml.notify_all();
}
bool ConcurrentGCPhaseManager::is_requested() const {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock);
assert_manager_is_tos(this, _stack, "This");
return _active && (_stack->_requested_phase == _phase);
}
bool ConcurrentGCPhaseManager::wait_when_requested_impl() const {
assert_ConcurrentGC_thread();
assert_lock_strong(CGCPhaseManager_lock);
bool waited = false;
while (_active && (_stack->_requested_phase == _phase)) {
waited = true;
+ // wait safepoint check should be a property of the thread type also.
CGCPhaseManager_lock->wait(Mutex::_no_safepoint_check_flag);
}
return waited;
}
bool ConcurrentGCPhaseManager::wait_when_requested() const {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock);
assert_manager_is_tos(this, _stack, "This");
return wait_when_requested_impl();
}
void ConcurrentGCPhaseManager::set_phase(int phase, bool force) {
assert_ConcurrentGC_thread();
assert_not_enter_unconstrained(phase);
! MonitorLockerEx ml(CGCPhaseManager_lock);
assert_manager_is_tos(this, _stack, "This");
if (!force) wait_when_requested_impl();
_phase = phase;
ml.notify_all();
}
void ConcurrentGCPhaseManager::deactivate() {
assert_ConcurrentGC_thread();
! MonitorLockerEx ml(CGCPhaseManager_lock);
assert_manager_is_tos(this, _stack, "This");
_active = false;
ml.notify_all();
}
< prev index next >