< prev index next >

src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp

Print this page




  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/cms/cmsCollectorPolicy.hpp"
  32 #include "gc/cms/cmsGCStats.hpp"
  33 #include "gc/cms/cmsHeap.hpp"
  34 #include "gc/cms/cmsOopClosures.inline.hpp"
  35 #include "gc/cms/compactibleFreeListSpace.hpp"
  36 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
  37 #include "gc/cms/concurrentMarkSweepThread.hpp"
  38 #include "gc/cms/parNewGeneration.hpp"
  39 #include "gc/cms/promotionInfo.inline.hpp"
  40 #include "gc/cms/vmCMSOperations.hpp"
  41 #include "gc/serial/genMarkSweep.hpp"
  42 #include "gc/serial/tenuredGeneration.hpp"
  43 #include "gc/shared/adaptiveSizePolicy.hpp"
  44 #include "gc/shared/cardGeneration.inline.hpp"
  45 #include "gc/shared/cardTableRS.hpp"
  46 #include "gc/shared/collectedHeap.inline.hpp"
  47 #include "gc/shared/collectorCounters.hpp"
  48 #include "gc/shared/collectorPolicy.hpp"

  49 #include "gc/shared/gcLocker.hpp"
  50 #include "gc/shared/gcPolicyCounters.hpp"
  51 #include "gc/shared/gcTimer.hpp"
  52 #include "gc/shared/gcTrace.hpp"
  53 #include "gc/shared/gcTraceTime.inline.hpp"
  54 #include "gc/shared/genCollectedHeap.hpp"
  55 #include "gc/shared/genOopClosures.inline.hpp"
  56 #include "gc/shared/isGCActiveMark.hpp"
  57 #include "gc/shared/oopStorageParState.hpp"
  58 #include "gc/shared/referencePolicy.hpp"
  59 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  60 #include "gc/shared/space.inline.hpp"
  61 #include "gc/shared/strongRootsScope.hpp"
  62 #include "gc/shared/taskqueue.inline.hpp"
  63 #include "gc/shared/weakProcessor.hpp"
  64 #include "logging/log.hpp"
  65 #include "logging/logStream.hpp"
  66 #include "memory/allocation.hpp"
  67 #include "memory/binaryTreeDictionary.inline.hpp"
  68 #include "memory/iterator.inline.hpp"


 190 //////////////////////////////////////////////////////////////////
 191 
 192 NOT_PRODUCT(CompactibleFreeListSpace* debug_cms_space;)
 193 
 194 // This struct contains per-thread things necessary to support parallel
 195 // young-gen collection.
 196 class CMSParGCThreadState: public CHeapObj<mtGC> {
 197  public:
 198   CompactibleFreeListSpaceLAB lab;
 199   PromotionInfo promo;
 200 
 201   // Constructor.
 202   CMSParGCThreadState(CompactibleFreeListSpace* cfls) : lab(cfls) {
 203     promo.setSpace(cfls);
 204   }
 205 };
 206 
 207 ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
 208      ReservedSpace rs, size_t initial_byte_size, CardTableRS* ct) :
 209   CardGeneration(rs, initial_byte_size, ct),
 210   _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
 211   _did_compact(false)
 212 {
 213   HeapWord* bottom = (HeapWord*) _virtual_space.low();
 214   HeapWord* end    = (HeapWord*) _virtual_space.high();
 215 
 216   _direct_allocated_words = 0;
 217   NOT_PRODUCT(
 218     _numObjectsPromoted = 0;
 219     _numWordsPromoted = 0;
 220     _numObjectsAllocated = 0;
 221     _numWordsAllocated = 0;
 222   )
 223 
 224   _cmsSpace = new CompactibleFreeListSpace(_bts, MemRegion(bottom, end));
 225   NOT_PRODUCT(debug_cms_space = _cmsSpace;)
 226   _cmsSpace->_old_gen = this;
 227 
 228   _gc_stats = new CMSGCStats();
 229 
 230   // Verify the assumption that FreeChunk::_prev and OopDesc::_klass


 237            "Offset of FreeChunk::_prev within FreeChunk must match"
 238            "  that of OopDesc::_klass within OopDesc");
 239   )
 240 
 241   _par_gc_thread_states = NEW_C_HEAP_ARRAY(CMSParGCThreadState*, ParallelGCThreads, mtGC);
 242   for (uint i = 0; i < ParallelGCThreads; i++) {
 243     _par_gc_thread_states[i] = new CMSParGCThreadState(cmsSpace());
 244   }
 245 
 246   _incremental_collection_failed = false;
 247   // The "dilatation_factor" is the expansion that can occur on
 248   // account of the fact that the minimum object size in the CMS
 249   // generation may be larger than that in, say, a contiguous young
 250   //  generation.
 251   // Ideally, in the calculation below, we'd compute the dilatation
 252   // factor as: MinChunkSize/(promoting_gen's min object size)
 253   // Since we do not have such a general query interface for the
 254   // promoting generation, we'll instead just use the minimum
 255   // object size (which today is a header's worth of space);
 256   // note that all arithmetic is in units of HeapWords.
 257   assert(MinChunkSize >= CollectedHeap::min_fill_size(), "just checking");
 258   assert(_dilatation_factor >= 1.0, "from previous assert");
 259 }
 260 
 261 
 262 // The field "_initiating_occupancy" represents the occupancy percentage
 263 // at which we trigger a new collection cycle.  Unless explicitly specified
 264 // via CMSInitiatingOccupancyFraction (argument "io" below), it
 265 // is calculated by:
 266 //
 267 //   Let "f" be MinHeapFreeRatio in
 268 //
 269 //    _initiating_occupancy = 100-f +
 270 //                           f * (CMSTriggerRatio/100)
 271 //   where CMSTriggerRatio is the argument "tr" below.
 272 //
 273 // That is, if we assume the heap is at its desired maximum occupancy at the
 274 // end of a collection, we let CMSTriggerRatio of the (purported) free
 275 // space be allocated before initiating a new collection cycle.
 276 //
 277 void ConcurrentMarkSweepGeneration::init_initiating_occupancy(intx io, uintx tr) {




  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "gc/cms/cmsCollectorPolicy.hpp"
  32 #include "gc/cms/cmsGCStats.hpp"
  33 #include "gc/cms/cmsHeap.hpp"
  34 #include "gc/cms/cmsOopClosures.inline.hpp"
  35 #include "gc/cms/compactibleFreeListSpace.hpp"
  36 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
  37 #include "gc/cms/concurrentMarkSweepThread.hpp"
  38 #include "gc/cms/parNewGeneration.hpp"
  39 #include "gc/cms/promotionInfo.inline.hpp"
  40 #include "gc/cms/vmCMSOperations.hpp"
  41 #include "gc/serial/genMarkSweep.hpp"
  42 #include "gc/serial/tenuredGeneration.hpp"
  43 #include "gc/shared/adaptiveSizePolicy.hpp"
  44 #include "gc/shared/cardGeneration.inline.hpp"
  45 #include "gc/shared/cardTableRS.hpp"
  46 #include "gc/shared/collectedHeap.inline.hpp"
  47 #include "gc/shared/collectorCounters.hpp"
  48 #include "gc/shared/collectorPolicy.hpp"
  49 #include "gc/shared/fill.hpp"
  50 #include "gc/shared/gcLocker.hpp"
  51 #include "gc/shared/gcPolicyCounters.hpp"
  52 #include "gc/shared/gcTimer.hpp"
  53 #include "gc/shared/gcTrace.hpp"
  54 #include "gc/shared/gcTraceTime.inline.hpp"
  55 #include "gc/shared/genCollectedHeap.hpp"
  56 #include "gc/shared/genOopClosures.inline.hpp"
  57 #include "gc/shared/isGCActiveMark.hpp"
  58 #include "gc/shared/oopStorageParState.hpp"
  59 #include "gc/shared/referencePolicy.hpp"
  60 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
  61 #include "gc/shared/space.inline.hpp"
  62 #include "gc/shared/strongRootsScope.hpp"
  63 #include "gc/shared/taskqueue.inline.hpp"
  64 #include "gc/shared/weakProcessor.hpp"
  65 #include "logging/log.hpp"
  66 #include "logging/logStream.hpp"
  67 #include "memory/allocation.hpp"
  68 #include "memory/binaryTreeDictionary.inline.hpp"
  69 #include "memory/iterator.inline.hpp"


 191 //////////////////////////////////////////////////////////////////
 192 
 193 NOT_PRODUCT(CompactibleFreeListSpace* debug_cms_space;)
 194 
 195 // This struct contains per-thread things necessary to support parallel
 196 // young-gen collection.
 197 class CMSParGCThreadState: public CHeapObj<mtGC> {
 198  public:
 199   CompactibleFreeListSpaceLAB lab;
 200   PromotionInfo promo;
 201 
 202   // Constructor.
 203   CMSParGCThreadState(CompactibleFreeListSpace* cfls) : lab(cfls) {
 204     promo.setSpace(cfls);
 205   }
 206 };
 207 
 208 ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
 209      ReservedSpace rs, size_t initial_byte_size, CardTableRS* ct) :
 210   CardGeneration(rs, initial_byte_size, ct),
 211   _dilatation_factor(((double)MinChunkSize)/((double)(Fill::min_size()))),
 212   _did_compact(false)
 213 {
 214   HeapWord* bottom = (HeapWord*) _virtual_space.low();
 215   HeapWord* end    = (HeapWord*) _virtual_space.high();
 216 
 217   _direct_allocated_words = 0;
 218   NOT_PRODUCT(
 219     _numObjectsPromoted = 0;
 220     _numWordsPromoted = 0;
 221     _numObjectsAllocated = 0;
 222     _numWordsAllocated = 0;
 223   )
 224 
 225   _cmsSpace = new CompactibleFreeListSpace(_bts, MemRegion(bottom, end));
 226   NOT_PRODUCT(debug_cms_space = _cmsSpace;)
 227   _cmsSpace->_old_gen = this;
 228 
 229   _gc_stats = new CMSGCStats();
 230 
 231   // Verify the assumption that FreeChunk::_prev and OopDesc::_klass


 238            "Offset of FreeChunk::_prev within FreeChunk must match"
 239            "  that of OopDesc::_klass within OopDesc");
 240   )
 241 
 242   _par_gc_thread_states = NEW_C_HEAP_ARRAY(CMSParGCThreadState*, ParallelGCThreads, mtGC);
 243   for (uint i = 0; i < ParallelGCThreads; i++) {
 244     _par_gc_thread_states[i] = new CMSParGCThreadState(cmsSpace());
 245   }
 246 
 247   _incremental_collection_failed = false;
 248   // The "dilatation_factor" is the expansion that can occur on
 249   // account of the fact that the minimum object size in the CMS
 250   // generation may be larger than that in, say, a contiguous young
 251   //  generation.
 252   // Ideally, in the calculation below, we'd compute the dilatation
 253   // factor as: MinChunkSize/(promoting_gen's min object size)
 254   // Since we do not have such a general query interface for the
 255   // promoting generation, we'll instead just use the minimum
 256   // object size (which today is a header's worth of space);
 257   // note that all arithmetic is in units of HeapWords.
 258   assert(MinChunkSize >= Fill::min_size(), "just checking");
 259   assert(_dilatation_factor >= 1.0, "from previous assert");
 260 }
 261 
 262 
 263 // The field "_initiating_occupancy" represents the occupancy percentage
 264 // at which we trigger a new collection cycle.  Unless explicitly specified
 265 // via CMSInitiatingOccupancyFraction (argument "io" below), it
 266 // is calculated by:
 267 //
 268 //   Let "f" be MinHeapFreeRatio in
 269 //
 270 //    _initiating_occupancy = 100-f +
 271 //                           f * (CMSTriggerRatio/100)
 272 //   where CMSTriggerRatio is the argument "tr" below.
 273 //
 274 // That is, if we assume the heap is at its desired maximum occupancy at the
 275 // end of a collection, we let CMSTriggerRatio of the (purported) free
 276 // space be allocated before initiating a new collection cycle.
 277 //
 278 void ConcurrentMarkSweepGeneration::init_initiating_occupancy(intx io, uintx tr) {


< prev index next >