62 class CMSTracer;
63 class ConcurrentGCTimer;
64 class ConcurrentMarkSweepGeneration;
65 class ConcurrentMarkSweepPolicy;
66 class ConcurrentMarkSweepThread;
67 class CompactibleFreeListSpace;
68 class FreeChunk;
69 class ParNewGeneration;
70 class PromotionInfo;
71 class ScanMarkedObjectsAgainCarefullyClosure;
72 class TenuredGeneration;
73 class SerialOldTracer;
74
75 // A generic CMS bit map. It's the basis for both the CMS marking bit map
76 // as well as for the mod union table (in each case only a subset of the
77 // methods are used). This is essentially a wrapper around the BitMap class,
78 // with one bit per (1<<_shifter) HeapWords. (i.e. for the marking bit map,
79 // we have _shifter == 0. and for the mod union table we have
80 // shifter == CardTable::card_shift - LogHeapWordSize.)
81 // XXX 64-bit issues in BitMap?
82 class CMSBitMap VALUE_OBJ_CLASS_SPEC {
83 friend class VMStructs;
84
85 HeapWord* _bmStartWord; // base address of range covered by map
86 size_t _bmWordSize; // map size (in #HeapWords covered)
87 const int _shifter; // shifts to convert HeapWord to bit position
88 VirtualSpace _virtual_space; // underlying the bit map
89 BitMapView _bm; // the bit map itself
90 Mutex* const _lock; // mutex protecting _bm;
91
92 public:
93 // constructor
94 CMSBitMap(int shifter, int mutex_rank, const char* mutex_name);
95
96 // allocates the actual storage for the map
97 bool allocate(MemRegion mr);
98 // field getter
99 Mutex* lock() const { return _lock; }
100 // locking verifier convenience function
101 void assert_locked() const PRODUCT_RETURN;
102
314 }
315
316 void record_sample(HeapWord* p, size_t sz) {
317 // For now we do not do anything with the size
318 if (_index < _capacity) {
319 _array[_index++] = p;
320 } else {
321 ++_overflows;
322 assert(_index == _capacity,
323 "_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT
324 "): out of bounds at overflow#" SIZE_FORMAT,
325 _index, _capacity, _overflows);
326 }
327 }
328 };
329
330 //
331 // Timing, allocation and promotion statistics for gc scheduling and incremental
332 // mode pacing. Most statistics are exponential averages.
333 //
334 class CMSStats VALUE_OBJ_CLASS_SPEC {
335 private:
336 ConcurrentMarkSweepGeneration* const _cms_gen; // The cms (old) gen.
337
338 // The following are exponential averages with factor alpha:
339 // avg = (100 - alpha) * avg + alpha * cur_sample
340 //
341 // The durations measure: end_time[n] - start_time[n]
342 // The periods measure: start_time[n] - start_time[n-1]
343 //
344 // The cms period and duration include only concurrent collections; time spent
345 // in foreground cms collections due to System.gc() or because of a failure to
346 // keep up are not included.
347 //
348 // There are 3 alphas to "bootstrap" the statistics. The _saved_alpha is the
349 // real value, but is used only after the first period. A value of 100 is
350 // used for the first sample so it gets the entire weight.
351 unsigned int _saved_alpha; // 0-100
352 unsigned int _gc0_alpha;
353 unsigned int _cms_alpha;
354
|
62 class CMSTracer;
63 class ConcurrentGCTimer;
64 class ConcurrentMarkSweepGeneration;
65 class ConcurrentMarkSweepPolicy;
66 class ConcurrentMarkSweepThread;
67 class CompactibleFreeListSpace;
68 class FreeChunk;
69 class ParNewGeneration;
70 class PromotionInfo;
71 class ScanMarkedObjectsAgainCarefullyClosure;
72 class TenuredGeneration;
73 class SerialOldTracer;
74
75 // A generic CMS bit map. It's the basis for both the CMS marking bit map
76 // as well as for the mod union table (in each case only a subset of the
77 // methods are used). This is essentially a wrapper around the BitMap class,
78 // with one bit per (1<<_shifter) HeapWords. (i.e. for the marking bit map,
79 // we have _shifter == 0. and for the mod union table we have
80 // shifter == CardTable::card_shift - LogHeapWordSize.)
81 // XXX 64-bit issues in BitMap?
82 class CMSBitMap {
83 friend class VMStructs;
84
85 HeapWord* _bmStartWord; // base address of range covered by map
86 size_t _bmWordSize; // map size (in #HeapWords covered)
87 const int _shifter; // shifts to convert HeapWord to bit position
88 VirtualSpace _virtual_space; // underlying the bit map
89 BitMapView _bm; // the bit map itself
90 Mutex* const _lock; // mutex protecting _bm;
91
92 public:
93 // constructor
94 CMSBitMap(int shifter, int mutex_rank, const char* mutex_name);
95
96 // allocates the actual storage for the map
97 bool allocate(MemRegion mr);
98 // field getter
99 Mutex* lock() const { return _lock; }
100 // locking verifier convenience function
101 void assert_locked() const PRODUCT_RETURN;
102
314 }
315
316 void record_sample(HeapWord* p, size_t sz) {
317 // For now we do not do anything with the size
318 if (_index < _capacity) {
319 _array[_index++] = p;
320 } else {
321 ++_overflows;
322 assert(_index == _capacity,
323 "_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT
324 "): out of bounds at overflow#" SIZE_FORMAT,
325 _index, _capacity, _overflows);
326 }
327 }
328 };
329
330 //
331 // Timing, allocation and promotion statistics for gc scheduling and incremental
332 // mode pacing. Most statistics are exponential averages.
333 //
334 class CMSStats {
335 private:
336 ConcurrentMarkSweepGeneration* const _cms_gen; // The cms (old) gen.
337
338 // The following are exponential averages with factor alpha:
339 // avg = (100 - alpha) * avg + alpha * cur_sample
340 //
341 // The durations measure: end_time[n] - start_time[n]
342 // The periods measure: start_time[n] - start_time[n-1]
343 //
344 // The cms period and duration include only concurrent collections; time spent
345 // in foreground cms collections due to System.gc() or because of a failure to
346 // keep up are not included.
347 //
348 // There are 3 alphas to "bootstrap" the statistics. The _saved_alpha is the
349 // real value, but is used only after the first period. A value of 100 is
350 // used for the first sample so it gets the entire weight.
351 unsigned int _saved_alpha; // 0-100
352 unsigned int _gc0_alpha;
353 unsigned int _cms_alpha;
354
|