src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

Print this page
rev 4168 : 8005602: NPG: classunloading does not happen while CMS GC with -XX:+CMSClassUnloadingEnabled is used
Summary: Call purge() on CLDG after sweep(), reorder purge() call in GenCollectedHeap and enable some additional logging
Reviewed-by:


 169 
 170 //////////////////////////////////////////////////////////////////
 171 //  Concurrent Mark-Sweep Generation /////////////////////////////
 172 //////////////////////////////////////////////////////////////////
 173 
 174 NOT_PRODUCT(CompactibleFreeListSpace* debug_cms_space;)
 175 
 176 // This struct contains per-thread things necessary to support parallel
 177 // young-gen collection.
 178 class CMSParGCThreadState: public CHeapObj<mtGC> {
 179  public:
 180   CFLS_LAB lab;
 181   PromotionInfo promo;
 182 
 183   // Constructor.
 184   CMSParGCThreadState(CompactibleFreeListSpace* cfls) : lab(cfls) {
 185     promo.setSpace(cfls);
 186   }
 187 };
 188 






 189 ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
 190      ReservedSpace rs, size_t initial_byte_size, int level,
 191      CardTableRS* ct, bool use_adaptive_freelists,
 192      FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
 193   CardGeneration(rs, initial_byte_size, level, ct),
 194   _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
 195   _debug_collection_type(Concurrent_collection_type)
 196 {
 197   HeapWord* bottom = (HeapWord*) _virtual_space.low();
 198   HeapWord* end    = (HeapWord*) _virtual_space.high();
 199 
 200   _direct_allocated_words = 0;
 201   NOT_PRODUCT(
 202     _numObjectsPromoted = 0;
 203     _numWordsPromoted = 0;
 204     _numObjectsAllocated = 0;
 205     _numWordsAllocated = 0;
 206   )
 207 
 208   _cmsSpace = new CompactibleFreeListSpace(_bts, MemRegion(bottom, end),


2147     } else {
2148       assert(_collectorState == Idling, "Should be idling before start.");
2149       _collectorState = InitialMarking;
2150       // Reset the expansion cause, now that we are about to begin
2151       // a new cycle.
2152       clear_expansion_cause();
2153 
2154       // Clear the MetaspaceGC flag since a concurrent collection
2155       // is starting but also clear it after the collection.
2156       MetaspaceGC::set_should_concurrent_collect(false);
2157     }
2158     // Decide if we want to enable class unloading as part of the
2159     // ensuing concurrent GC cycle.
2160     update_should_unload_classes();
2161     _full_gc_requested = false;           // acks all outstanding full gc requests
2162     // Signal that we are about to start a collection
2163     gch->increment_total_full_collections();  // ... starting a collection cycle
2164     _collection_count_start = gch->total_full_collections();
2165   }
2166 
2167   // Used for PrintGC
2168   size_t prev_used;
2169   if (PrintGC && Verbose) {
2170     prev_used = _cmsGen->used(); // XXXPERM


2171   }
2172 
2173   // The change of the collection state is normally done at this level;
2174   // the exceptions are phases that are executed while the world is
2175   // stopped.  For those phases the change of state is done while the
2176   // world is stopped.  For baton passing purposes this allows the
2177   // background collector to finish the phase and change state atomically.
2178   // The foreground collector cannot wait on a phase that is done
2179   // while the world is stopped because the foreground collector already
2180   // has the world stopped and would deadlock.
2181   while (_collectorState != Idling) {
2182     if (TraceCMSState) {
2183       gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d",
2184         Thread::current(), _collectorState);
2185     }
2186     // The foreground collector
2187     //   holds the Heap_lock throughout its collection.
2188     //   holds the CMS token (but not the lock)
2189     //     except while it is waiting for the background collector to yield.
2190     //


