src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54833 76751d3faf7b
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    27 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
    27 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
    28 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
    28 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
    29 #include "logging/log.hpp"
    29 #include "logging/log.hpp"
    30 #include "logging/logTag.hpp"
    30 #include "logging/logTag.hpp"
    31 
    31 
    32 ShenandoahPassiveHeuristics::ShenandoahPassiveHeuristics() : ShenandoahHeuristics() {
    32 bool ShenandoahPassiveHeuristics::should_start_gc() const {
    33   // Do not allow concurrent cycles.
       
    34   FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false);
       
    35   FLAG_SET_DEFAULT(ShenandoahImplicitGCInvokesConcurrent, false);
       
    36 
       
    37   // Passive runs with max speed, reacts on allocation failure.
       
    38   FLAG_SET_DEFAULT(ShenandoahPacing, false);
       
    39 
       
    40   // No need for evacuation reserve with Full GC, only for Degenerated GC.
       
    41   if (!ShenandoahDegeneratedGC) {
       
    42     SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0);
       
    43   }
       
    44 
       
    45   // Disable known barriers by default.
       
    46   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahLoadRefBarrier);
       
    47   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier);
       
    48   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahKeepAliveBarrier);
       
    49   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahStoreValEnqueueBarrier);
       
    50   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier);
       
    51   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier);
       
    52 
       
    53   // Final configuration checks
       
    54   // No barriers are required to run.
       
    55 }
       
    56 
       
    57 bool ShenandoahPassiveHeuristics::should_start_normal_gc() const {
       
    58   // Never do concurrent GCs.
    33   // Never do concurrent GCs.
    59   return false;
    34   return false;
    60 }
    35 }
    61 
    36 
    62 bool ShenandoahPassiveHeuristics::should_process_references() {
    37 bool ShenandoahPassiveHeuristics::should_process_references() {
    83   // Take at least the entire evacuation reserve, and be free to overflow to free space.
    58   // Take at least the entire evacuation reserve, and be free to overflow to free space.
    84   size_t capacity  = ShenandoahHeap::heap()->max_capacity();
    59   size_t capacity  = ShenandoahHeap::heap()->max_capacity();
    85   size_t available = MAX2(capacity / 100 * ShenandoahEvacReserve, actual_free);
    60   size_t available = MAX2(capacity / 100 * ShenandoahEvacReserve, actual_free);
    86   size_t max_cset  = (size_t)(available / ShenandoahEvacWaste);
    61   size_t max_cset  = (size_t)(available / ShenandoahEvacWaste);
    87 
    62 
    88   log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "M, Max CSet: " SIZE_FORMAT "M",
    63   log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "%s, Max CSet: " SIZE_FORMAT "%s",
    89                      actual_free / M, max_cset / M);
    64                      byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free),
       
    65                      byte_size_in_proper_unit(max_cset),    proper_unit_for_byte_size(max_cset));
    90 
    66 
    91   size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
    67   size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
    92 
    68 
    93   size_t live_cset = 0;
    69   size_t live_cset = 0;
    94   for (size_t idx = 0; idx < size; idx++) {
    70   for (size_t idx = 0; idx < size; idx++) {