< 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_GC_HeapInspection;
 52   friend class VM_HeapDumper;
 53   friend class HeapInspection;
 54   friend class GCCauseSetter;
 55   friend class VMStructs;
 56 public:
 57   friend class VM_PopulateDumpSharedSpace;

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


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

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




329   // The ScanningOption determines which of the roots
330   // the closure is applied to:
331   // "SO_None" does none;
332   enum ScanningOption {
333     SO_None                =  0x0,
334     SO_AllCodeCache        =  0x8,
335     SO_ScavengeCodeCache   = 0x10
336   };
337 
338  protected:
339   void process_roots(ScanningOption so,
340                      OopClosure* strong_roots,
341                      CLDClosure* strong_cld_closure,
342                      CLDClosure* weak_cld_closure,
343                      CodeBlobToOopClosure* code_roots);
344 
345   virtual void gc_prologue(bool full);
346   virtual void gc_epilogue(bool full);
347 
348  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_GC_HeapInspection;
 53   friend class VM_HeapDumper;
 54   friend class HeapInspection;
 55   friend class GCCauseSetter;
 56   friend class VMStructs;
 57 public:
 58   friend class VM_PopulateDumpSharedSpace;

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

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