2301         // Stop the timers for adaptive size policy for the concurrent phases
2302         if (UseAdaptiveSizePolicy) {
2303           size_policy()->concurrent_sweeping_end();
2304           size_policy()->concurrent_phases_end(gch->gc_cause(),
2305                                              gch->prev_gen(_cmsGen)->capacity(),
2306                                              _cmsGen->free());
2307         }
2308 
2309       case Resizing: {
2310         // Sweeping has been completed...
2311         // At this point the background collection has completed.
2312         // Don't move the call to compute_new_size() down
2313         // into code that might be executed if the background
2314         // collection was preempted.
2315         {
2316           ReleaseForegroundGC x(this);   // unblock FG collection
2317           MutexLockerEx       y(Heap_lock, Mutex::_no_safepoint_check_flag);
2318           CMSTokenSync        z(true);   // not strictly needed.
2319           if (_collectorState == Resizing) {
2320             compute_new_size();









2321             _collectorState = Resetting;
2322           } else {
2323             assert(_collectorState == Idling, "The state should only change"
2324                    " because the foreground collector has finished the collection");
2325           }
2326         }
2327         break;
2328       }
2329       case Resetting:
2330         // CMS heap resizing has been completed
2331         reset(true);
2332         assert(_collectorState == Idling, "Collector state should "
2333           "have changed");
2334 
2335         MetaspaceGC::set_should_concurrent_collect(false);
2336 
2337         stats().record_cms_end();
2338         // Don't move the concurrent_phases_end() and compute_new_size()
2339         // calls to here because a preempted background collection
2340         // has it's state set to "Resetting".


2354   // Should this be in gc_epilogue?
2355   collector_policy()->counters()->update_counters();
2356 
2357   {
2358     // Clear _foregroundGCShouldWait and, in the event that the
2359     // foreground collector is waiting, notify it, before
2360     // returning.
2361     MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
2362     _foregroundGCShouldWait = false;
2363     if (_foregroundGCIsActive) {
2364       CGC_lock->notify();
2365     }
2366     assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
2367            "Possible deadlock");
2368   }
2369   if (TraceCMSState) {
2370     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
2371       " exiting collection CMS state %d",
2372       Thread::current(), _collectorState);
2373   }
2374   if (PrintGC && Verbose) {
2375     _cmsGen->print_heap_change(prev_used);
2376   }
2377 }
2378 
2379 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
2380   assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
2381          "Foreground collector should be waiting, not executing");
2382   assert(Thread::current()->is_VM_thread(), "A foreground collection"
2383     "may only be done by the VM Thread with the world stopped");
2384   assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
2385          "VM thread should have CMS token");
2386 
2387   NOT_PRODUCT(TraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
2388     true, gclog_or_tty);)
2389   if (UseAdaptiveSizePolicy) {
2390     size_policy()->ms_collection_begin();
2391   }
2392   COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
2393 
2394   HandleMark hm;  // Discard invalid handles created during verification
2395 
2396   if (VerifyBeforeGC &&


3347 
3348 bool ConcurrentMarkSweepGeneration::grow_to_reserved() {
3349   assert_locked_or_safepoint(Heap_lock);
3350   bool success = true;
3351   const size_t remaining_bytes = _virtual_space.uncommitted_size();
3352   if (remaining_bytes > 0) {
3353     success = grow_by(remaining_bytes);
3354     DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
3355   }
3356   return success;
3357 }
3358 
3359 void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) {
3360   assert_locked_or_safepoint(Heap_lock);
3361   assert_lock_strong(freelistLock());
3362   // XXX Fix when compaction is implemented.
3363   warning("Shrinking of CMS not yet implemented");
3364   return;
3365 }
3366 









