< prev index next >

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

Print this page
rev 8393 : 8077842: Remove the level parameter passed around in GenCollectedHeap
Reviewed-by:

*** 187,200 **** promo.setSpace(cfls); } }; ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration( ! ReservedSpace rs, size_t initial_byte_size, int level, CardTableRS* ct, bool use_adaptive_freelists, FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) : ! CardGeneration(rs, initial_byte_size, level, ct), _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))), _did_compact(false) { HeapWord* bottom = (HeapWord*) _virtual_space.low(); HeapWord* end = (HeapWord*) _virtual_space.high(); --- 187,200 ---- promo.setSpace(cfls); } }; ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration( ! ReservedSpace rs, size_t initial_byte_size, CardTableRS* ct, bool use_adaptive_freelists, FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) : ! CardGeneration(rs, initial_byte_size, ct), _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))), _did_compact(false) { HeapWord* bottom = (HeapWord*) _virtual_space.low(); HeapWord* end = (HeapWord*) _virtual_space.high();
*** 679,694 **** #endif void ConcurrentMarkSweepGeneration::printOccupancy(const char *s) { GenCollectedHeap* gch = GenCollectedHeap::heap(); if (PrintGCDetails) { if (Verbose) { ! gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]", ! level(), short_name(), s, used(), capacity()); } else { ! gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]", ! level(), short_name(), s, used() / K, capacity() / K); } } if (Verbose) { gclog_or_tty->print(" "SIZE_FORMAT"("SIZE_FORMAT")", gch->used(), gch->capacity()); --- 679,699 ---- #endif void ConcurrentMarkSweepGeneration::printOccupancy(const char *s) { GenCollectedHeap* gch = GenCollectedHeap::heap(); if (PrintGCDetails) { + // I didn't want to change the logging when removing the level concept, + // but I guess this logging could say "old" or something instead of "1". + assert(this == gch->old_gen(), + "The CMS generation should be the old generation"); + uint level = 1; if (Verbose) { ! gclog_or_tty->print("[%u %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]", ! level, short_name(), s, used(), capacity()); } else { ! gclog_or_tty->print("[%u %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]", ! level, short_name(), s, used() / K, capacity() / K); } } if (Verbose) { gclog_or_tty->print(" "SIZE_FORMAT"("SIZE_FORMAT")", gch->used(), gch->capacity());
*** 793,824 **** size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes); if (PrintGCDetails && Verbose) { size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); gclog_or_tty->print_cr("\nFrom compute_new_size: "); gclog_or_tty->print_cr(" Free fraction %f", free_percentage); ! gclog_or_tty->print_cr(" Desired free fraction %f", ! desired_free_percentage); ! gclog_or_tty->print_cr(" Maximum free fraction %f", ! maximum_free_percentage); ! gclog_or_tty->print_cr(" Capacity "SIZE_FORMAT, capacity()/1000); ! gclog_or_tty->print_cr(" Desired capacity "SIZE_FORMAT, ! desired_capacity/1000); ! int prev_level = level() - 1; ! if (prev_level >= 0) { ! size_t prev_size = 0; ! GenCollectedHeap* gch = GenCollectedHeap::heap(); ! Generation* prev_gen = gch->young_gen(); ! prev_size = prev_gen->capacity(); ! gclog_or_tty->print_cr(" Younger gen size "SIZE_FORMAT, ! prev_size/1000); ! } ! gclog_or_tty->print_cr(" unsafe_max_alloc_nogc "SIZE_FORMAT, ! unsafe_max_alloc_nogc()/1000); ! gclog_or_tty->print_cr(" contiguous available "SIZE_FORMAT, ! contiguous_available()/1000); ! gclog_or_tty->print_cr(" Expand by "SIZE_FORMAT" (bytes)", ! expand_bytes); } // safe if expansion fails expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio); if (PrintGCDetails && Verbose) { gclog_or_tty->print_cr(" Expanded free fraction %f", --- 798,818 ---- size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes); if (PrintGCDetails && Verbose) { size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); gclog_or_tty->print_cr("\nFrom compute_new_size: "); gclog_or_tty->print_cr(" Free fraction %f", free_percentage); ! gclog_or_tty->print_cr(" Desired free fraction %f", desired_free_percentage); ! gclog_or_tty->print_cr(" Maximum free fraction %f", maximum_free_percentage); ! gclog_or_tty->print_cr(" Capacity "SIZE_FORMAT, capacity() / 1000); ! gclog_or_tty->print_cr(" Desired capacity "SIZE_FORMAT, desired_capacity / 1000); ! GenCollectedHeap* gch = GenCollectedHeap::heap(); ! assert(this == gch->_old_gen, "The CMS generation should always be the old generation"); ! size_t young_size = gch->_young_gen->capacity(); ! gclog_or_tty->print_cr(" Young gen size "SIZE_FORMAT, young_size / 1000); ! gclog_or_tty->print_cr(" unsafe_max_alloc_nogc "SIZE_FORMAT, unsafe_max_alloc_nogc() / 1000); ! gclog_or_tty->print_cr(" contiguous available "SIZE_FORMAT, contiguous_available() / 1000); ! gclog_or_tty->print_cr(" Expand by "SIZE_FORMAT" (bytes)", expand_bytes); } // safe if expansion fails expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio); if (PrintGCDetails && Verbose) { gclog_or_tty->print_cr(" Expanded free fraction %f",
*** 1647,1658 **** _cmsGen->cmsSpace()->beginSweepFLCensus((float)(_inter_sweep_timer.seconds()), _inter_sweep_estimate.padded_average(), _intra_sweep_estimate.padded_average()); } ! GenMarkSweep::invoke_at_safepoint(_cmsGen->level(), ! ref_processor(), clear_all_soft_refs); #ifdef ASSERT CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace(); size_t free_size = cms_space->free(); assert(free_size == pointer_delta(cms_space->end(), cms_space->compaction_top()) --- 1641,1651 ---- _cmsGen->cmsSpace()->beginSweepFLCensus((float)(_inter_sweep_timer.seconds()), _inter_sweep_estimate.padded_average(), _intra_sweep_estimate.padded_average()); } ! GenMarkSweep::invoke_at_safepoint(ref_processor(), clear_all_soft_refs); #ifdef ASSERT CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace(); size_t free_size = cms_space->free(); assert(free_size == pointer_delta(cms_space->end(), cms_space->compaction_top())
*** 2425,2435 **** // Mark from roots one level into CMS MarkRefsIntoClosure notOlder(_span, verification_mark_bm()); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. ! gch->gen_process_roots(_cmsGen->level(), true, // younger gens are roots true, // activate StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &notOlder, --- 2418,2428 ---- // Mark from roots one level into CMS MarkRefsIntoClosure notOlder(_span, verification_mark_bm()); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. ! gch->gen_process_roots(Generation::Old, true, // younger gens are roots true, // activate StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &notOlder,
*** 2493,2503 **** markBitMap()); CLDToOopClosure cld_closure(&notOlder, true); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. ! gch->gen_process_roots(_cmsGen->level(), true, // younger gens are roots true, // activate StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &notOlder, --- 2486,2496 ---- markBitMap()); CLDToOopClosure cld_closure(&notOlder, true); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. ! gch->gen_process_roots(Generation::Old, true, // younger gens are roots true, // activate StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &notOlder,
*** 3016,3026 **** gch->set_par_threads(0); } else { // The serial version. CLDToOopClosure cld_closure(&notOlder, true); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. ! gch->gen_process_roots(_cmsGen->level(), true, // younger gens are roots true, // activate StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &notOlder, --- 3009,3019 ---- gch->set_par_threads(0); } else { // The serial version. CLDToOopClosure cld_closure(&notOlder, true); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. ! gch->gen_process_roots(Generation::Old, true, // younger gens are roots true, // activate StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &notOlder,
*** 4268,4286 **** // Temporarily set flag to false, GCH->do_collection will // expect it to be false and set to true FlagSetting fl(gch->_is_gc_active, false); NOT_PRODUCT(GCTraceTime t("Scavenge-Before-Remark", PrintGCDetails && Verbose, true, _gc_timer_cm, _gc_tracer_cm->gc_id());) ! int level = _cmsGen->level() - 1; ! if (level >= 0) { ! gch->do_collection(true, // full (i.e. force, see below) ! false, // !clear_all_soft_refs ! 0, // size ! false, // is_tlab ! level // max_level ! ); ! } } FreelistLocker x(this); MutexLockerEx y(bitMapLock(), Mutex::_no_safepoint_check_flag); checkpointRootsFinalWork(); --- 4261,4276 ---- // Temporarily set flag to false, GCH->do_collection will // expect it to be false and set to true FlagSetting fl(gch->_is_gc_active, false); NOT_PRODUCT(GCTraceTime t("Scavenge-Before-Remark", PrintGCDetails && Verbose, true, _gc_timer_cm, _gc_tracer_cm->gc_id());) ! gch->do_collection(true, // full (i.e. force, see below) ! false, // !clear_all_soft_refs ! 0, // size ! false, // is_tlab ! Generation::Young // type ! ); } FreelistLocker x(this); MutexLockerEx y(bitMapLock(), Mutex::_no_safepoint_check_flag); checkpointRootsFinalWork();
*** 4449,4459 **** _timer.reset(); _timer.start(); CLDToOopClosure cld_closure(&par_mri_cl, true); ! gch->gen_process_roots(_collector->_cmsGen->level(), false, // yg was scanned above false, // this is parallel code GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), _collector->should_unload_classes(), &par_mri_cl, --- 4439,4449 ---- _timer.reset(); _timer.start(); CLDToOopClosure cld_closure(&par_mri_cl, true); ! gch->gen_process_roots(Generation::Old, false, // yg was scanned above false, // this is parallel code GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), _collector->should_unload_classes(), &par_mri_cl,
*** 4585,4595 **** } // ---------- remaining roots -------------- _timer.reset(); _timer.start(); ! gch->gen_process_roots(_collector->_cmsGen->level(), false, // yg was scanned above false, // this is parallel code GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), _collector->should_unload_classes(), &par_mrias_cl, --- 4575,4585 ---- } // ---------- remaining roots -------------- _timer.reset(); _timer.start(); ! gch->gen_process_roots(Generation::Old, false, // yg was scanned above false, // this is parallel code GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), _collector->should_unload_classes(), &par_mrias_cl,
*** 5176,5186 **** verify_work_stacks_empty(); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. StrongRootsScope srs; ! gch->gen_process_roots(_cmsGen->level(), true, // younger gens as roots false, // use the local StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &mrias_cl, --- 5166,5176 ---- verify_work_stacks_empty(); gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. StrongRootsScope srs; ! gch->gen_process_roots(Generation::Old, true, // younger gens as roots false, // use the local StrongRootsScope GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &mrias_cl,
*** 5645,5659 **** FreeChunk* ConcurrentMarkSweepGeneration::find_chunk_at_end() { return _cmsSpace->find_chunk_at_end(); } ! void ConcurrentMarkSweepGeneration::update_gc_stats(int current_level, bool full) { ! // The next lower level has been collected. Gather any statistics // that are of interest at this point. ! if (!full && (current_level + 1) == level()) { // Gather statistics on the young generation collection. collector()->stats().record_gc0_end(used()); } } --- 5635,5650 ---- FreeChunk* ConcurrentMarkSweepGeneration::find_chunk_at_end() { return _cmsSpace->find_chunk_at_end(); } ! void ConcurrentMarkSweepGeneration::update_gc_stats(Generation* current_generation, bool full) { ! // If the young generation has been collected, gather any statistics // that are of interest at this point. ! bool current_is_young = (current_generation == GenCollectedHeap::heap()->young_gen()); ! if (!full && current_is_young) { // Gather statistics on the young generation collection. collector()->stats().record_gc0_end(used()); } }
< prev index next >