< prev index next >

src/share/vm/gc_implementation/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp

Print this page
rev 10620 : [backport] Evac reserve: make sure GC has untouchable space to move the objects into
rev 10632 : [backport] Passive heuristics should enter degen GC, not full GC

@@ -26,37 +26,31 @@
 #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp"
 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
 #include "gc_implementation/shenandoah/shenandoahHeapRegion.hpp"
 #include "gc_implementation/shenandoah/shenandoahLogging.hpp"
 
-ShenandoahPassiveHeuristics::ShenandoahPassiveHeuristics() : ShenandoahHeuristics() {
+ShenandoahPassiveHeuristics::ShenandoahPassiveHeuristics() : ShenandoahAdaptiveHeuristics() {
   // Do not allow concurrent cycles.
   FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false);
 
   // Passive runs with max speed, reacts on allocation failure.
   FLAG_SET_DEFAULT(ShenandoahPacing, false);
 
+  // No need for evacuation reserve with Full GC, only for Degenerated GC.
+  if (!ShenandoahDegeneratedGC) {
+    SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0);
+  }
+
   // Disable known barriers by default.
   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier);
   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahWriteBarrier);
   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahReadBarrier);
   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier);
   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahAcmpBarrier);
   SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier);
 }
 
-void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
-                                                                        RegionData* data, size_t size,
-                                                                        size_t free) {
-  for (size_t idx = 0; idx < size; idx++) {
-    ShenandoahHeapRegion* r = data[idx]._region;
-    if (r->garbage() > 0) {
-      cset->add_region(r);
-    }
-  }
-}
-
 bool ShenandoahPassiveHeuristics::should_start_normal_gc() const {
   // Never do concurrent GCs.
   return false;
 }
 

@@ -71,12 +65,12 @@
   // Always unload classes.
   return true;
 }
 
 bool ShenandoahPassiveHeuristics::should_degenerate_cycle() {
-  // Always fail to Full GC
-  return false;
+  // Always fail to Degenerated GC, if enabled
+  return ShenandoahDegeneratedGC;
 }
 
 const char* ShenandoahPassiveHeuristics::name() {
   return "passive";
 }
< prev index next >