3367 
3368 // Simple ctor/dtor wrapper for accounting & timer chores around concurrent
3369 // phases.
3370 class CMSPhaseAccounting: public StackObj {
3371  public:
3372   CMSPhaseAccounting(CMSCollector *collector,
3373                      const char *phase,
3374                      bool print_cr = true);
3375   ~CMSPhaseAccounting();
3376 
3377  private:
3378   CMSCollector *_collector;
3379   const char *_phase;
3380   elapsedTimer _wallclock;
3381   bool _print_cr;
3382 
3383  public:
3384   // Not MT-safe; so do not pass around these StackObj's
3385   // where they may be accessed by other threads.
3386   jlong wallclock_millis() {
3387     assert(_wallclock.is_active(), "Wall clock should not stop");
3388     _wallclock.stop();  // to record time
3389     jlong ret = _wallclock.milliseconds();
3390     _wallclock.start(); // restart
3391     return ret;
3392   }
3393 };
3394 
3395 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
3396                                        const char *phase,
3397                                        bool print_cr) :

3398   _collector(collector), _phase(phase), _print_cr(print_cr) {
3399 
3400   if (PrintCMSStatistics != 0) {
3401     _collector->resetYields();
3402   }
3403   if (PrintGCDetails && PrintGCTimeStamps) {
3404     gclog_or_tty->date_stamp(PrintGCDateStamps);
3405     gclog_or_tty->stamp();
3406     gclog_or_tty->print_cr(": [%s-concurrent-%s-start]",
3407       _collector->cmsGen()->short_name(), _phase);
3408   }
3409   _collector->resetTimer();
3410   _wallclock.start();
3411   _collector->startTimer();
3412 }
3413 
3414 CMSPhaseAccounting::~CMSPhaseAccounting() {
3415   assert(_wallclock.is_active(), "Wall clock should not have stopped");
3416   _collector->stopTimer();
3417   _wallclock.stop();
3418   if (PrintGCDetails) {
3419     gclog_or_tty->date_stamp(PrintGCDateStamps);
3420     gclog_or_tty->stamp(PrintGCTimeStamps);
3421     gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]",
3422                  _collector->cmsGen()->short_name(),
3423                  _phase, _collector->timerValue(), _wallclock.seconds());
3424     if (_print_cr) {
3425       gclog_or_tty->print_cr("");
3426     }


6055     // We need all the free list locks to make the abstract state
6056     // transition from Sweeping to Resetting. See detailed note
6057     // further below.
6058     {
6059       CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock());
6060       // Update heap occupancy information which is used as
6061       // input to soft ref clearing policy at the next gc.
6062       Universe::update_heap_info_at_gc();
6063       _collectorState = Resizing;
6064     }
6065   } else {
6066     // already have needed locks
6067     sweepWork(_cmsGen,  asynch);
6068     // Update heap occupancy information which is used as
6069     // input to soft ref clearing policy at the next gc.
6070     Universe::update_heap_info_at_gc();
6071     _collectorState = Resizing;
6072   }
6073   verify_work_stacks_empty();
6074   verify_overflow_empty();




