< prev index next >

src/hotspot/share/gc/z/zMark.cpp

Print this page




 470     // Limit reached or we're trying to terminate
 471     return false;
 472   }
 473 
 474   return try_flush(&_work_nproactiveflush);
 475 }
 476 
 477 bool ZMark::try_terminate() {
 478   ZStatTimer timer(ZSubPhaseConcurrentMarkTryTerminate);
 479 
 480   if (_terminate.enter_stage0()) {
 481     // Last thread entered stage 0, flush
 482     if (Atomic::load(&_work_terminateflush) &&
 483         Atomic::load(&_work_nterminateflush) != ZMarkTerminateFlushMax) {
 484       // Exit stage 0 to allow other threads to continue marking
 485       _terminate.exit_stage0();
 486 
 487       // Flush before termination
 488       if (!try_flush(&_work_nterminateflush)) {
 489         // No more work available, skip further flush attempts
 490         Atomic::store(false, &_work_terminateflush);
 491       }
 492 
 493       // Don't terminate, regardless of whether we successfully
 494       // flushed out more work or not. We've already exited
 495       // termination stage 0, to allow other threads to continue
 496       // marking, so this thread has to return false and also
 497       // make another round of attempted marking.
 498       return false;
 499     }
 500   }
 501 
 502   for (;;) {
 503     if (_terminate.enter_stage1()) {
 504       // Last thread entered stage 1, terminate
 505       return true;
 506     }
 507 
 508     // Idle to give the other threads
 509     // a chance to enter termination.
 510     idle();




 470     // Limit reached or we're trying to terminate
 471     return false;
 472   }
 473 
 474   return try_flush(&_work_nproactiveflush);
 475 }
 476 
 477 bool ZMark::try_terminate() {
 478   ZStatTimer timer(ZSubPhaseConcurrentMarkTryTerminate);
 479 
 480   if (_terminate.enter_stage0()) {
 481     // Last thread entered stage 0, flush
 482     if (Atomic::load(&_work_terminateflush) &&
 483         Atomic::load(&_work_nterminateflush) != ZMarkTerminateFlushMax) {
 484       // Exit stage 0 to allow other threads to continue marking
 485       _terminate.exit_stage0();
 486 
 487       // Flush before termination
 488       if (!try_flush(&_work_nterminateflush)) {
 489         // No more work available, skip further flush attempts
 490         Atomic::store(&_work_terminateflush, false);
 491       }
 492 
 493       // Don't terminate, regardless of whether we successfully
 494       // flushed out more work or not. We've already exited
 495       // termination stage 0, to allow other threads to continue
 496       // marking, so this thread has to return false and also
 497       // make another round of attempted marking.
 498       return false;
 499     }
 500   }
 501 
 502   for (;;) {
 503     if (_terminate.enter_stage1()) {
 504       // Last thread entered stage 1, terminate
 505       return true;
 506     }
 507 
 508     // Idle to give the other threads
 509     // a chance to enter termination.
 510     idle();


< prev index next >