src/share/vm/memory/collectorPolicy.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/memory

src/share/vm/memory/collectorPolicy.hpp

Print this page
rev 6362 : 8042298: Remove the names gen0 and gen1 from the GC code
Summary: Renamed gen0 and gen1 to young and old throughout the GC code.
Reviewed-by:


 202 
 203 class ClearedAllSoftRefs : public StackObj {
 204   bool _clear_all_soft_refs;
 205   CollectorPolicy* _collector_policy;
 206  public:
 207   ClearedAllSoftRefs(bool clear_all_soft_refs,
 208                      CollectorPolicy* collector_policy) :
 209     _clear_all_soft_refs(clear_all_soft_refs),
 210     _collector_policy(collector_policy) {}
 211 
 212   ~ClearedAllSoftRefs() {
 213     if (_clear_all_soft_refs) {
 214       _collector_policy->cleared_all_soft_refs();
 215     }
 216   }
 217 };
 218 
 219 class GenCollectorPolicy : public CollectorPolicy {
 220 friend class TestGenCollectorPolicy;
 221  protected:
 222   size_t _min_gen0_size;
 223   size_t _initial_gen0_size;
 224   size_t _max_gen0_size;
 225   size_t _min_gen1_size;
 226   size_t _initial_gen1_size;
 227   size_t _max_gen1_size;
 228 
 229   // _gen_alignment and _space_alignment will have the same value most of the
 230   // time. When using large pages they can differ.
 231   size_t _gen_alignment;
 232 
 233   GenerationSpec **_generations;
 234 
 235   // Return true if an allocation should be attempted in the older generation
 236   // if it fails in the younger generation.  Return false, otherwise.
 237   virtual bool should_try_older_generation_allocation(size_t word_size) const;
 238 
 239   void initialize_flags();
 240   void initialize_size_info();
 241 
 242   DEBUG_ONLY(void assert_flags();)
 243   DEBUG_ONLY(void assert_size_info();)
 244 
 245   // Try to allocate space by expanding the heap.
 246   virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
 247 
 248   // Compute max heap alignment.
 249   size_t compute_max_alignment();
 250 
 251   // Scale the base_size by NewRatio according to
 252   //     result = base_size / (NewRatio + 1)
 253   // and align by min_alignment()
 254   size_t scale_by_NewRatio_aligned(size_t base_size);
 255 
 256   // Bound the value by the given maximum minus the min_alignment.
 257   size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
 258 
 259  public:
 260   GenCollectorPolicy();
 261 
 262   // Accessors
 263   size_t min_gen0_size()     { return _min_gen0_size; }
 264   size_t initial_gen0_size() { return _initial_gen0_size; }
 265   size_t max_gen0_size()     { return _max_gen0_size; }
 266   size_t gen_alignment()     { return _gen_alignment; }
 267   size_t min_gen1_size()     { return _min_gen1_size; }
 268   size_t initial_gen1_size() { return _initial_gen1_size; }
 269   size_t max_gen1_size()     { return _max_gen1_size; }
 270 
 271   int number_of_generations() { return 2; }
 272 
 273   virtual GenerationSpec **generations() {
 274     assert(_generations != NULL, "Sanity check");
 275     return _generations;
 276   }
 277 
 278   virtual GenCollectorPolicy* as_generation_policy() { return this; }
 279 
 280   virtual void initialize_generations() { };
 281 
 282   virtual void initialize_all() {
 283     CollectorPolicy::initialize_all();
 284     initialize_generations();
 285   }
 286 
 287   size_t young_gen_size_lower_bound();
 288 
 289   HeapWord* mem_allocate_work(size_t size,
 290                               bool is_tlab,
 291                               bool* gc_overhead_limit_was_exceeded);
 292 
 293   HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
 294 
 295   // Adaptive size policy
 296   virtual void initialize_size_policy(size_t init_eden_size,
 297                                       size_t init_promo_size,
 298                                       size_t init_survivor_size);
 299 
 300   virtual void post_heap_initialize() {
 301     assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info");
 302   }
 303 
 304   BarrierSet::Name barrier_set_name()  { return BarrierSet::CardTableModRef; }
 305 
 306   virtual CollectorPolicy::Name kind() {
 307     return CollectorPolicy::GenCollectorPolicyKind;
 308   }
 309 };
 310 
 311 class MarkSweepPolicy : public GenCollectorPolicy {
 312  protected:
 313   void initialize_alignments();
 314   void initialize_generations();
 315 
 316  public:
 317   MarkSweepPolicy() {}
 318 
 319   MarkSweepPolicy* as_mark_sweep_policy() { return this; }
 320 
 321   void initialize_gc_policy_counters();


 202 
 203 class ClearedAllSoftRefs : public StackObj {
 204   bool _clear_all_soft_refs;
 205   CollectorPolicy* _collector_policy;
 206  public:
 207   ClearedAllSoftRefs(bool clear_all_soft_refs,
 208                      CollectorPolicy* collector_policy) :
 209     _clear_all_soft_refs(clear_all_soft_refs),
 210     _collector_policy(collector_policy) {}
 211 
 212   ~ClearedAllSoftRefs() {
 213     if (_clear_all_soft_refs) {
 214       _collector_policy->cleared_all_soft_refs();
 215     }
 216   }
 217 };
 218 
 219 class GenCollectorPolicy : public CollectorPolicy {
 220 friend class TestGenCollectorPolicy;
 221  protected:
 222   size_t _min_young_size;
 223   size_t _initial_young_size;
 224   size_t _max_young_size;
 225   size_t _min_old_size;
 226   size_t _initial_old_size;
 227   size_t _max_old_size;
 228 
 229   // _gen_alignment and _space_alignment will have the same value most of the
 230   // time. When using large pages they can differ.
 231   size_t _gen_alignment;
 232 
 233   GenerationSpec **_generations;
 234 
 235   // Return true if an allocation should be attempted in the older generation
 236   // if it fails in the younger generation.  Return false, otherwise.
 237   virtual bool should_try_older_generation_allocation(size_t word_size) const;
 238 
 239   void initialize_flags();
 240   void initialize_size_info();
 241 
 242   DEBUG_ONLY(void assert_flags();)
 243   DEBUG_ONLY(void assert_size_info();)
 244 
 245   // Try to allocate space by expanding the heap.
 246   virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
 247 
 248   // Compute max heap alignment.
 249   size_t compute_max_alignment();
 250 
 251   // Scale the base_size by NewRatio according to
 252   //     result = base_size / (NewRatio + 1)
 253   // and align by min_alignment()
 254   size_t scale_by_NewRatio_aligned(size_t base_size);
 255 
 256   // Bound the value by the given maximum minus the min_alignment.
 257   size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
 258 
 259  public:
 260   GenCollectorPolicy();
 261 
 262   // Accessors
 263   size_t min_young_size()     { return _min_young_size; }
 264   size_t initial_young_size() { return _initial_young_size; }
 265   size_t max_young_size()     { return _max_young_size; }
 266   size_t gen_alignment()      { return _gen_alignment; }
 267   size_t min_old_size()       { return _min_old_size; }
 268   size_t initial_old_size()   { return _initial_old_size; }
 269   size_t max_old_size()       { return _max_old_size; }
 270 
 271   int number_of_generations() { return 2; }
 272 
 273   virtual GenerationSpec **generations() {
 274     assert(_generations != NULL, "Sanity check");
 275     return _generations;
 276   }
 277 
 278   virtual GenCollectorPolicy* as_generation_policy() { return this; }
 279 
 280   virtual void initialize_generations() { };
 281 
 282   virtual void initialize_all() {
 283     CollectorPolicy::initialize_all();
 284     initialize_generations();
 285   }
 286 
 287   size_t young_gen_size_lower_bound();
 288 
 289   HeapWord* mem_allocate_work(size_t size,
 290                               bool is_tlab,
 291                               bool* gc_overhead_limit_was_exceeded);
 292 
 293   HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
 294 
 295   // Adaptive size policy
 296   virtual void initialize_size_policy(size_t init_eden_size,
 297                                       size_t init_promo_size,
 298                                       size_t init_survivor_size);
 299 
 300   virtual void post_heap_initialize() {
 301     assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info");
 302   }
 303 
 304   BarrierSet::Name barrier_set_name()  { return BarrierSet::CardTableModRef; }
 305 
 306   virtual CollectorPolicy::Name kind() {
 307     return CollectorPolicy::GenCollectorPolicyKind;
 308   }
 309 };
 310 
 311 class MarkSweepPolicy : public GenCollectorPolicy {
 312  protected:
 313   void initialize_alignments();
 314   void initialize_generations();
 315 
 316  public:
 317   MarkSweepPolicy() {}
 318 
 319   MarkSweepPolicy* as_mark_sweep_policy() { return this; }
 320 
 321   void initialize_gc_policy_counters();
src/share/vm/memory/collectorPolicy.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File