< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp

Print this page

 54 
 55   volatile size_t _affiliated_region_count;
 56 
 57   // How much free memory is left in the last region of humongous objects.
 58   // This is _not_ included in used, but it _is_ deducted from available,
 59   // which gives the heuristics a more accurate view of how much memory remains
 60   // for allocation. This figure is also included the heap status logging.
 61   // The units are bytes. The value is only changed on a safepoint or under the
 62   // heap lock.
 63   size_t _humongous_waste;
 64 
 65   // Bytes reserved within this generation to hold evacuated objects from the collection set
 66   size_t _evacuation_reserve;
 67 
 68 protected:
 69   // Usage
 70 
 71   volatile size_t _used;
 72   volatile size_t _bytes_allocated_since_gc_start;
 73   size_t _max_capacity;
 74   size_t _soft_max_capacity;
 75 
 76   ShenandoahHeuristics* _heuristics;
 77 
 78 private:
 79   // Compute evacuation budgets prior to choosing collection set.
 80   void compute_evacuation_budgets(ShenandoahHeap* heap);
 81 
 82   // Adjust evacuation budgets after choosing collection set.
 83   void adjust_evacuation_budgets(ShenandoahHeap* heap,
 84                                  ShenandoahCollectionSet* collection_set);
 85 
 86   // Preselect for possible inclusion into the collection set exactly the most
 87   // garbage-dense regions, including those that satisfy criteria 1 & 2 below,
 88   // and whose live bytes will fit within old_available budget:
 89   // Criterion 1. region age >= tenuring threshold
 90   // Criterion 2. region garbage percentage > ShenandoahOldGarbageThreshold
 91   //
 92   // Identifies regions eligible for promotion in place,
 93   // being those of at least tenuring_threshold age that have lower garbage
 94   // density.
 95   //
 96   // Updates promotion_potential and pad_for_promote_in_place fields
 97   // of the heap. Returns bytes of live object memory in the preselected
 98   // regions, which are marked in the preselected_regions() indicator
 99   // array of the heap's collection set, which should be initialized