6075 
6076   _intra_sweep_timer.stop();
6077   _intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
6078 
6079   _inter_sweep_timer.reset();
6080   _inter_sweep_timer.start();
6081 
6082   // We need to use a monotonically non-deccreasing time in ms
6083   // or we will see time-warp warnings and os::javaTimeMillis()
6084   // does not guarantee monotonicity.
6085   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
6086   update_time_of_last_gc(now);
6087 
6088   // NOTE on abstract state transitions:
6089   // Mutators allocate-live and/or mark the mod-union table dirty
6090   // based on the state of the collection.  The former is done in
6091   // the interval [Marking, Sweeping] and the latter in the interval
6092   // [Marking, Sweeping).  Thus the transitions into the Marking state
6093   // and out of the Sweeping state must be synchronously visible
6094   // globally to the mutators.




 169 
 170 //////////////////////////////////////////////////////////////////
 171 //  Concurrent Mark-Sweep Generation /////////////////////////////
 172 //////////////////////////////////////////////////////////////////
 173 
 174 NOT_PRODUCT(CompactibleFreeListSpace* debug_cms_space;)
 175 
 176 // This struct contains per-thread things necessary to support parallel
 177 // young-gen collection.
 178 class CMSParGCThreadState: public CHeapObj<mtGC> {
 179  public:
 180   CFLS_LAB lab;
 181   PromotionInfo promo;
 182 
 183   // Constructor.
 184   CMSParGCThreadState(CompactibleFreeListSpace* cfls) : lab(cfls) {
 185     promo.setSpace(cfls);
 186   }
 187 };
 188 
 189 class CMSPhaseTracing: public StackObj {
 190  public:
 191   CMSPhaseTracing(bool print, const char* phase);
 192   ~CMSPhaseTracing();
 193 };
 194 
 195 ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
 196      ReservedSpace rs, size_t initial_byte_size, int level,
 197      CardTableRS* ct, bool use_adaptive_freelists,
 198      FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
 199   CardGeneration(rs, initial_byte_size, level, ct),
 200   _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
 201   _debug_collection_type(Concurrent_collection_type)
 202 {
 203   HeapWord* bottom = (HeapWord*) _virtual_space.low();
 204   HeapWord* end    = (HeapWord*) _virtual_space.high();
 205 
 206   _direct_allocated_words = 0;
 207   NOT_PRODUCT(
 208     _numObjectsPromoted = 0;
 209     _numWordsPromoted = 0;
 210     _numObjectsAllocated = 0;
 211     _numWordsAllocated = 0;
 212   )
 213 
 214   _cmsSpace = new CompactibleFreeListSpace(_bts, MemRegion(bottom, end),


2153     } else {
2154       assert(_collectorState == Idling, "Should be idling before start.");
2155       _collectorState = InitialMarking;
2156       // Reset the expansion cause, now that we are about to begin
2157       // a new cycle.
2158       clear_expansion_cause();
2159 
2160       // Clear the MetaspaceGC flag since a concurrent collection
2161       // is starting but also clear it after the collection.
2162       MetaspaceGC::set_should_concurrent_collect(false);
2163     }
2164     // Decide if we want to enable class unloading as part of the
2165     // ensuing concurrent GC cycle.
2166     update_should_unload_classes();
2167     _full_gc_requested = false;           // acks all outstanding full gc requests
2168     // Signal that we are about to start a collection
2169     gch->increment_total_full_collections();  // ... starting a collection cycle
2170     _collection_count_start = gch->total_full_collections();
2171   }
2172 
2173   // Used for PrintGCDetails
2174   size_t prev_used = 0;
2175   size_t metaspace_pre_unloading = 0;
2176   if (PrintGCDetails) {
2177     prev_used = _cmsGen->used();
2178     metaspace_pre_unloading = MetaspaceAux::used_in_bytes();
2179   }
2180 
2181   // The change of the collection state is normally done at this level;
2182   // the exceptions are phases that are executed while the world is
2183   // stopped.  For those phases the change of state is done while the
2184   // world is stopped.  For baton passing purposes this allows the
2185   // background collector to finish the phase and change state atomically.
2186   // The foreground collector cannot wait on a phase that is done
2187   // while the world is stopped because the foreground collector already
2188   // has the world stopped and would deadlock.
2189   while (_collectorState != Idling) {
2190     if (TraceCMSState) {
2191       gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d",
2192         Thread::current(), _collectorState);
2193     }
2194     // The foreground collector
2195     //   holds the Heap_lock throughout its collection.
2196     //   holds the CMS token (but not the lock)
2197     //     except while it is waiting for the background collector to yield.
2198     //


