870 }
871
872 // At a promotion failure dump information on block layout in heap
873 // (cms old generation).
874 void ConcurrentMarkSweepGeneration::promotion_failure_occurred() {
875 if (CMSDumpAtPromotionFailure) {
876 cmsSpace()->dump_at_safepoint_with_locks(collector(), gclog_or_tty);
877 }
878 }
879
880 CompactibleSpace*
881 ConcurrentMarkSweepGeneration::first_compaction_space() const {
882 return _cmsSpace;
883 }
884
885 void ConcurrentMarkSweepGeneration::reset_after_compaction() {
886 // Clear the promotion information. These pointers can be adjusted
887 // along with all the other pointers into the heap but
888 // compaction is expected to be a rare event with
889 // a heap using cms so don't do it without seeing the need.
890 if (CollectedHeap::use_parallel_gc_threads()) {
891 for (uint i = 0; i < ParallelGCThreads; i++) {
892 _par_gc_thread_states[i]->promo.reset();
893 }
894 }
895 }
896
897 void ConcurrentMarkSweepGeneration::space_iterate(SpaceClosure* blk, bool usedOnly) {
898 blk->do_space(_cmsSpace);
899 }
900
901 void ConcurrentMarkSweepGeneration::compute_new_size() {
902 assert_locked_or_safepoint(Heap_lock);
903
904 // If incremental collection failed, we just want to expand
905 // to the limit.
906 if (incremental_collection_failed()) {
907 clear_incremental_collection_failed();
908 grow_to_reserved();
909 return;
910 }
911
912 // The heap has been compacted but not reset yet.
913 // Any metric such as free() or used() will be incorrect.
914
2787
2788 if (CMSIncrementalMode) {
2789 icms_update_allocation_limits();
2790 }
2791
2792 bitMapLock()->unlock();
2793 releaseFreelistLocks();
2794
2795 if (!CleanChunkPoolAsync) {
2796 Chunk::clean_chunk_pool();
2797 }
2798
2799 set_did_compact(false);
2800 _between_prologue_and_epilogue = false; // ready for next cycle
2801 }
2802
2803 void ConcurrentMarkSweepGeneration::gc_epilogue(bool full) {
2804 collector()->gc_epilogue(full);
2805
2806 // Also reset promotion tracking in par gc thread states.
2807 if (CollectedHeap::use_parallel_gc_threads()) {
2808 for (uint i = 0; i < ParallelGCThreads; i++) {
2809 _par_gc_thread_states[i]->promo.stopTrackingPromotions(i);
2810 }
2811 }
2812 }
2813
2814 void ConcurrentMarkSweepGeneration::gc_epilogue_work(bool full) {
2815 assert(!incremental_collection_failed(), "Should have been cleared");
2816 cmsSpace()->setPreconsumptionDirtyCardClosure(NULL);
2817 cmsSpace()->gc_epilogue();
2818 // Print stat counters
2819 NOT_PRODUCT(
2820 assert(_numObjectsAllocated == 0, "check");
2821 assert(_numWordsAllocated == 0, "check");
2822 if (Verbose && PrintGC) {
2823 gclog_or_tty->print("Promoted "SIZE_FORMAT" objects, "
2824 SIZE_FORMAT" bytes",
2825 _numObjectsPromoted, _numWordsPromoted*sizeof(HeapWord));
2826 }
2827 _numObjectsPromoted = 0;
2828 _numWordsPromoted = 0;
2829 )
2830
|
870 }
871
872 // At a promotion failure dump information on block layout in heap
873 // (cms old generation).
874 void ConcurrentMarkSweepGeneration::promotion_failure_occurred() {
875 if (CMSDumpAtPromotionFailure) {
876 cmsSpace()->dump_at_safepoint_with_locks(collector(), gclog_or_tty);
877 }
878 }
879
880 CompactibleSpace*
881 ConcurrentMarkSweepGeneration::first_compaction_space() const {
882 return _cmsSpace;
883 }
884
885 void ConcurrentMarkSweepGeneration::reset_after_compaction() {
886 // Clear the promotion information. These pointers can be adjusted
887 // along with all the other pointers into the heap but
888 // compaction is expected to be a rare event with
889 // a heap using cms so don't do it without seeing the need.
890 for (uint i = 0; i < ParallelGCThreads; i++) {
891 _par_gc_thread_states[i]->promo.reset();
892 }
893 }
894
895 void ConcurrentMarkSweepGeneration::space_iterate(SpaceClosure* blk, bool usedOnly) {
896 blk->do_space(_cmsSpace);
897 }
898
899 void ConcurrentMarkSweepGeneration::compute_new_size() {
900 assert_locked_or_safepoint(Heap_lock);
901
902 // If incremental collection failed, we just want to expand
903 // to the limit.
904 if (incremental_collection_failed()) {
905 clear_incremental_collection_failed();
906 grow_to_reserved();
907 return;
908 }
909
910 // The heap has been compacted but not reset yet.
911 // Any metric such as free() or used() will be incorrect.
912
2785
2786 if (CMSIncrementalMode) {
2787 icms_update_allocation_limits();
2788 }
2789
2790 bitMapLock()->unlock();
2791 releaseFreelistLocks();
2792
2793 if (!CleanChunkPoolAsync) {
2794 Chunk::clean_chunk_pool();
2795 }
2796
2797 set_did_compact(false);
2798 _between_prologue_and_epilogue = false; // ready for next cycle
2799 }
2800
2801 void ConcurrentMarkSweepGeneration::gc_epilogue(bool full) {
2802 collector()->gc_epilogue(full);
2803
2804 // Also reset promotion tracking in par gc thread states.
2805 for (uint i = 0; i < ParallelGCThreads; i++) {
2806 _par_gc_thread_states[i]->promo.stopTrackingPromotions(i);
2807 }
2808 }
2809
2810 void ConcurrentMarkSweepGeneration::gc_epilogue_work(bool full) {
2811 assert(!incremental_collection_failed(), "Should have been cleared");
2812 cmsSpace()->setPreconsumptionDirtyCardClosure(NULL);
2813 cmsSpace()->gc_epilogue();
2814 // Print stat counters
2815 NOT_PRODUCT(
2816 assert(_numObjectsAllocated == 0, "check");
2817 assert(_numWordsAllocated == 0, "check");
2818 if (Verbose && PrintGC) {
2819 gclog_or_tty->print("Promoted "SIZE_FORMAT" objects, "
2820 SIZE_FORMAT" bytes",
2821 _numObjectsPromoted, _numWordsPromoted*sizeof(HeapWord));
2822 }
2823 _numObjectsPromoted = 0;
2824 _numWordsPromoted = 0;
2825 )
2826
|