100   // to false.
101   size_t select_aged_regions(size_t old_available);
102 
103   size_t available(size_t capacity) const;
104 
105  public:
106   ShenandoahGeneration(ShenandoahGenerationType type,
107                        uint max_workers,
108                        size_t max_capacity,
109                        size_t soft_max_capacity);
110   ~ShenandoahGeneration();
111 
112   bool is_young() const  { return _type == YOUNG; }
113   bool is_old() const    { return _type == OLD; }
114   bool is_global() const { return _type == GLOBAL || _type == NON_GEN; }
115 
116   // see description in field declaration
117   void set_evacuation_reserve(size_t new_val);
118   size_t get_evacuation_reserve() const;
119   void augment_evacuation_reserve(size_t increment);
120 
121   inline ShenandoahGenerationType type() const { return _type; }
122 
123   virtual ShenandoahHeuristics* heuristics() const { return _heuristics; }
124 
125   ShenandoahReferenceProcessor* ref_processor() { return _ref_processor; }
126 
127   virtual ShenandoahHeuristics* initialize_heuristics(ShenandoahMode* gc_mode);
128 
129   size_t soft_max_capacity() const override { return _soft_max_capacity; }
130   size_t max_capacity() const override      { return _max_capacity; }
131   virtual size_t used_regions() const;
132   virtual size_t used_regions_size() const;
133   virtual size_t free_unaffiliated_regions() const;
134   size_t used() const override { return Atomic::load(&_used); }
135   size_t available() const override;
136   size_t available_with_reserve() const;
137   size_t used_including_humongous_waste() const {
138     return used() + get_humongous_waste();
139   }
140 
141   // Returns the memory available based on the _soft_ max heap capacity (soft_max_heap - used).
142   // The soft max heap size may be adjusted lower than the max heap size to cause the trigger
143   // to believe it has less memory available than is _really_ available. Lowering the soft
144   // max heap size will cause the adaptive heuristic to run more frequent cycles.
145   size_t soft_available() const override;
146 
147   size_t bytes_allocated_since_gc_start() const override;
148   void reset_bytes_allocated_since_gc_start();
149   void increase_allocated(size_t bytes);

 54 
 55   volatile size_t _affiliated_region_count;
 56 
 57   // How much free memory is left in the last region of humongous objects.
 58   // This is _not_ included in used, but it _is_ deducted from available,
 59   // which gives the heuristics a more accurate view of how much memory remains
 60   // for allocation. This figure is also included the heap status logging.
 61   // The units are bytes. The value is only changed on a safepoint or under the
 62   // heap lock.
 63   size_t _humongous_waste;
 64 
 65   // Bytes reserved within this generation to hold evacuated objects from the collection set
 66   size_t _evacuation_reserve;
 67 
 68 protected:
 69   // Usage
 70 
 71   volatile size_t _used;
 72   volatile size_t _bytes_allocated_since_gc_start;
 73   size_t _max_capacity;

 74 
 75   ShenandoahHeuristics* _heuristics;
 76 
 77 private:
 78   // Compute evacuation budgets prior to choosing collection set.
 79   void compute_evacuation_budgets(ShenandoahHeap* heap);
 80 
 81   // Adjust evacuation budgets after choosing collection set.
 82   void adjust_evacuation_budgets(ShenandoahHeap* heap,
 83                                  ShenandoahCollectionSet* collection_set);
 84 
 85   // Preselect for possible inclusion into the collection set exactly the most
 86   // garbage-dense regions, including those that satisfy criteria 1 & 2 below,
 87   // and whose live bytes will fit within old_available budget:
 88   // Criterion 1. region age >= tenuring threshold
 89   // Criterion 2. region garbage percentage > ShenandoahOldGarbageThreshold
 90   //
 91   // Identifies regions eligible for promotion in place,
 92   // being those of at least tenuring_threshold age that have lower garbage
 93   // density.
 94   //
 95   // Updates promotion_potential and pad_for_promote_in_place fields
 96   // of the heap. Returns bytes of live object memory in the preselected
 97   // regions, which are marked in the preselected_regions() indicator
 98   // array of the heap's collection set, which should be initialized
 99   // to false.
100   size_t select_aged_regions(size_t old_available);
101 
102   size_t available(size_t capacity) const;
103 
104  public:
105   ShenandoahGeneration(ShenandoahGenerationType type,
106                        uint max_workers,
107                        size_t max_capacity);

108   ~ShenandoahGeneration();
109 
110   bool is_young() const  { return _type == YOUNG; }
111   bool is_old() const    { return _type == OLD; }
112   bool is_global() const { return _type == GLOBAL || _type == NON_GEN; }
113 
114   // see description in field declaration
115   void set_evacuation_reserve(size_t new_val);
116   size_t get_evacuation_reserve() const;
117   void augment_evacuation_reserve(size_t increment);
118 
119   inline ShenandoahGenerationType type() const { return _type; }
120 
121   virtual ShenandoahHeuristics* heuristics() const { return _heuristics; }
122 
123   ShenandoahReferenceProcessor* ref_processor() { return _ref_processor; }
124 
125   virtual ShenandoahHeuristics* initialize_heuristics(ShenandoahMode* gc_mode);
126 

127   size_t max_capacity() const override      { return _max_capacity; }
128   virtual size_t used_regions() const;
129   virtual size_t used_regions_size() const;
130   virtual size_t free_unaffiliated_regions() const;
131   size_t used() const override { return Atomic::load(&_used); }
132   size_t available() const override;
133   size_t available_with_reserve() const;
134   size_t used_including_humongous_waste() const {
135     return used() + get_humongous_waste();
136   }
137 
138   // Returns the memory available based on the _soft_ max heap capacity (soft_max_heap - used).
139   // The soft max heap size may be adjusted lower than the max heap size to cause the trigger
140   // to believe it has less memory available than is _really_ available. Lowering the soft
141   // max heap size will cause the adaptive heuristic to run more frequent cycles.
142   size_t soft_available() const override;
143 
144   size_t bytes_allocated_since_gc_start() const override;
145   void reset_bytes_allocated_since_gc_start();
146   void increase_allocated(size_t bytes);
< prev index next >