comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 10244:06ab37f08701

8013184: CMS: Call reset_after_compaction() only if a compaction has been done Reviewed-by: mgerdin, johnc, tschatzl
author jmasa
date Wed, 08 May 2013 17:12:52 -0700
parents a9d568b7df60
children 12f651e29f6b
comparison
equal deleted inserted replaced
10243:a9d568b7df60 10244:06ab37f08701
191 ReservedSpace rs, size_t initial_byte_size, int level, 191 ReservedSpace rs, size_t initial_byte_size, int level,
192 CardTableRS* ct, bool use_adaptive_freelists, 192 CardTableRS* ct, bool use_adaptive_freelists,
193 FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) : 193 FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
194 CardGeneration(rs, initial_byte_size, level, ct), 194 CardGeneration(rs, initial_byte_size, level, ct),
195 _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))), 195 _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
196 _debug_collection_type(Concurrent_collection_type) 196 _debug_collection_type(Concurrent_collection_type),
197 _did_compact(false)
197 { 198 {
198 HeapWord* bottom = (HeapWord*) _virtual_space.low(); 199 HeapWord* bottom = (HeapWord*) _virtual_space.low();
199 HeapWord* end = (HeapWord*) _virtual_space.high(); 200 HeapWord* end = (HeapWord*) _virtual_space.high();
200 201
201 _direct_allocated_words = 0; 202 _direct_allocated_words = 0;
921 // Any metric such as free() or used() will be incorrect. 922 // Any metric such as free() or used() will be incorrect.
922 923
923 CardGeneration::compute_new_size(); 924 CardGeneration::compute_new_size();
924 925
925 // Reset again after a possible resizing 926 // Reset again after a possible resizing
926 cmsSpace()->reset_after_compaction(); 927 if (did_compact()) {
927 928 cmsSpace()->reset_after_compaction();
929 }
928 } 930 }
929 931
930 void ConcurrentMarkSweepGeneration::compute_new_size_free_list() { 932 void ConcurrentMarkSweepGeneration::compute_new_size_free_list() {
931 assert_locked_or_safepoint(Heap_lock); 933 assert_locked_or_safepoint(Heap_lock);
932 934
1572 } 1574 }
1573 1575
1574 return false; 1576 return false;
1575 } 1577 }
1576 1578
1579 void CMSCollector::set_did_compact(bool v) { _cmsGen->set_did_compact(v); }
1580
1577 // Clear _expansion_cause fields of constituent generations 1581 // Clear _expansion_cause fields of constituent generations
1578 void CMSCollector::clear_expansion_cause() { 1582 void CMSCollector::clear_expansion_cause() {
1579 _cmsGen->clear_expansion_cause(); 1583 _cmsGen->clear_expansion_cause();
1580 } 1584 }
1581 1585
1669 compute_new_size(); 1673 compute_new_size();
1670 return; 1674 return;
1671 } 1675 }
1672 acquire_control_and_collect(full, clear_all_soft_refs); 1676 acquire_control_and_collect(full, clear_all_soft_refs);
1673 _full_gcs_since_conc_gc++; 1677 _full_gcs_since_conc_gc++;
1674
1675 } 1678 }
1676 1679
1677 void CMSCollector::request_full_gc(unsigned int full_gc_count) { 1680 void CMSCollector::request_full_gc(unsigned int full_gc_count) {
1678 GenCollectedHeap* gch = GenCollectedHeap::heap(); 1681 GenCollectedHeap* gch = GenCollectedHeap::heap();
1679 unsigned int gc_count = gch->total_full_collections(); 1682 unsigned int gc_count = gch->total_full_collections();
1851 } else { 1854 } else {
1852 gclog_or_tty->print(" (concurrent mode failure)"); 1855 gclog_or_tty->print(" (concurrent mode failure)");
1853 } 1856 }
1854 } 1857 }
1855 1858
1859 set_did_compact(should_compact);
1856 if (should_compact) { 1860 if (should_compact) {
1857 // If the collection is being acquired from the background 1861 // If the collection is being acquired from the background
1858 // collector, there may be references on the discovered 1862 // collector, there may be references on the discovered
1859 // references lists that have NULL referents (being those 1863 // references lists that have NULL referents (being those
1860 // that were concurrently cleared by a mutator) or 1864 // that were concurrently cleared by a mutator) or
2712 2716
2713 if (!CleanChunkPoolAsync) { 2717 if (!CleanChunkPoolAsync) {
2714 Chunk::clean_chunk_pool(); 2718 Chunk::clean_chunk_pool();
2715 } 2719 }
2716 2720
2721 set_did_compact(false);
2717 _between_prologue_and_epilogue = false; // ready for next cycle 2722 _between_prologue_and_epilogue = false; // ready for next cycle
2718 } 2723 }
2719 2724
2720 void ConcurrentMarkSweepGeneration::gc_epilogue(bool full) { 2725 void ConcurrentMarkSweepGeneration::gc_epilogue(bool full) {
2721 collector()->gc_epilogue(full); 2726 collector()->gc_epilogue(full);