< prev index next >

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

Print this page




  97 
  98   size_t space_alignment()        { return _space_alignment; }
  99   size_t heap_alignment()         { return _heap_alignment; }
 100 
 101   size_t initial_heap_byte_size() { return _initial_heap_byte_size; }
 102   size_t max_heap_byte_size()     { return _max_heap_byte_size; }
 103   size_t min_heap_byte_size()     { return _min_heap_byte_size; }
 104 
 105   bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
 106   void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
 107   // Returns the current value of _should_clear_all_soft_refs.
 108   // _should_clear_all_soft_refs is set to false as a side effect.
 109   bool use_should_clear_all_soft_refs(bool v);
 110   bool all_soft_refs_clear() { return _all_soft_refs_clear; }
 111   void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
 112 
 113   // Called by the GC after Soft Refs have been cleared to indicate
 114   // that the request in _should_clear_all_soft_refs has been fulfilled.
 115   virtual void cleared_all_soft_refs();
 116 
 117   // Identification methods.
 118   virtual GenCollectorPolicy*           as_generation_policy()            { return NULL; }
 119   virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
 120 #if INCLUDE_ALL_GCS
 121   virtual ConcurrentMarkSweepPolicy*    as_concurrent_mark_sweep_policy() { return NULL; }
 122 #endif // INCLUDE_ALL_GCS
 123   // Note that these are not virtual.
 124   bool is_generation_policy()            { return as_generation_policy() != NULL; }
 125   bool is_mark_sweep_policy()            { return as_mark_sweep_policy() != NULL; }
 126 #if INCLUDE_ALL_GCS
 127   bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
 128 #else  // INCLUDE_ALL_GCS
 129   bool is_concurrent_mark_sweep_policy() { return false; }
 130 #endif // INCLUDE_ALL_GCS
 131 
 132 
 133   virtual CardTableRS* create_rem_set(MemRegion reserved);
 134 
 135   MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
 136                                                size_t size,
 137                                                Metaspace::MetadataType mdtype);
 138 };
 139 
 140 class ClearedAllSoftRefs : public StackObj {
 141   bool _clear_all_soft_refs;
 142   CollectorPolicy* _collector_policy;
 143  public:
 144   ClearedAllSoftRefs(bool clear_all_soft_refs,
 145                      CollectorPolicy* collector_policy) :
 146     _clear_all_soft_refs(clear_all_soft_refs),
 147     _collector_policy(collector_policy) {}
 148 
 149   ~ClearedAllSoftRefs() {
 150     if (_clear_all_soft_refs) {
 151       _collector_policy->cleared_all_soft_refs();
 152     }


 214   size_t min_old_size()       { return _min_old_size; }
 215   size_t initial_old_size()   { return _initial_old_size; }
 216   size_t max_old_size()       { return _max_old_size; }
 217 
 218   GenerationSpec* young_gen_spec() const {
 219     assert(_young_gen_spec != NULL, "_young_gen_spec should have been initialized");
 220     return _young_gen_spec;
 221   }
 222 
 223   GenerationSpec* old_gen_spec() const {
 224     assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized");
 225     return _old_gen_spec;
 226   }
 227 
 228   // Performance Counter support
 229   GCPolicyCounters* counters()     { return _gc_policy_counters; }
 230 
 231   // Create the jstat counters for the GC policy.
 232   virtual void initialize_gc_policy_counters() = 0;
 233 
 234   virtual GenCollectorPolicy* as_generation_policy() { return this; }
 235 
 236   virtual void initialize_generations() { };
 237 
 238   virtual void initialize_all() {
 239     CollectorPolicy::initialize_all();
 240     initialize_generations();
 241   }
 242 
 243   size_t young_gen_size_lower_bound();
 244 
 245   size_t old_gen_size_lower_bound();
 246 
 247   HeapWord* mem_allocate_work(size_t size,
 248                               bool is_tlab,
 249                               bool* gc_overhead_limit_was_exceeded);
 250 
 251   HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
 252 
 253   // Adaptive size policy
 254   AdaptiveSizePolicy* size_policy() { return _size_policy; }
 255 
 256   virtual void initialize_size_policy(size_t init_eden_size,
 257                                       size_t init_promo_size,
 258                                       size_t init_survivor_size);
 259 
 260   virtual void cleared_all_soft_refs();
 261 
 262 };
 263 
 264 class MarkSweepPolicy : public GenCollectorPolicy {
 265  protected:
 266   void initialize_alignments();
 267   void initialize_generations();
 268 
 269  public:
 270   MarkSweepPolicy() {}
 271 
 272   MarkSweepPolicy* as_mark_sweep_policy() { return this; }
 273 
 274   void initialize_gc_policy_counters();
 275 };
 276 
 277 #endif // SHARE_VM_GC_SHARED_COLLECTORPOLICY_HPP


  97 
  98   size_t space_alignment()        { return _space_alignment; }
  99   size_t heap_alignment()         { return _heap_alignment; }
 100 
 101   size_t initial_heap_byte_size() { return _initial_heap_byte_size; }
 102   size_t max_heap_byte_size()     { return _max_heap_byte_size; }
 103   size_t min_heap_byte_size()     { return _min_heap_byte_size; }
 104 
 105   bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
 106   void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
 107   // Returns the current value of _should_clear_all_soft_refs.
 108   // _should_clear_all_soft_refs is set to false as a side effect.
 109   bool use_should_clear_all_soft_refs(bool v);
 110   bool all_soft_refs_clear() { return _all_soft_refs_clear; }
 111   void set_all_soft_refs_clear(bool v) { _all_soft_refs_clear = v; }
 112 
 113   // Called by the GC after Soft Refs have been cleared to indicate
 114   // that the request in _should_clear_all_soft_refs has been fulfilled.
 115   virtual void cleared_all_soft_refs();
 116 
















 117   virtual CardTableRS* create_rem_set(MemRegion reserved);
 118 
 119   MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
 120                                                size_t size,
 121                                                Metaspace::MetadataType mdtype);
 122 };
 123 
 124 class ClearedAllSoftRefs : public StackObj {
 125   bool _clear_all_soft_refs;
 126   CollectorPolicy* _collector_policy;
 127  public:
 128   ClearedAllSoftRefs(bool clear_all_soft_refs,
 129                      CollectorPolicy* collector_policy) :
 130     _clear_all_soft_refs(clear_all_soft_refs),
 131     _collector_policy(collector_policy) {}
 132 
 133   ~ClearedAllSoftRefs() {
 134     if (_clear_all_soft_refs) {
 135       _collector_policy->cleared_all_soft_refs();
 136     }


 198   size_t min_old_size()       { return _min_old_size; }
 199   size_t initial_old_size()   { return _initial_old_size; }
 200   size_t max_old_size()       { return _max_old_size; }
 201 
 202   GenerationSpec* young_gen_spec() const {
 203     assert(_young_gen_spec != NULL, "_young_gen_spec should have been initialized");
 204     return _young_gen_spec;
 205   }
 206 
 207   GenerationSpec* old_gen_spec() const {
 208     assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized");
 209     return _old_gen_spec;
 210   }
 211 
 212   // Performance Counter support
 213   GCPolicyCounters* counters()     { return _gc_policy_counters; }
 214 
 215   // Create the jstat counters for the GC policy.
 216   virtual void initialize_gc_policy_counters() = 0;
 217 


 218   virtual void initialize_generations() { };
 219 
 220   virtual void initialize_all() {
 221     CollectorPolicy::initialize_all();
 222     initialize_generations();
 223   }
 224 
 225   size_t young_gen_size_lower_bound();
 226 
 227   size_t old_gen_size_lower_bound();
 228 
 229   HeapWord* mem_allocate_work(size_t size,
 230                               bool is_tlab,
 231                               bool* gc_overhead_limit_was_exceeded);
 232 
 233   HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
 234 
 235   // Adaptive size policy
 236   AdaptiveSizePolicy* size_policy() { return _size_policy; }
 237 
 238   virtual void initialize_size_policy(size_t init_eden_size,
 239                                       size_t init_promo_size,
 240                                       size_t init_survivor_size);
 241 
 242   virtual void cleared_all_soft_refs();
 243 
 244 };
 245 
 246 class MarkSweepPolicy : public GenCollectorPolicy {
 247  protected:
 248   void initialize_alignments();
 249   void initialize_generations();
 250 
 251  public:
 252   MarkSweepPolicy() {}


 253 
 254   void initialize_gc_policy_counters();
 255 };
 256 
 257 #endif // SHARE_VM_GC_SHARED_COLLECTORPOLICY_HPP
< prev index next >