< prev index next >

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

Print this page

 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_SHARED_GENCOLLECTEDHEAP_HPP
 26 #define SHARE_GC_SHARED_GENCOLLECTEDHEAP_HPP
 27 
 28 #include "gc/shared/collectedHeap.hpp"
 29 #include "gc/shared/generation.hpp"
 30 #include "gc/shared/oopStorageParState.hpp"
 31 #include "gc/shared/preGCValues.hpp"
 32 #include "gc/shared/softRefGenPolicy.hpp"
 33 
 34 class AdaptiveSizePolicy;
 35 class CardTableRS;
 36 class GCPolicyCounters;
 37 class GenerationSpec;

 38 class StrongRootsScope;
 39 class SubTasksDone;
 40 class WorkerThreads;
 41 
 42 // A "GenCollectedHeap" is a CollectedHeap that uses generational
 43 // collection.  It has two generations, young and old.
 44 class GenCollectedHeap : public CollectedHeap {
 45   friend class Generation;
 46   friend class DefNewGeneration;
 47   friend class TenuredGeneration;
 48   friend class GenMarkSweep;
 49   friend class VM_GenCollectForAllocation;
 50   friend class VM_GenCollectFull;
 51   friend class VM_GenCollectFullConcurrent;
 52   friend class VM_GC_HeapInspection;
 53   friend class VM_HeapDumper;
 54   friend class HeapInspection;
 55   friend class GCCauseSetter;
 56   friend class VMStructs;
 57 public:

 71   GenerationSpec* _old_gen_spec;
 72 
 73   // The singleton CardTable Remembered Set.
 74   CardTableRS* _rem_set;
 75 
 76   SoftRefGenPolicy _soft_ref_gen_policy;
 77 
 78   // The sizing of the heap is controlled by a sizing policy.
 79   AdaptiveSizePolicy* _size_policy;
 80 
 81   GCPolicyCounters* _gc_policy_counters;
 82 
 83   // Indicates that the most recent previous incremental collection failed.
 84   // The flag is cleared when an action is taken that might clear the
 85   // condition that caused that incremental collection to fail.
 86   bool _incremental_collection_failed;
 87 
 88   // In support of ExplicitGCInvokesConcurrent functionality
 89   unsigned int _full_collections_completed;
 90 


 91   // Collects the given generation.
 92   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
 93                           bool run_verification, bool clear_soft_refs);
 94 
 95   // Reserve aligned space for the heap as needed by the contained generations.
 96   ReservedHeapSpace allocate(size_t alignment);
 97 
 98   // Initialize ("weak") refs processing support
 99   void ref_processing_init();
100 
101   PreGenGCValues get_pre_gc_values() const;
102 
103 protected:
104 
105   GCMemoryManager* _young_manager;
106   GCMemoryManager* _old_manager;
107 
108   // Helper functions for allocation
109   HeapWord* attempt_allocation(size_t size,
110                                bool   is_tlab,

313     virtual void do_generation(Generation* gen) = 0;
314   };
315 
316   // Apply "cl.do_generation" to all generations in the heap
317   // If "old_to_young" determines the order.
318   void generation_iterate(GenClosure* cl, bool old_to_young);
319 
320   // Return "true" if all generations have reached the
321   // maximal committed limit that they can reach, without a garbage
322   // collection.
323   virtual bool is_maximal_no_gc() const;
324 
325   // This function returns the CardTableRS object that allows us to scan
326   // generations in a fully generational heap.
327   CardTableRS* rem_set() { return _rem_set; }
328 
329   // Convenience function to be used in situations where the heap type can be
330   // asserted to be this type.
331   static GenCollectedHeap* heap();
332 




