< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahCollectorPolicy.cpp

Print this page
rev 10498 : [backport] Move heuristics from ShCollectorPolicy to ShHeap
rev 10587 : [backport] Refactor gc+init logging
rev 10598 : [backport] Shenandoah changes to allow enabling -Wreorder
rev 10637 : [backport] Purge partial heuristics and connection matrix infrastructure

*** 21,105 **** * */ #include "precompiled.hpp" #include "gc_implementation/shared/gcTimer.hpp" - #include "gc_implementation/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" - #include "gc_implementation/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" - #include "gc_implementation/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" - #include "gc_implementation/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" - #include "gc_implementation/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp" #include "gc_implementation/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc_implementation/shenandoah/shenandoahFreeSet.hpp" - #include "gc_implementation/shenandoah/shenandoahHeuristics.hpp" #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp" #include "gc_implementation/shenandoah/shenandoahLogging.hpp" - void ShenandoahCollectorPolicy::record_gc_start() { - _heuristics->record_gc_start(); - } - - void ShenandoahCollectorPolicy::record_gc_end() { - _heuristics->record_gc_end(); - } - ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() : - _cycle_counter(0), _success_concurrent_gcs(0), - _success_partial_gcs(0), _success_degenerated_gcs(0), _success_full_gcs(0), - _explicit_concurrent(0), - _explicit_full(0), _alloc_failure_degenerated(0), _alloc_failure_full(0), ! _alloc_failure_degenerated_upgrade_to_full(0) ! { Copy::zero_to_bytes(_degen_points, sizeof(size_t) * ShenandoahHeap::_DEGENERATED_LIMIT); ! ShenandoahHeapRegion::setup_heap_region_size(initial_heap_byte_size(), max_heap_byte_size()); initialize_all(); _tracer = new (ResourceObj::C_HEAP, mtGC) ShenandoahTracer(); - - if (ShenandoahGCHeuristics != NULL) { - if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) { - _heuristics = new ShenandoahAggressiveHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "static") == 0) { - _heuristics = new ShenandoahStaticHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) { - _heuristics = new ShenandoahAdaptiveHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "passive") == 0) { - _heuristics = new ShenandoahPassiveHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "compact") == 0) { - _heuristics = new ShenandoahCompactHeuristics(); - } else { - vm_exit_during_initialization("Unknown -XX:ShenandoahGCHeuristics option"); - } - - if (_heuristics->is_diagnostic() && !UnlockDiagnosticVMOptions) { - vm_exit_during_initialization( - err_msg("Heuristics \"%s\" is diagnostic, and must be enabled via -XX:+UnlockDiagnosticVMOptions.", - _heuristics->name())); - } - if (_heuristics->is_experimental() && !UnlockExperimentalVMOptions) { - vm_exit_during_initialization( - err_msg("Heuristics \"%s\" is experimental, and must be enabled via -XX:+UnlockExperimentalVMOptions.", - _heuristics->name())); - } - log_info(gc, init)("Shenandoah heuristics: %s", - _heuristics->name()); - _heuristics->print_thresholds(); - } else { - ShouldNotReachHere(); - } - } - - ShenandoahCollectorPolicy* ShenandoahCollectorPolicy::as_pgc_policy() { - return this; } BarrierSet::Name ShenandoahCollectorPolicy::barrier_set_name() { return BarrierSet::ShenandoahBarrierSet; } --- 21,54 ---- * */ #include "precompiled.hpp" #include "gc_implementation/shared/gcTimer.hpp" #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp" #include "gc_implementation/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc_implementation/shenandoah/shenandoahFreeSet.hpp" #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp" #include "gc_implementation/shenandoah/shenandoahLogging.hpp" ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() : _success_concurrent_gcs(0), _success_degenerated_gcs(0), _success_full_gcs(0), _alloc_failure_degenerated(0), _alloc_failure_full(0), ! _alloc_failure_degenerated_upgrade_to_full(0), ! _explicit_concurrent(0), ! _explicit_full(0), ! _cycle_counter(0) { ! Copy::zero_to_bytes(_degen_points, sizeof(size_t) * ShenandoahHeap::_DEGENERATED_LIMIT); ! ShenandoahHeapRegion::setup_sizes(initial_heap_byte_size(), max_heap_byte_size()); initialize_all(); _tracer = new (ResourceObj::C_HEAP, mtGC) ShenandoahTracer(); } BarrierSet::Name ShenandoahCollectorPolicy::barrier_set_name() { return BarrierSet::ShenandoahBarrierSet; }
*** 121,226 **** // This is expected by our algorithm for ShenandoahHeap::heap_region_containing(). _space_alignment = ShenandoahHeapRegion::region_size_bytes(); _heap_alignment = ShenandoahHeapRegion::region_size_bytes(); } - void ShenandoahCollectorPolicy::post_heap_initialize() { - // Nothing to do here (yet). - } - void ShenandoahCollectorPolicy::record_explicit_to_concurrent() { - _heuristics->record_explicit_gc(); _explicit_concurrent++; } void ShenandoahCollectorPolicy::record_explicit_to_full() { - _heuristics->record_explicit_gc(); _explicit_full++; } void ShenandoahCollectorPolicy::record_alloc_failure_to_full() { - _heuristics->record_allocation_failure_gc(); _alloc_failure_full++; } void ShenandoahCollectorPolicy::record_alloc_failure_to_degenerated(ShenandoahHeap::ShenandoahDegenPoint point) { assert(point < ShenandoahHeap::_DEGENERATED_LIMIT, "sanity"); - _heuristics->record_allocation_failure_gc(); _alloc_failure_degenerated++; _degen_points[point]++; } void ShenandoahCollectorPolicy::record_degenerated_upgrade_to_full() { _alloc_failure_degenerated_upgrade_to_full++; } void ShenandoahCollectorPolicy::record_success_concurrent() { - _heuristics->record_success_concurrent(); _success_concurrent_gcs++; } - void ShenandoahCollectorPolicy::record_success_partial() { - _success_partial_gcs++; - } - void ShenandoahCollectorPolicy::record_success_degenerated() { - _heuristics->record_success_degenerated(); _success_degenerated_gcs++; } void ShenandoahCollectorPolicy::record_success_full() { - _heuristics->record_success_full(); _success_full_gcs++; } - bool ShenandoahCollectorPolicy::should_start_normal_gc() { - return _heuristics->should_start_normal_gc(); - } - - bool ShenandoahCollectorPolicy::should_degenerate_cycle() { - return _heuristics->should_degenerate_cycle(); - } - - bool ShenandoahCollectorPolicy::update_refs() { - return _heuristics->update_refs(); - } - - bool ShenandoahCollectorPolicy::should_start_update_refs() { - return _heuristics->should_start_update_refs(); - } - - void ShenandoahCollectorPolicy::record_peak_occupancy() { - _heuristics->record_peak_occupancy(); - } - - void ShenandoahCollectorPolicy::choose_collection_set(ShenandoahCollectionSet* collection_set) { - _heuristics->choose_collection_set(collection_set); - } - - bool ShenandoahCollectorPolicy::should_process_references() { - return _heuristics->should_process_references(); - } - - bool ShenandoahCollectorPolicy::should_unload_classes() { - return _heuristics->should_unload_classes(); - } - size_t ShenandoahCollectorPolicy::cycle_counter() const { return _cycle_counter; } - void ShenandoahCollectorPolicy::record_phase_time(ShenandoahPhaseTimings::Phase phase, double secs) { - _heuristics->record_phase_time(phase, secs); - } - void ShenandoahCollectorPolicy::record_cycle_start() { _cycle_counter++; - _heuristics->record_cycle_start(); - } - - void ShenandoahCollectorPolicy::record_cycle_end() { - _heuristics->record_cycle_end(); } void ShenandoahCollectorPolicy::record_shutdown() { _in_shutdown.set(); } --- 70,119 ----
*** 234,246 **** out->print_cr("under stop-the-world pause or result in stop-the-world Full GC. Increase heap size,"); out->print_cr("tune GC heuristics, set more aggressive pacing delay, or lower allocation rate"); out->print_cr("to avoid Degenerated and Full GC cycles."); out->cr(); - out->print_cr(SIZE_FORMAT_W(5) " successful partial concurrent GCs", _success_partial_gcs); - out->cr(); - out->print_cr(SIZE_FORMAT_W(5) " successful concurrent GCs", _success_concurrent_gcs); out->print_cr(" " SIZE_FORMAT_W(5) " invoked explicitly", _explicit_concurrent); out->cr(); out->print_cr(SIZE_FORMAT_W(5) " Degenerated GCs", _success_degenerated_gcs); --- 127,136 ----
< prev index next >