< prev index next >

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

Print this page
rev 8961 : [mq]: diff-shenandoah.patch


  34 // This class (or more correctly, subtypes of this class)
  35 // are used to define global garbage collector attributes.
  36 // This includes initialization of generations and any other
  37 // shared resources they may need.
  38 //
  39 // In general, all flag adjustment and validation should be
  40 // done in initialize_flags(), which is called prior to
  41 // initialize_size_info().
  42 //
  43 // This class is not fully developed yet. As more collector(s)
  44 // are added, it is expected that we will come across further
  45 // behavior that requires global attention. The correct place
  46 // to deal with those issues is this class.
  47 
  48 // Forward declarations.
  49 class GenCollectorPolicy;
  50 class AdaptiveSizePolicy;
  51 #if INCLUDE_ALL_GCS
  52 class ConcurrentMarkSweepPolicy;
  53 class G1CollectorPolicy;

  54 #endif // INCLUDE_ALL_GCS
  55 
  56 class GCPolicyCounters;
  57 class MarkSweepPolicy;
  58 
  59 class CollectorPolicy : public CHeapObj<mtGC> {
  60  protected:
  61   GCPolicyCounters* _gc_policy_counters;
  62 
  63   virtual void initialize_alignments() = 0;
  64   virtual void initialize_flags();
  65   virtual void initialize_size_info();
  66 
  67   DEBUG_ONLY(virtual void assert_flags();)
  68   DEBUG_ONLY(virtual void assert_size_info();)
  69 
  70   size_t _initial_heap_byte_size;
  71   size_t _max_heap_byte_size;
  72   size_t _min_heap_byte_size;
  73 


 113 
 114   AdaptiveSizePolicy* size_policy() { return _size_policy; }
 115   bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
 116   void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
 117   // Returns the current value of _should_clear_all_soft_refs.
 118   // _should_clear_all_soft_refs is set to false as a side effect.
 119   bool use_should_clear_all_soft_refs(bool v);
 120   bool all_soft_refs_clear() { return _all_soft_refs_clear; }
 121   void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
 122 
 123   // Called by the GC after Soft Refs have been cleared to indicate
 124   // that the request in _should_clear_all_soft_refs has been fulfilled.
 125   void cleared_all_soft_refs();
 126 
 127   // Identification methods.
 128   virtual GenCollectorPolicy*           as_generation_policy()            { return NULL; }
 129   virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
 130 #if INCLUDE_ALL_GCS
 131   virtual ConcurrentMarkSweepPolicy*    as_concurrent_mark_sweep_policy() { return NULL; }
 132   virtual G1CollectorPolicy*            as_g1_policy()                    { return NULL; }

 133 #endif // INCLUDE_ALL_GCS
 134   // Note that these are not virtual.
 135   bool is_generation_policy()            { return as_generation_policy() != NULL; }
 136   bool is_mark_sweep_policy()            { return as_mark_sweep_policy() != NULL; }
 137 #if INCLUDE_ALL_GCS
 138   bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
 139   bool is_g1_policy()                    { return as_g1_policy() != NULL; }

 140 #else  // INCLUDE_ALL_GCS
 141   bool is_concurrent_mark_sweep_policy() { return false; }
 142   bool is_g1_policy()                    { return false; }

 143 #endif // INCLUDE_ALL_GCS
 144 
 145 
 146   virtual GenRemSet* create_rem_set(MemRegion reserved);
 147 
 148   // This method controls how a collector satisfies a request
 149   // for a block of memory.  "gc_time_limit_was_exceeded" will
 150   // be set to true if the adaptive size policy determine that
 151   // an excessive amount of time is being spent doing collections
 152   // and caused a NULL to be returned.  If a NULL is not returned,
 153   // "gc_time_limit_was_exceeded" has an undefined meaning.
 154   virtual HeapWord* mem_allocate_work(size_t size,
 155                                       bool is_tlab,
 156                                       bool* gc_overhead_limit_was_exceeded) = 0;
 157 
 158   // This method controls how a collector handles one or more
 159   // of its generations being fully allocated.
 160   virtual HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab) = 0;
 161   // This method controls how a collector handles a metadata allocation
 162   // failure.




  34 // This class (or more correctly, subtypes of this class)
  35 // are used to define global garbage collector attributes.
  36 // This includes initialization of generations and any other
  37 // shared resources they may need.
  38 //
  39 // In general, all flag adjustment and validation should be
  40 // done in initialize_flags(), which is called prior to
  41 // initialize_size_info().
  42 //
  43 // This class is not fully developed yet. As more collector(s)
  44 // are added, it is expected that we will come across further
  45 // behavior that requires global attention. The correct place
  46 // to deal with those issues is this class.
  47 
  48 // Forward declarations.
  49 class GenCollectorPolicy;
  50 class AdaptiveSizePolicy;
  51 #if INCLUDE_ALL_GCS
  52 class ConcurrentMarkSweepPolicy;
  53 class G1CollectorPolicy;
  54 class ShenandoahCollectorPolicy;
  55 #endif // INCLUDE_ALL_GCS
  56 
  57 class GCPolicyCounters;
  58 class MarkSweepPolicy;
  59 
  60 class CollectorPolicy : public CHeapObj<mtGC> {
  61  protected:
  62   GCPolicyCounters* _gc_policy_counters;
  63 
  64   virtual void initialize_alignments() = 0;
  65   virtual void initialize_flags();
  66   virtual void initialize_size_info();
  67 
  68   DEBUG_ONLY(virtual void assert_flags();)
  69   DEBUG_ONLY(virtual void assert_size_info();)
  70 
  71   size_t _initial_heap_byte_size;
  72   size_t _max_heap_byte_size;
  73   size_t _min_heap_byte_size;
  74 


 114 
 115   AdaptiveSizePolicy* size_policy() { return _size_policy; }
 116   bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
 117   void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
 118   // Returns the current value of _should_clear_all_soft_refs.
 119   // _should_clear_all_soft_refs is set to false as a side effect.
 120   bool use_should_clear_all_soft_refs(bool v);
 121   bool all_soft_refs_clear() { return _all_soft_refs_clear; }
 122   void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
 123 
 124   // Called by the GC after Soft Refs have been cleared to indicate
 125   // that the request in _should_clear_all_soft_refs has been fulfilled.
 126   void cleared_all_soft_refs();
 127 
 128   // Identification methods.
 129   virtual GenCollectorPolicy*           as_generation_policy()            { return NULL; }
 130   virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
 131 #if INCLUDE_ALL_GCS
 132   virtual ConcurrentMarkSweepPolicy*    as_concurrent_mark_sweep_policy() { return NULL; }
 133   virtual G1CollectorPolicy*            as_g1_policy()                    { return NULL; }
 134   virtual ShenandoahCollectorPolicy*    as_pgc_policy()                    { return NULL; }
 135 #endif // INCLUDE_ALL_GCS
 136   // Note that these are not virtual.
 137   bool is_generation_policy()            { return as_generation_policy() != NULL; }
 138   bool is_mark_sweep_policy()            { return as_mark_sweep_policy() != NULL; }
 139 #if INCLUDE_ALL_GCS
 140   bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
 141   bool is_g1_policy()                    { return as_g1_policy() != NULL; }
 142   bool is_pgc_policy()                   { return as_pgc_policy() != NULL; }
 143 #else  // INCLUDE_ALL_GCS
 144   bool is_concurrent_mark_sweep_policy() { return false; }
 145   bool is_g1_policy()                    { return false; }
 146   bool is_pgc_policy()                    { return false; }
 147 #endif // INCLUDE_ALL_GCS
 148 
 149 
 150   virtual GenRemSet* create_rem_set(MemRegion reserved);
 151 
 152   // This method controls how a collector satisfies a request
 153   // for a block of memory.  "gc_time_limit_was_exceeded" will
 154   // be set to true if the adaptive size policy determine that
 155   // an excessive amount of time is being spent doing collections
 156   // and caused a NULL to be returned.  If a NULL is not returned,
 157   // "gc_time_limit_was_exceeded" has an undefined meaning.
 158   virtual HeapWord* mem_allocate_work(size_t size,
 159                                       bool is_tlab,
 160                                       bool* gc_overhead_limit_was_exceeded) = 0;
 161 
 162   // This method controls how a collector handles one or more
 163   // of its generations being fully allocated.
 164   virtual HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab) = 0;
 165   // This method controls how a collector handles a metadata allocation
 166   // failure.


< prev index next >