8013184: CMS: Call reset_after_compaction() only if a compaction has been done

Reviewed-by: mgerdin, johnc, tschatzl
This commit is contained in:
Jon Masamitsu 2013-05-08 17:12:52 -07:00
parent 973d0400c4
commit bbff951f67
3 changed files with 84 additions and 4 deletions

View file

@ -193,7 +193,8 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
CardGeneration(rs, initial_byte_size, level, ct),
_dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
_debug_collection_type(Concurrent_collection_type)
_debug_collection_type(Concurrent_collection_type),
_did_compact(false)
{
HeapWord* bottom = (HeapWord*) _virtual_space.low();
HeapWord* end = (HeapWord*) _virtual_space.high();
@ -923,8 +924,9 @@ void ConcurrentMarkSweepGeneration::compute_new_size() {
CardGeneration::compute_new_size();
// Reset again after a possible resizing
cmsSpace()->reset_after_compaction();
if (did_compact()) {
cmsSpace()->reset_after_compaction();
}
}
void ConcurrentMarkSweepGeneration::compute_new_size_free_list() {
@ -1574,6 +1576,8 @@ bool CMSCollector::shouldConcurrentCollect() {
return false;
}
void CMSCollector::set_did_compact(bool v) { _cmsGen->set_did_compact(v); }
// Clear _expansion_cause fields of constituent generations
void CMSCollector::clear_expansion_cause() {
_cmsGen->clear_expansion_cause();
@ -1671,7 +1675,6 @@ void CMSCollector::collect(bool full,
}
acquire_control_and_collect(full, clear_all_soft_refs);
_full_gcs_since_conc_gc++;
}
void CMSCollector::request_full_gc(unsigned int full_gc_count) {
@ -1853,6 +1856,7 @@ NOT_PRODUCT(
}
}
set_did_compact(should_compact);
if (should_compact) {
// If the collection is being acquired from the background
// collector, there may be references on the discovered
@ -2714,6 +2718,7 @@ void CMSCollector::gc_epilogue(bool full) {
Chunk::clean_chunk_pool();
}
set_did_compact(false);
_between_prologue_and_epilogue = false; // ready for next cycle
}

View file

@ -604,6 +604,8 @@ class CMSCollector: public CHeapObj<mtGC> {
ConcurrentMarkSweepPolicy* _collector_policy;
ConcurrentMarkSweepPolicy* collector_policy() { return _collector_policy; }
void set_did_compact(bool v);
// XXX Move these to CMSStats ??? FIX ME !!!
elapsedTimer _inter_sweep_timer; // time between sweeps
elapsedTimer _intra_sweep_timer; // time _in_ sweeps
@ -1081,6 +1083,10 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
CollectionTypes _debug_collection_type;
// True if a compactiing collection was done.
bool _did_compact;
bool did_compact() { return _did_compact; }
// Fraction of current occupancy at which to start a CMS collection which
// will collect this generation (at least).
double _initiating_occupancy;
@ -1121,6 +1127,8 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Adaptive size policy
CMSAdaptiveSizePolicy* size_policy();
void set_did_compact(bool v) { _did_compact = v; }
bool refs_discovery_is_atomic() const { return false; }
bool refs_discovery_is_mt() const {
// Note: CMS does MT-discovery during the parallel-remark