333   // The ScanningOption determines which of the roots
334   // the closure is applied to:
335   // "SO_None" does none;
336   enum ScanningOption {
337     SO_None                =  0x0,
338     SO_AllCodeCache        =  0x8,
339     SO_ScavengeCodeCache   = 0x10
340   };
341 
342  protected:
343   void process_roots(ScanningOption so,
344                      OopClosure* strong_roots,
345                      CLDClosure* strong_cld_closure,
346                      CLDClosure* weak_cld_closure,
347                      CodeBlobToOopClosure* code_roots);
348 
349   virtual void gc_prologue(bool full);
350   virtual void gc_epilogue(bool full);
351 
352  public:

 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_SHARED_GENCOLLECTEDHEAP_HPP
 26 #define SHARE_GC_SHARED_GENCOLLECTEDHEAP_HPP
 27 
 28 #include "gc/shared/collectedHeap.hpp"
 29 #include "gc/shared/generation.hpp"
 30 #include "gc/shared/oopStorageParState.hpp"
 31 #include "gc/shared/preGCValues.hpp"
 32 #include "gc/shared/softRefGenPolicy.hpp"
 33 
 34 class AdaptiveSizePolicy;
 35 class CardTableRS;
 36 class GCPolicyCounters;
 37 class GenerationSpec;
 38 class SlidingForwarding;
 39 class StrongRootsScope;
 40 class SubTasksDone;
 41 class WorkerThreads;
 42 
 43 // A "GenCollectedHeap" is a CollectedHeap that uses generational
 44 // collection.  It has two generations, young and old.
 45 class GenCollectedHeap : public CollectedHeap {
 46   friend class Generation;
 47   friend class DefNewGeneration;
 48   friend class TenuredGeneration;
 49   friend class GenMarkSweep;
 50   friend class VM_GenCollectForAllocation;
 51   friend class VM_GenCollectFull;
 52   friend class VM_GenCollectFullConcurrent;
 53   friend class VM_GC_HeapInspection;
 54   friend class VM_HeapDumper;
 55   friend class HeapInspection;
 56   friend class GCCauseSetter;
 57   friend class VMStructs;
 58 public:

 72   GenerationSpec* _old_gen_spec;
 73 
 74   // The singleton CardTable Remembered Set.
 75   CardTableRS* _rem_set;
 76 
 77   SoftRefGenPolicy _soft_ref_gen_policy;
 78 
 79   // The sizing of the heap is controlled by a sizing policy.
 80   AdaptiveSizePolicy* _size_policy;
 81 
 82   GCPolicyCounters* _gc_policy_counters;
 83 
 84   // Indicates that the most recent previous incremental collection failed.
 85   // The flag is cleared when an action is taken that might clear the
 86   // condition that caused that incremental collection to fail.
 87   bool _incremental_collection_failed;
 88 
 89   // In support of ExplicitGCInvokesConcurrent functionality
 90   unsigned int _full_collections_completed;
 91 
 92   SlidingForwarding* _forwarding;
 93 
 94   // Collects the given generation.
 95   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
 96                           bool run_verification, bool clear_soft_refs);
 97 
 98   // Reserve aligned space for the heap as needed by the contained generations.
 99   ReservedHeapSpace allocate(size_t alignment);
100 
101   // Initialize ("weak") refs processing support
102   void ref_processing_init();
103 
104   PreGenGCValues get_pre_gc_values() const;
105 
106 protected:
107 
108   GCMemoryManager* _young_manager;
109   GCMemoryManager* _old_manager;
110 
111   // Helper functions for allocation
112   HeapWord* attempt_allocation(size_t size,
113                                bool   is_tlab,

316     virtual void do_generation(Generation* gen) = 0;
317   };
318 
319   // Apply "cl.do_generation" to all generations in the heap
320   // If "old_to_young" determines the order.
321   void generation_iterate(GenClosure* cl, bool old_to_young);
322 
323   // Return "true" if all generations have reached the
324   // maximal committed limit that they can reach, without a garbage
325   // collection.
326   virtual bool is_maximal_no_gc() const;
327 
328   // This function returns the CardTableRS object that allows us to scan
329   // generations in a fully generational heap.
330   CardTableRS* rem_set() { return _rem_set; }
331 
332   // Convenience function to be used in situations where the heap type can be
333   // asserted to be this type.
334   static GenCollectedHeap* heap();
335 
336   SlidingForwarding* forwarding() const {
337     return _forwarding;
338   }
339 
340   // The ScanningOption determines which of the roots
341   // the closure is applied to:
342   // "SO_None" does none;
343   enum ScanningOption {
344     SO_None                =  0x0,
345     SO_AllCodeCache        =  0x8,
346     SO_ScavengeCodeCache   = 0x10
347   };
348 
349  protected:
350   void process_roots(ScanningOption so,
351                      OopClosure* strong_roots,
352                      CLDClosure* strong_cld_closure,
353                      CLDClosure* weak_cld_closure,
354                      CodeBlobToOopClosure* code_roots);
355 
356   virtual void gc_prologue(bool full);
357   virtual void gc_epilogue(bool full);
358 
359  public:
< prev index next >