< 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 WorkGang;
 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                           bool restore_marks_for_biased_locking);
 95 
 96   // Reserve aligned space for the heap as needed by the contained generations.
 97   ReservedHeapSpace allocate(size_t alignment);
 98 
 99   // Initialize ("weak") refs processing support
100   void ref_processing_init();
101 
102   PreGenGCValues get_pre_gc_values() const;
103 
104 protected:
105 
106   GCMemoryManager* _young_manager;
107   GCMemoryManager* _old_manager;
108 
109   // Helper functions for allocation
110   HeapWord* attempt_allocation(size_t size,

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




334   // The ScanningOption determines which of the roots
335   // the closure is applied to:
336   // "SO_None" does none;
337   enum ScanningOption {
338     SO_None                =  0x0,
339     SO_AllCodeCache        =  0x8,
340     SO_ScavengeCodeCache   = 0x10
341   };
342 
343  protected:
344   void process_roots(ScanningOption so,
345                      OopClosure* strong_roots,
346                      CLDClosure* strong_cld_closure,
347                      CLDClosure* weak_cld_closure,
348                      CodeBlobToOopClosure* code_roots);
349 
350   virtual void gc_prologue(bool full);
351   virtual void gc_epilogue(bool full);
352 
353  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 WorkGang;
 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                           bool restore_marks_for_biased_locking);
 98 
 99   // Reserve aligned space for the heap as needed by the contained generations.
100   ReservedHeapSpace allocate(size_t alignment);
101 
102   // Initialize ("weak") refs processing support
103   void ref_processing_init();
104 
105   PreGenGCValues get_pre_gc_values() const;
106 
107 protected:
108 
109   GCMemoryManager* _young_manager;
110   GCMemoryManager* _old_manager;
111 
112   // Helper functions for allocation
113   HeapWord* attempt_allocation(size_t size,

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