hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
changeset 24094 5dbf1f44de18
parent 24093 095cc0a63ed9
child 24331 c0bc7e5653fb
equal deleted inserted replaced
24093:095cc0a63ed9 24094:5dbf1f44de18
   192         VM_CGC_Operation op(&cl_cl, "GC cleanup", false /* needs_pll */);
   192         VM_CGC_Operation op(&cl_cl, "GC cleanup", false /* needs_pll */);
   193         VMThread::execute(&op);
   193         VMThread::execute(&op);
   194       } else {
   194       } else {
   195         // We don't want to update the marking status if a GC pause
   195         // We don't want to update the marking status if a GC pause
   196         // is already underway.
   196         // is already underway.
   197         _sts.join();
   197         SuspendibleThreadSetJoiner sts;
   198         g1h->set_marking_complete();
   198         g1h->set_marking_complete();
   199         _sts.leave();
       
   200       }
   199       }
   201 
   200 
   202       // Check if cleanup set the free_regions_coming flag. If it
   201       // Check if cleanup set the free_regions_coming flag. If it
   203       // hasn't, we can just skip the next step.
   202       // hasn't, we can just skip the next step.
   204       if (g1h->free_regions_coming()) {
   203       if (g1h->free_regions_coming()) {
   264       // abort() will have completed and has_aborted() will return
   263       // abort() will have completed and has_aborted() will return
   265       // true to prevent us from calling
   264       // true to prevent us from calling
   266       // record_concurrent_mark_cleanup_completed() (and, in fact, it's
   265       // record_concurrent_mark_cleanup_completed() (and, in fact, it's
   267       // not needed any more as the concurrent mark state has been
   266       // not needed any more as the concurrent mark state has been
   268       // already reset).
   267       // already reset).
   269       _sts.join();
   268       {
   270       if (!cm()->has_aborted()) {
   269         SuspendibleThreadSetJoiner sts;
   271         g1_policy->record_concurrent_mark_cleanup_completed();
   270         if (!cm()->has_aborted()) {
   272       }
   271           g1_policy->record_concurrent_mark_cleanup_completed();
   273       _sts.leave();
   272         }
       
   273       }
   274 
   274 
   275       if (cm()->has_aborted()) {
   275       if (cm()->has_aborted()) {
   276         if (G1Log::fine()) {
   276         if (G1Log::fine()) {
   277           gclog_or_tty->date_stamp(PrintGCDateStamps);
   277           gclog_or_tty->date_stamp(PrintGCDateStamps);
   278           gclog_or_tty->stamp(PrintGCTimeStamps);
   278           gclog_or_tty->stamp(PrintGCTimeStamps);
   280         }
   280         }
   281       }
   281       }
   282 
   282 
   283       // We now want to allow clearing of the marking bitmap to be
   283       // We now want to allow clearing of the marking bitmap to be
   284       // suspended by a collection pause.
   284       // suspended by a collection pause.
   285       _sts.join();
   285       {
   286       _cm->clearNextBitmap();
   286         SuspendibleThreadSetJoiner sts;
   287       _sts.leave();
   287         _cm->clearNextBitmap();
       
   288       }
   288     }
   289     }
   289 
   290 
   290     // Update the number of full collections that have been
   291     // Update the number of full collections that have been
   291     // completed. This will also notify the FullGCCount_lock in case a
   292     // completed. This will also notify the FullGCCount_lock in case a
   292     // Java thread is waiting for a full GC to happen (e.g., it
   293     // Java thread is waiting for a full GC to happen (e.g., it
   293     // called System.gc() with +ExplicitGCInvokesConcurrent).
   294     // called System.gc() with +ExplicitGCInvokesConcurrent).
   294     _sts.join();
   295     {
   295     g1h->increment_old_marking_cycles_completed(true /* concurrent */);
   296       SuspendibleThreadSetJoiner sts;
   296     g1h->register_concurrent_cycle_end();
   297       g1h->increment_old_marking_cycles_completed(true /* concurrent */);
   297     _sts.leave();
   298       g1h->register_concurrent_cycle_end();
       
   299     }
   298   }
   300   }
   299   assert(_should_terminate, "just checking");
   301   assert(_should_terminate, "just checking");
   300 
   302 
   301   terminate();
   303   terminate();
   302 }
       
   303 
       
   304 
       
   305 void ConcurrentMarkThread::yield() {
       
   306   _sts.yield("Concurrent Mark");
       
   307 }
   304 }
   308 
   305 
   309 void ConcurrentMarkThread::stop() {
   306 void ConcurrentMarkThread::stop() {
   310   {
   307   {
   311     MutexLockerEx ml(Terminator_lock);
   308     MutexLockerEx ml(Terminator_lock);