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

Print this page




2008   ref_processor()->setup_policy(clear_all_soft_refs);
2009   // If an asynchronous collection finishes, the _modUnionTable is
2010   // all clear.  If we are assuming the collection from an asynchronous
2011   // collection, clear the _modUnionTable.
2012   assert(_collectorState != Idling || _modUnionTable.isAllClear(),
2013     "_modUnionTable should be clear if the baton was not passed");
2014   _modUnionTable.clear_all();
2015 
2016   // We must adjust the allocation statistics being maintained
2017   // in the free list space. We do so by reading and clearing
2018   // the sweep timer and updating the block flux rate estimates below.
2019   assert(!_intra_sweep_timer.is_active(), "_intra_sweep_timer should be inactive");
2020   if (_inter_sweep_timer.is_active()) {
2021     _inter_sweep_timer.stop();
2022     // Note that we do not use this sample to update the _inter_sweep_estimate.
2023     _cmsGen->cmsSpace()->beginSweepFLCensus((float)(_inter_sweep_timer.seconds()),
2024                                             _inter_sweep_estimate.padded_average(),
2025                                             _intra_sweep_estimate.padded_average());
2026   }
2027 
2028   {
2029     TraceCMSMemoryManagerStats tmms(gch->gc_cause());
2030   }
2031   GenMarkSweep::invoke_at_safepoint(_cmsGen->level(),
2032     ref_processor(), clear_all_soft_refs);
2033   #ifdef ASSERT
2034     CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
2035     size_t free_size = cms_space->free();
2036     assert(free_size ==
2037            pointer_delta(cms_space->end(), cms_space->compaction_top())
2038            * HeapWordSize,
2039       "All the free space should be compacted into one chunk at top");
2040     assert(cms_space->dictionary()->totalChunkSize(
2041                                       debug_only(cms_space->freelistLock())) == 0 ||
2042            cms_space->totalSizeInIndexedFreeLists() == 0,
2043       "All the free space should be in a single chunk");
2044     size_t num = cms_space->totalCount();
2045     assert((free_size == 0 && num == 0) ||
2046            (free_size > 0  && (num == 1 || num == 2)),
2047          "There should be at most 2 free chunks after compaction");
2048   #endif // ASSERT
2049   _collectorState = Resetting;
2050   assert(_restart_addr == NULL,


9328                  false /* countCollection */  );
9329       break;
9330 
9331     case CMSCollector::Sweeping:
9332       initialize(true  /* fullGC */ ,
9333                  cause /* cause of the GC */,
9334                  false /* recordGCBeginTime */,
9335                  false /* recordPreGCUsage */,
9336                  true  /* recordPeakUsage */,
9337                  true  /* recordPostGCusage */,
9338                  false /* recordAccumulatedGCTime */,
9339                  true  /* recordGCEndTime */,
9340                  true  /* countCollection */  );
9341       break;
9342 
9343     default:
9344       ShouldNotReachHere();
9345   }
9346 }
9347 
9348 // when bailing out of cms in concurrent mode failure
9349 TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(GCCause::Cause cause): TraceMemoryManagerStats() {
9350   initialize(true /* fullGC */ ,
9351              cause /* cause of the GC */,
9352              true /* recordGCBeginTime */,
9353              true /* recordPreGCUsage */,
9354              true /* recordPeakUsage */,
9355              true /* recordPostGCusage */,
9356              true /* recordAccumulatedGCTime */,
9357              true /* recordGCEndTime */,
9358              true /* countCollection */ );
9359 }


2008   ref_processor()->setup_policy(clear_all_soft_refs);
2009   // If an asynchronous collection finishes, the _modUnionTable is
2010   // all clear.  If we are assuming the collection from an asynchronous
2011   // collection, clear the _modUnionTable.
2012   assert(_collectorState != Idling || _modUnionTable.isAllClear(),
2013     "_modUnionTable should be clear if the baton was not passed");
2014   _modUnionTable.clear_all();
2015 
2016   // We must adjust the allocation statistics being maintained
2017   // in the free list space. We do so by reading and clearing
2018   // the sweep timer and updating the block flux rate estimates below.
2019   assert(!_intra_sweep_timer.is_active(), "_intra_sweep_timer should be inactive");
2020   if (_inter_sweep_timer.is_active()) {
2021     _inter_sweep_timer.stop();
2022     // Note that we do not use this sample to update the _inter_sweep_estimate.
2023     _cmsGen->cmsSpace()->beginSweepFLCensus((float)(_inter_sweep_timer.seconds()),
2024                                             _inter_sweep_estimate.padded_average(),
2025                                             _intra_sweep_estimate.padded_average());
2026   }
2027 



2028   GenMarkSweep::invoke_at_safepoint(_cmsGen->level(),
2029     ref_processor(), clear_all_soft_refs);
2030   #ifdef ASSERT
2031     CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
2032     size_t free_size = cms_space->free();
2033     assert(free_size ==
2034            pointer_delta(cms_space->end(), cms_space->compaction_top())
2035            * HeapWordSize,
2036       "All the free space should be compacted into one chunk at top");
2037     assert(cms_space->dictionary()->totalChunkSize(
2038                                       debug_only(cms_space->freelistLock())) == 0 ||
2039            cms_space->totalSizeInIndexedFreeLists() == 0,
2040       "All the free space should be in a single chunk");
2041     size_t num = cms_space->totalCount();
2042     assert((free_size == 0 && num == 0) ||
2043            (free_size > 0  && (num == 1 || num == 2)),
2044          "There should be at most 2 free chunks after compaction");
2045   #endif // ASSERT
2046   _collectorState = Resetting;
2047   assert(_restart_addr == NULL,


9325                  false /* countCollection */  );
9326       break;
9327 
9328     case CMSCollector::Sweeping:
9329       initialize(true  /* fullGC */ ,
9330                  cause /* cause of the GC */,
9331                  false /* recordGCBeginTime */,
9332                  false /* recordPreGCUsage */,
9333                  true  /* recordPeakUsage */,
9334                  true  /* recordPostGCusage */,
9335                  false /* recordAccumulatedGCTime */,
9336                  true  /* recordGCEndTime */,
9337                  true  /* countCollection */  );
9338       break;
9339 
9340     default:
9341       ShouldNotReachHere();
9342   }
9343 }
9344