< prev index next >

src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp

Print this page
*** 29,11 ***
  #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
  #include "logging/log.hpp"
  #include "logging/logTag.hpp"
  #include "runtime/os.hpp"
  
! ShenandoahAggressiveHeuristics::ShenandoahAggressiveHeuristics() : ShenandoahHeuristics() {
    // Do not shortcut evacuation
    SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahImmediateThreshold, 100);
  
    // Aggressive evacuates everything, so it needs as much evac space as it can get
    SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahEvacReserveOverflow);
--- 29,11 ---
  #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
  #include "logging/log.hpp"
  #include "logging/logTag.hpp"
  #include "runtime/os.hpp"
  
! ShenandoahAggressiveHeuristics::ShenandoahAggressiveHeuristics(ShenandoahGeneration* generation) : ShenandoahHeuristics(generation) {
    // Do not shortcut evacuation
    SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahImmediateThreshold, 100);
  
    // Aggressive evacuates everything, so it needs as much evac space as it can get
    SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahEvacReserveOverflow);

*** 46,10 ***
--- 46,14 ---
  }
  
  void ShenandoahAggressiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
                                                                             RegionData* data, size_t size,
                                                                             size_t free) {
+   assert(!ShenandoahHeap::heap()->mode()->is_generational(), "AggressiveHeuristics not appropriate in generational mode");
+ 
+   // Note that there's no bound on collection set size.  If we try to collect too much memory, we'll get an alloc
+   // failure during collection and we'll degenerate.
    for (size_t idx = 0; idx < size; idx++) {
      ShenandoahHeapRegion* r = data[idx]._region;
      if (r->garbage() > 0) {
        cset->add_region(r);
      }
< prev index next >