< prev index next >

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

Print this page
rev 13243 : 8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
Reviewed-by: pliden, mgerdin

@@ -70,13 +70,10 @@
   size_t _min_heap_byte_size;
 
   size_t _space_alignment;
   size_t _heap_alignment;
 
-  // The sizing of the heap is controlled by a sizing policy.
-  AdaptiveSizePolicy* _size_policy;
-
   // Set to true when policy wants soft refs cleared.
   // Reset to false by gc after it clears all soft refs.
   bool _should_clear_all_soft_refs;
 
   // Set to true by the GC if the just-completed gc cleared all

@@ -103,22 +100,21 @@
 
   size_t initial_heap_byte_size() { return _initial_heap_byte_size; }
   size_t max_heap_byte_size()     { return _max_heap_byte_size; }
   size_t min_heap_byte_size()     { return _min_heap_byte_size; }
 
-  AdaptiveSizePolicy* size_policy() { return _size_policy; }
   bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
   void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
   // Returns the current value of _should_clear_all_soft_refs.
   // _should_clear_all_soft_refs is set to false as a side effect.
   bool use_should_clear_all_soft_refs(bool v);
   bool all_soft_refs_clear() { return _all_soft_refs_clear; }
   void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
 
   // Called by the GC after Soft Refs have been cleared to indicate
   // that the request in _should_clear_all_soft_refs has been fulfilled.
-  void cleared_all_soft_refs();
+  virtual void cleared_all_soft_refs();
 
   // Identification methods.
   virtual GenCollectorPolicy*           as_generation_policy()            { return NULL; }
   virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
 #if INCLUDE_ALL_GCS

@@ -158,11 +154,12 @@
 };
 
 class GenCollectorPolicy : public CollectorPolicy {
   friend class TestGenCollectorPolicy;
   friend class VMStructs;
- protected:
+
+protected:
   size_t _min_young_size;
   size_t _initial_young_size;
   size_t _max_young_size;
   size_t _min_old_size;
   size_t _initial_old_size;

@@ -175,10 +172,13 @@
   GenerationSpec* _young_gen_spec;
   GenerationSpec* _old_gen_spec;
 
   GCPolicyCounters* _gc_policy_counters;
 
+  // The sizing of the heap is controlled by a sizing policy.
+  AdaptiveSizePolicy* _size_policy;
+
   // Return true if an allocation should be attempted in the older generation
   // if it fails in the younger generation.  Return false, otherwise.
   virtual bool should_try_older_generation_allocation(size_t word_size) const;
 
   void initialize_flags();

@@ -247,13 +247,18 @@
                               bool* gc_overhead_limit_was_exceeded);
 
   HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
 
   // Adaptive size policy
+  AdaptiveSizePolicy* size_policy() { return _size_policy; }
+
   virtual void initialize_size_policy(size_t init_eden_size,
                                       size_t init_promo_size,
                                       size_t init_survivor_size);
+
+  virtual void cleared_all_soft_refs();
+
 };
 
 class MarkSweepPolicy : public GenCollectorPolicy {
  protected:
   void initialize_alignments();
< prev index next >