2309         // Stop the timers for adaptive size policy for the concurrent phases
2310         if (UseAdaptiveSizePolicy) {
2311           size_policy()->concurrent_sweeping_end();
2312           size_policy()->concurrent_phases_end(gch->gc_cause(),
2313                                              gch->prev_gen(_cmsGen)->capacity(),
2314                                              _cmsGen->free());
2315         }
2316 
2317       case Resizing: {
2318         // Sweeping has been completed...
2319         // At this point the background collection has completed.
2320         // Don't move the call to compute_new_size() down
2321         // into code that might be executed if the background
2322         // collection was preempted.
2323         {
2324           ReleaseForegroundGC x(this);   // unblock FG collection
2325           MutexLockerEx       y(Heap_lock, Mutex::_no_safepoint_check_flag);
2326           CMSTokenSync        z(true);   // not strictly needed.
2327           if (_collectorState == Resizing) {
2328             compute_new_size();
2329             if (PrintGCDetails) {
2330               CMSPhaseTracing pt(true, "[CMS-resizing: ");
2331               gclog_or_tty->print("[%s:", cmsGen()->short_name());
2332               cmsGen()->print_heap_change(prev_used);
2333               gclog_or_tty->print("]");
2334               MetaspaceAux::print_metaspace_change(metaspace_pre_unloading);
2335               gclog_or_tty->print_cr(" ]");
2336             }
2337 
2338             _collectorState = Resetting;
2339           } else {
2340             assert(_collectorState == Idling, "The state should only change"
2341                    " because the foreground collector has finished the collection");
2342           }
2343         }
2344         break;
2345       }
2346       case Resetting:
2347         // CMS heap resizing has been completed
2348         reset(true);
2349         assert(_collectorState == Idling, "Collector state should "
2350           "have changed");
2351 
2352         MetaspaceGC::set_should_concurrent_collect(false);
2353 
2354         stats().record_cms_end();
2355         // Don't move the concurrent_phases_end() and compute_new_size()
2356         // calls to here because a preempted background collection
2357         // has it's state set to "Resetting".


2371   // Should this be in gc_epilogue?
2372   collector_policy()->counters()->update_counters();
2373 
2374   {
2375     // Clear _foregroundGCShouldWait and, in the event that the
2376     // foreground collector is waiting, notify it, before
2377     // returning.
2378     MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
2379     _foregroundGCShouldWait = false;
2380     if (_foregroundGCIsActive) {
2381       CGC_lock->notify();
2382     }
2383     assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
2384            "Possible deadlock");
2385   }
2386   if (TraceCMSState) {
2387     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
2388       " exiting collection CMS state %d",
2389       Thread::current(), _collectorState);
2390   }



