Print this page
8236073: G1: Use SoftMaxHeapSize to guide GC heuristics


  46 // minimum size for young gen. Still using G1MaxNewSizePercent of the
  47 // heap as maximum.
  48 //
  49 // If only -XX:MaxNewSize is set we should use the specified value as the
  50 // maximum size for young gen. Still using G1NewSizePercent of the heap
  51 // as minimum.
  52 //
  53 // If -XX:NewSize and -XX:MaxNewSize are both specified we use these values.
  54 // No updates when the heap size changes. There is a special case when
  55 // NewSize==MaxNewSize. This is interpreted as "fixed" and will use a
  56 // different heuristic for calculating the collection set when we do mixed
  57 // collection.
  58 //
  59 // If only -XX:NewRatio is set we should use the specified ratio of the heap
  60 // as both min and max. This will be interpreted as "fixed" just like the
  61 // NewSize==MaxNewSize case above. But we will update the min and max
  62 // every time the heap size changes.
  63 //
  64 // NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is
  65 // combined with either NewSize or MaxNewSize. (A warning message is printed.)




  66 class G1YoungGenSizer : public CHeapObj<mtGC> {

  67 private:
  68   enum SizerKind {
  69     SizerDefaults,
  70     SizerNewSizeOnly,
  71     SizerMaxNewSizeOnly,
  72     SizerMaxAndNewSize,
  73     SizerNewRatio
  74   };
  75   SizerKind _sizer_kind;
  76 
  77   // False when using a fixed young generation size due to command-line options,
  78   // true otherwise.
  79   bool _use_adaptive_sizing;
  80 
  81   uint calculate_default_min_length(uint new_number_of_heap_regions);
  82   uint calculate_default_max_length(uint new_number_of_heap_regions);
  83 
  84   // Update the given values for minimum and maximum young gen length in regions
  85   // given the number of heap regions depending on the kind of sizing algorithm.
  86   void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);




  46 // minimum size for young gen. Still using G1MaxNewSizePercent of the
  47 // heap as maximum.
  48 //
  49 // If only -XX:MaxNewSize is set we should use the specified value as the
  50 // maximum size for young gen. Still using G1NewSizePercent of the heap
  51 // as minimum.
  52 //
  53 // If -XX:NewSize and -XX:MaxNewSize are both specified we use these values.
  54 // No updates when the heap size changes. There is a special case when
  55 // NewSize==MaxNewSize. This is interpreted as "fixed" and will use a
  56 // different heuristic for calculating the collection set when we do mixed
  57 // collection.
  58 //
  59 // If only -XX:NewRatio is set we should use the specified ratio of the heap
  60 // as both min and max. This will be interpreted as "fixed" just like the
  61 // NewSize==MaxNewSize case above. But we will update the min and max
  62 // every time the heap size changes.
  63 //
  64 // NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is
  65 // combined with either NewSize or MaxNewSize. (A warning message is printed.)
  66 
  67 // Forward declarations
  68 class G1HeapSizingPolicy;
  69 
  70 class G1YoungGenSizer : public CHeapObj<mtGC> {
  71   friend class G1HeapSizingPolicy;
  72 private:
  73   enum SizerKind {
  74     SizerDefaults,
  75     SizerNewSizeOnly,
  76     SizerMaxNewSizeOnly,
  77     SizerMaxAndNewSize,
  78     SizerNewRatio
  79   };
  80   SizerKind _sizer_kind;
  81 
  82   // False when using a fixed young generation size due to command-line options,
  83   // true otherwise.
  84   bool _use_adaptive_sizing;
  85 
  86   uint calculate_default_min_length(uint new_number_of_heap_regions);
  87   uint calculate_default_max_length(uint new_number_of_heap_regions);
  88 
  89   // Update the given values for minimum and maximum young gen length in regions
  90   // given the number of heap regions depending on the kind of sizing algorithm.
  91   void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);