< prev index next >

src/hotspot/share/gc/shared/collectorPolicy.hpp

Print this page




 140 protected:
 141   size_t _min_young_size;
 142   size_t _initial_young_size;
 143   size_t _max_young_size;
 144   size_t _min_old_size;
 145   size_t _initial_old_size;
 146   size_t _max_old_size;
 147 
 148   // _gen_alignment and _space_alignment will have the same value most of the
 149   // time. When using large pages they can differ.
 150   size_t _gen_alignment;
 151 
 152   GenerationSpec* _young_gen_spec;
 153   GenerationSpec* _old_gen_spec;
 154 
 155   GCPolicyCounters* _gc_policy_counters;
 156 
 157   // The sizing of the heap is controlled by a sizing policy.
 158   AdaptiveSizePolicy* _size_policy;
 159 
 160   // Return true if an allocation should be attempted in the older generation
 161   // if it fails in the younger generation.  Return false, otherwise.
 162   virtual bool should_try_older_generation_allocation(size_t word_size) const;
 163 
 164   void initialize_flags();
 165   void initialize_size_info();
 166 
 167   DEBUG_ONLY(void assert_flags();)
 168   DEBUG_ONLY(void assert_size_info();)
 169 
 170   // Try to allocate space by expanding the heap.
 171   virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
 172 
 173   // Compute max heap alignment.
 174   size_t compute_max_alignment();
 175 
 176   // Scale the base_size by NewRatio according to
 177   //     result = base_size / (NewRatio + 1)
 178   // and align by min_alignment()
 179   size_t scale_by_NewRatio_aligned(size_t base_size);
 180 
 181   // Bound the value by the given maximum minus the min_alignment.
 182   size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
 183 
 184  public:
 185   GenCollectorPolicy();
 186 
 187   // Accessors
 188   size_t min_young_size()     { return _min_young_size; }
 189   size_t initial_young_size() { return _initial_young_size; }
 190   size_t max_young_size()     { return _max_young_size; }
 191   size_t gen_alignment()      { return _gen_alignment; }
 192   size_t min_old_size()       { return _min_old_size; }


 202     assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized");
 203     return _old_gen_spec;
 204   }
 205 
 206   // Performance Counter support
 207   GCPolicyCounters* counters()     { return _gc_policy_counters; }
 208 
 209   // Create the jstat counters for the GC policy.
 210   virtual void initialize_gc_policy_counters() = 0;
 211 
 212   virtual void initialize_generations() { };
 213 
 214   virtual void initialize_all() {
 215     CollectorPolicy::initialize_all();
 216     initialize_generations();
 217   }
 218 
 219   size_t young_gen_size_lower_bound();
 220 
 221   size_t old_gen_size_lower_bound();
 222 
 223   HeapWord* mem_allocate_work(size_t size,
 224                               bool is_tlab,
 225                               bool* gc_overhead_limit_was_exceeded);
 226 
 227   HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
 228 
 229   // Adaptive size policy
 230   AdaptiveSizePolicy* size_policy() { return _size_policy; }
 231 
 232   virtual void initialize_size_policy(size_t init_eden_size,
 233                                       size_t init_promo_size,
 234                                       size_t init_survivor_size);
 235 
 236   virtual void cleared_all_soft_refs();
 237 
 238 };
 239 
 240 class MarkSweepPolicy : public GenCollectorPolicy {
 241  protected:
 242   void initialize_alignments();
 243   void initialize_generations();
 244 
 245  public:
 246   MarkSweepPolicy() {}
 247 


 140 protected:
 141   size_t _min_young_size;
 142   size_t _initial_young_size;
 143   size_t _max_young_size;
 144   size_t _min_old_size;
 145   size_t _initial_old_size;
 146   size_t _max_old_size;
 147 
 148   // _gen_alignment and _space_alignment will have the same value most of the
 149   // time. When using large pages they can differ.
 150   size_t _gen_alignment;
 151 
 152   GenerationSpec* _young_gen_spec;
 153   GenerationSpec* _old_gen_spec;
 154 
 155   GCPolicyCounters* _gc_policy_counters;
 156 
 157   // The sizing of the heap is controlled by a sizing policy.
 158   AdaptiveSizePolicy* _size_policy;
 159 




 160   void initialize_flags();
 161   void initialize_size_info();
 162 
 163   DEBUG_ONLY(void assert_flags();)
 164   DEBUG_ONLY(void assert_size_info();)
 165 



 166   // Compute max heap alignment.
 167   size_t compute_max_alignment();
 168 
 169   // Scale the base_size by NewRatio according to
 170   //     result = base_size / (NewRatio + 1)
 171   // and align by min_alignment()
 172   size_t scale_by_NewRatio_aligned(size_t base_size);
 173 
 174   // Bound the value by the given maximum minus the min_alignment.
 175   size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
 176 
 177  public:
 178   GenCollectorPolicy();
 179 
 180   // Accessors
 181   size_t min_young_size()     { return _min_young_size; }
 182   size_t initial_young_size() { return _initial_young_size; }
 183   size_t max_young_size()     { return _max_young_size; }
 184   size_t gen_alignment()      { return _gen_alignment; }
 185   size_t min_old_size()       { return _min_old_size; }


 195     assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized");
 196     return _old_gen_spec;
 197   }
 198 
 199   // Performance Counter support
 200   GCPolicyCounters* counters()     { return _gc_policy_counters; }
 201 
 202   // Create the jstat counters for the GC policy.
 203   virtual void initialize_gc_policy_counters() = 0;
 204 
 205   virtual void initialize_generations() { };
 206 
 207   virtual void initialize_all() {
 208     CollectorPolicy::initialize_all();
 209     initialize_generations();
 210   }
 211 
 212   size_t young_gen_size_lower_bound();
 213 
 214   size_t old_gen_size_lower_bound();






 215 
 216   // Adaptive size policy
 217   AdaptiveSizePolicy* size_policy() { return _size_policy; }
 218 
 219   virtual void initialize_size_policy(size_t init_eden_size,
 220                                       size_t init_promo_size,
 221                                       size_t init_survivor_size);
 222 
 223   virtual void cleared_all_soft_refs();
 224 
 225 };
 226 
 227 class MarkSweepPolicy : public GenCollectorPolicy {
 228  protected:
 229   void initialize_alignments();
 230   void initialize_generations();
 231 
 232  public:
 233   MarkSweepPolicy() {}
 234 
< prev index next >