2391 }
2392 
2393 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
2394   assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
2395          "Foreground collector should be waiting, not executing");
2396   assert(Thread::current()->is_VM_thread(), "A foreground collection"
2397     "may only be done by the VM Thread with the world stopped");
2398   assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
2399          "VM thread should have CMS token");
2400 
2401   NOT_PRODUCT(TraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
2402     true, gclog_or_tty);)
2403   if (UseAdaptiveSizePolicy) {
2404     size_policy()->ms_collection_begin();
2405   }
2406   COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
2407 
2408   HandleMark hm;  // Discard invalid handles created during verification
2409 
2410   if (VerifyBeforeGC &&


3361 
3362 bool ConcurrentMarkSweepGeneration::grow_to_reserved() {
3363   assert_locked_or_safepoint(Heap_lock);
3364   bool success = true;
3365   const size_t remaining_bytes = _virtual_space.uncommitted_size();
3366   if (remaining_bytes > 0) {
3367     success = grow_by(remaining_bytes);
3368     DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
3369   }
3370   return success;
3371 }
3372 
3373 void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) {
3374   assert_locked_or_safepoint(Heap_lock);
3375   assert_lock_strong(freelistLock());
3376   // XXX Fix when compaction is implemented.
3377   warning("Shrinking of CMS not yet implemented");
3378   return;
3379 }
3380 
3381 CMSPhaseTracing::CMSPhaseTracing(bool print, const char* phase) {
3382   if (print) {
3383     gclog_or_tty->date_stamp(PrintGCDateStamps);
3384     gclog_or_tty->stamp(PrintGCTimeStamps);
3385     gclog_or_tty->print("%s", phase);
3386   }
3387 }
3388 
3389 CMSPhaseTracing::~CMSPhaseTracing() {}
3390 
3391 // Simple ctor/dtor wrapper for accounting & timer chores around concurrent
3392 // phases.
3393 class CMSPhaseAccounting: public CMSPhaseTracing {
3394  public:
3395   CMSPhaseAccounting(CMSCollector *collector,
3396                      const char *phase,
3397                      bool print_cr = true);
3398   ~CMSPhaseAccounting();
3399 
3400  private:
3401   CMSCollector *_collector;
3402   const char *_phase;
3403   elapsedTimer _wallclock;
3404   bool _print_cr;
3405 
3406  public:
3407   // Not MT-safe; so do not pass around these StackObj's
3408   // where they may be accessed by other threads.
3409   jlong wallclock_millis() {
3410     assert(_wallclock.is_active(), "Wall clock should not stop");
3411     _wallclock.stop();  // to record time
3412     jlong ret = _wallclock.milliseconds();
3413     _wallclock.start(); // restart
3414     return ret;
3415   }
3416 };
3417 
3418 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
3419                                        const char *phase,
3420                                        bool print_cr) :
3421     CMSPhaseTracing(PrintGCDetails, ""),
3422     _collector(collector), _phase(phase), _print_cr(print_cr) {
3423 
3424   if (PrintCMSStatistics != 0) {
3425     _collector->resetYields();
3426   }
3427   if (PrintGCDetails && PrintGCTimeStamps) {
3428     gclog_or_tty->print_cr("[%s-concurrent-%s-start]",


3429       _collector->cmsGen()->short_name(), _phase);
3430   }
3431   _collector->resetTimer();
3432   _wallclock.start();
3433   _collector->startTimer();
3434 }
3435 
3436 CMSPhaseAccounting::~CMSPhaseAccounting() {
3437   assert(_wallclock.is_active(), "Wall clock should not have stopped");
3438   _collector->stopTimer();
3439   _wallclock.stop();
3440   if (PrintGCDetails) {
3441     gclog_or_tty->date_stamp(PrintGCDateStamps);
3442     gclog_or_tty->stamp(PrintGCTimeStamps);
3443     gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]",
3444                  _collector->cmsGen()->short_name(),
3445                  _phase, _collector->timerValue(), _wallclock.seconds());
3446     if (_print_cr) {
3447       gclog_or_tty->print_cr("");
3448     }


6077     // We need all the free list locks to make the abstract state
6078     // transition from Sweeping to Resetting. See detailed note
6079     // further below.
6080     {
6081       CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock());
6082       // Update heap occupancy information which is used as
6083       // input to soft ref clearing policy at the next gc.
6084       Universe::update_heap_info_at_gc();
6085       _collectorState = Resizing;
6086     }
6087   } else {
6088     // already have needed locks
6089     sweepWork(_cmsGen,  asynch);
6090     // Update heap occupancy information which is used as
6091     // input to soft ref clearing policy at the next gc.
6092     Universe::update_heap_info_at_gc();
6093     _collectorState = Resizing;
6094   }
6095   verify_work_stacks_empty();
6096   verify_overflow_empty();
6097 
6098   if (should_unload_classes()) {
6099     ClassLoaderDataGraph::purge();
6100   }
6101 
6102   _intra_sweep_timer.stop();
6103   _intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
6104 
6105   _inter_sweep_timer.reset();
6106   _inter_sweep_timer.start();
6107 
6108   // We need to use a monotonically non-deccreasing time in ms
6109   // or we will see time-warp warnings and os::javaTimeMillis()
6110   // does not guarantee monotonicity.
6111   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
6112   update_time_of_last_gc(now);
6113 
6114   // NOTE on abstract state transitions:
6115   // Mutators allocate-live and/or mark the mod-union table dirty
6116   // based on the state of the collection.  The former is done in
6117   // the interval [Marking, Sweeping] and the latter in the interval
6118   // [Marking, Sweeping).  Thus the transitions into the Marking state
6119   // and out of the Sweeping state must be synchronously visible
6120   // globally to the mutators.