< prev index next >
src/hotspot/share/runtime/vmThread.cpp
Print this page
rev 54213 : [mq]: 8220774-handshakealot-v3
*** 432,457 ****
}
static VM_None safepointALot_op("SafepointALot");
static VM_Cleanup cleanup_op;
! VM_Operation* VMThread::no_op_safepoint(bool check_time) {
! if (SafepointALot) {
! return &safepointALot_op;
! }
! if (!SafepointSynchronize::is_cleanup_needed()) {
! return NULL;
}
! if (check_time) {
long interval_ms = SafepointTracing::time_since_last_safepoint_ms();
bool max_time_exceeded = GuaranteedSafepointInterval != 0 &&
! (interval_ms > GuaranteedSafepointInterval);
! if (!max_time_exceeded) {
! return NULL;
}
}
! return &cleanup_op;
}
void VMThread::loop() {
assert(_cur_vm_operation == NULL, "no current one should be executing");
--- 432,470 ----
}
static VM_None safepointALot_op("SafepointALot");
static VM_Cleanup cleanup_op;
! class HandshakeALotTC : public ThreadClosure {
! public:
! virtual void do_thread(Thread* thread) {
! #ifdef ASSERT
! assert(thread->is_Java_thread(), "must be");
! JavaThread* jt = (JavaThread*)thread;
! jt->verify_states_for_handshake();
! #endif
! }
! };
!
! VM_Operation* VMThread::no_op_safepoint() {
! // Must check for handshakes first, since ops returns.
! if (HandshakeALot) {
! HandshakeALotTC haltc;
! Handshake::execute(&haltc);
}
! // Check for a true cleanup first, trying to keep stats correct.
long interval_ms = SafepointTracing::time_since_last_safepoint_ms();
bool max_time_exceeded = GuaranteedSafepointInterval != 0 &&
! (interval_ms >= GuaranteedSafepointInterval);
! if (max_time_exceeded && SafepointSynchronize::is_cleanup_needed()) {
! return &cleanup_op;
}
+ if (SafepointALot) {
+ return &safepointALot_op;
}
! // Nothing to be done.
! return NULL;
}
void VMThread::loop() {
assert(_cur_vm_operation == NULL, "no current one should be executing");
*** 489,512 ****
(os::elapsedTime() > (double)SelfDestructTimer * 60.0)) {
tty->print_cr("VM self-destructed");
exit(-1);
}
! if (timedout && (_cur_vm_operation = VMThread::no_op_safepoint(false)) != NULL) {
! MutexUnlockerEx mul(VMOperationQueue_lock,
! Mutex::_no_safepoint_check_flag);
// Force a safepoint since we have not had one for at least
! // 'GuaranteedSafepointInterval' milliseconds. This will run all
! // the clean-up processing that needs to be done regularly at a
! // safepoint
SafepointSynchronize::begin();
#ifdef ASSERT
if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
#endif
SafepointSynchronize::end();
_cur_vm_operation = NULL;
}
_cur_vm_operation = _vm_queue->remove_next();
// If we are at a safepoint we will evaluate all the operations that
// follow that also require a safepoint
if (_cur_vm_operation != NULL &&
--- 502,528 ----
(os::elapsedTime() > (double)SelfDestructTimer * 60.0)) {
tty->print_cr("VM self-destructed");
exit(-1);
}
! {
! // Have to unlock VMOperationQueue_lock just in case no_op_safepoint()
! // has to do a handshake.
! MutexUnlockerEx mul(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag);
! if (timedout && (_cur_vm_operation = VMThread::no_op_safepoint()) != NULL) {
// Force a safepoint since we have not had one for at least
! // 'GuaranteedSafepointInterval' milliseconds and we need to clean
! // something. This will run all the clean-up processing that needs
! // to be done at a safepoint.
SafepointSynchronize::begin();
#ifdef ASSERT
if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
#endif
SafepointSynchronize::end();
_cur_vm_operation = NULL;
}
+ }
_cur_vm_operation = _vm_queue->remove_next();
// If we are at a safepoint we will evaluate all the operations that
// follow that also require a safepoint
if (_cur_vm_operation != NULL &&
*** 616,626 ****
}
//
// We want to make sure that we get to a safepoint regularly.
//
! if ((_cur_vm_operation = VMThread::no_op_safepoint(false)) != NULL) {
HandleMark hm(VMThread::vm_thread());
SafepointSynchronize::begin();
SafepointSynchronize::end();
_cur_vm_operation = NULL;
}
--- 632,642 ----
}
//
// We want to make sure that we get to a safepoint regularly.
//
! if ((_cur_vm_operation = VMThread::no_op_safepoint()) != NULL) {
HandleMark hm(VMThread::vm_thread());
SafepointSynchronize::begin();
SafepointSynchronize::end();
_cur_vm_operation = NULL;
}
< prev index next >