< prev index next >

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

Print this page




  35   // than free threshold. ShenandoahAllocationThreshold is supposed to break this,
  36   // but it only works if it is non-zero.
  37   SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahAllocationThreshold, 1);
  38 
  39   SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent);
  40   SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent);
  41 
  42   // Final configuration checks
  43   SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier);
  44   SHENANDOAH_CHECK_FLAG_SET(ShenandoahSATBBarrier);
  45   SHENANDOAH_CHECK_FLAG_SET(ShenandoahKeepAliveBarrier);
  46   SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier);
  47   SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier);
  48 }
  49 
  50 ShenandoahStaticHeuristics::~ShenandoahStaticHeuristics() {}
  51 
  52 bool ShenandoahStaticHeuristics::should_start_normal_gc() const {
  53   ShenandoahHeap* heap = ShenandoahHeap::heap();
  54 
  55   size_t capacity = heap->max_capacity();
  56   size_t available = heap->free_set()->available();
  57   size_t threshold_available = (capacity * ShenandoahFreeThreshold) / 100;
  58 
  59   if (available < threshold_available) {
  60     log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below free threshold (" SIZE_FORMAT "M)",
  61                  available / M, threshold_available / M);
  62     return true;
  63   }
  64   return ShenandoahHeuristics::should_start_normal_gc();
  65 }
  66 
  67 void ShenandoahStaticHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
  68                                                                        RegionData* data, size_t size,
  69                                                                        size_t free) {
  70   size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
  71 
  72   for (size_t idx = 0; idx < size; idx++) {
  73     ShenandoahHeapRegion* r = data[idx]._region;
  74     if (r->garbage() > threshold) {
  75       cset->add_region(r);


  35   // than free threshold. ShenandoahAllocationThreshold is supposed to break this,
  36   // but it only works if it is non-zero.
  37   SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahAllocationThreshold, 1);
  38 
  39   SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent);
  40   SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent);
  41 
  42   // Final configuration checks
  43   SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier);
  44   SHENANDOAH_CHECK_FLAG_SET(ShenandoahSATBBarrier);
  45   SHENANDOAH_CHECK_FLAG_SET(ShenandoahKeepAliveBarrier);
  46   SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier);
  47   SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier);
  48 }
  49 
  50 ShenandoahStaticHeuristics::~ShenandoahStaticHeuristics() {}
  51 
  52 bool ShenandoahStaticHeuristics::should_start_normal_gc() const {
  53   ShenandoahHeap* heap = ShenandoahHeap::heap();
  54 
  55   size_t capacity = heap->capacity();
  56   size_t available = heap->free_set()->available();
  57   size_t threshold_available = (capacity * ShenandoahFreeThreshold) / 100;
  58 
  59   if (available < threshold_available) {
  60     log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below free threshold (" SIZE_FORMAT "M)",
  61                  available / M, threshold_available / M);
  62     return true;
  63   }
  64   return ShenandoahHeuristics::should_start_normal_gc();
  65 }
  66 
  67 void ShenandoahStaticHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
  68                                                                        RegionData* data, size_t size,
  69                                                                        size_t free) {
  70   size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
  71 
  72   for (size_t idx = 0; idx < size; idx++) {
  73     ShenandoahHeapRegion* r = data[idx]._region;
  74     if (r->garbage() > threshold) {
  75       cset->add_region(r);
< prev index next >