412 op->evaluation_mode());
413 }
414
415 // Last access of info in _cur_vm_operation!
416 bool c_heap_allocated = op->is_cheap_allocated();
417
418 // Mark as completed
419 if (!op->evaluate_concurrently()) {
420 op->calling_thread()->increment_vm_operation_completed_count();
421 }
422 // It is unsafe to access the _cur_vm_operation after the 'increment_vm_operation_completed_count' call,
423 // since if it is stack allocated the calling thread might have deallocated
424 if (c_heap_allocated) {
425 delete _cur_vm_operation;
426 }
427 }
428
429 static VM_None safepointALot_op("SafepointALot");
430 static VM_Cleanup cleanup_op;
431
432 class HandshakeALotTC : public ThreadClosure {
433 public:
434 virtual void do_thread(Thread* thread) {
435 #ifdef ASSERT
436 assert(thread->is_Java_thread(), "must be");
437 JavaThread* jt = (JavaThread*)thread;
438 jt->verify_states_for_handshake();
439 #endif
440 }
441 };
442
443 VM_Operation* VMThread::no_op_safepoint() {
444 // Check for handshakes first since we may need to return a VMop.
445 if (HandshakeALot) {
446 HandshakeALotTC haltc;
447 Handshake::execute(&haltc);
448 }
449 // Check for a cleanup before SafepointALot to keep stats correct.
450 long interval_ms = SafepointTracing::time_since_last_safepoint_ms();
451 bool max_time_exceeded = GuaranteedSafepointInterval != 0 &&
452 (interval_ms >= GuaranteedSafepointInterval);
453 if (max_time_exceeded && SafepointSynchronize::is_cleanup_needed()) {
454 return &cleanup_op;
455 }
456 if (SafepointALot) {
457 return &safepointALot_op;
458 }
459 // Nothing to be done.
460 return NULL;
461 }
462
463 void VMThread::loop() {
464 assert(_cur_vm_operation == NULL, "no current one should be executing");
465
466 SafepointSynchronize::init(_vm_thread);
467
|
412 op->evaluation_mode());
413 }
414
415 // Last access of info in _cur_vm_operation!
416 bool c_heap_allocated = op->is_cheap_allocated();
417
418 // Mark as completed
419 if (!op->evaluate_concurrently()) {
420 op->calling_thread()->increment_vm_operation_completed_count();
421 }
422 // It is unsafe to access the _cur_vm_operation after the 'increment_vm_operation_completed_count' call,
423 // since if it is stack allocated the calling thread might have deallocated
424 if (c_heap_allocated) {
425 delete _cur_vm_operation;
426 }
427 }
428
429 static VM_None safepointALot_op("SafepointALot");
430 static VM_Cleanup cleanup_op;
431
432 class HandshakeALotHS : public HandshakeOperation {
433 public:
434 const char* name() { return "HandshakeALot"; };
435 void do_thread(JavaThread* jt) {
436 #ifdef ASSERT
437 jt->verify_states_for_handshake();
438 #endif
439 }
440 };
441
442 VM_Operation* VMThread::no_op_safepoint() {
443 // Check for handshakes first since we may need to return a VMop.
444 if (HandshakeALot) {
445 HandshakeALotHS halhs;
446 Handshake::execute(&halhs);
447 }
448 // Check for a cleanup before SafepointALot to keep stats correct.
449 long interval_ms = SafepointTracing::time_since_last_safepoint_ms();
450 bool max_time_exceeded = GuaranteedSafepointInterval != 0 &&
451 (interval_ms >= GuaranteedSafepointInterval);
452 if (max_time_exceeded && SafepointSynchronize::is_cleanup_needed()) {
453 return &cleanup_op;
454 }
455 if (SafepointALot) {
456 return &safepointALot_op;
457 }
458 // Nothing to be done.
459 return NULL;
460 }
461
462 void VMThread::loop() {
463 assert(_cur_vm_operation == NULL, "no current one should be executing");
464
465 SafepointSynchronize::init(_vm_thread);
466
|