< prev index next >

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

Print this page
rev 55927 : 8227224: GenCollectedHeap: add subspace transitions for young gen for gc+heap=info log lines
Reviewed-by:


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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/softRefGenPolicy.hpp"
  32 
  33 class AdaptiveSizePolicy;
  34 class CardTableRS;
  35 class GCPolicyCounters;
  36 class GenerationSpec;
  37 class StrongRootsScope;
  38 class SubTasksDone;
  39 class WorkGang;
  40 
  41 // A "GenCollectedHeap" is a CollectedHeap that uses generational
  42 // collection.  It has two generations, young and old.
  43 class GenCollectedHeap : public CollectedHeap {
  44   friend class Generation;
  45   friend class DefNewGeneration;
  46   friend class TenuredGeneration;
  47   friend class ConcurrentMarkSweepGeneration;
  48   friend class CMSCollector;
  49   friend class GenMarkSweep;
  50   friend class VM_GenCollectForAllocation;


  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   // Collects the given generation.
  93   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
  94                           bool run_verification, bool clear_soft_refs,
  95                           bool restore_marks_for_biased_locking);
  96 
  97   // Reserve aligned space for the heap as needed by the contained generations.
  98   char* allocate(size_t alignment, ReservedSpace* heap_rs);
  99 
 100   // Initialize ("weak") refs processing support
 101   void ref_processing_init();
 102 


 103 protected:
 104 
 105   // The set of potentially parallel tasks in root scanning.
 106   enum GCH_strong_roots_tasks {
 107     GCH_PS_Universe_oops_do,
 108     GCH_PS_JNIHandles_oops_do,
 109     GCH_PS_ObjectSynchronizer_oops_do,
 110     GCH_PS_FlatProfiler_oops_do,
 111     GCH_PS_Management_oops_do,
 112     GCH_PS_SystemDictionary_oops_do,
 113     GCH_PS_ClassLoaderDataGraph_oops_do,
 114     GCH_PS_jvmti_oops_do,
 115     GCH_PS_CodeCache_oops_do,
 116     AOT_ONLY(GCH_PS_aot_oops_do COMMA)
 117     GCH_PS_younger_gens,
 118     // Leave this one last.
 119     GCH_PS_NumElements
 120   };
 121 
 122   // Data structure for claiming the (potentially) parallel tasks in


 315 
 316   // Update the gc statistics for each generation.
 317   void update_gc_stats(Generation* current_generation, bool full) {
 318     _old_gen->update_gc_stats(current_generation, full);
 319   }
 320 
 321   bool no_gc_in_progress() { return !is_gc_active(); }
 322 
 323   // Override.
 324   void prepare_for_verify();
 325 
 326   // Override.
 327   void verify(VerifyOption option);
 328 
 329   // Override.
 330   virtual void print_on(outputStream* st) const;
 331   virtual void print_gc_threads_on(outputStream* st) const;
 332   virtual void gc_threads_do(ThreadClosure* tc) const;
 333   virtual void print_tracing_info() const;
 334 
 335   void print_heap_change(size_t young_prev_used, size_t old_prev_used) const;
 336 
 337   // The functions below are helper functions that a subclass of
 338   // "CollectedHeap" can use in the implementation of its virtual
 339   // functions.
 340 
 341   class GenClosure : public StackObj {
 342    public:
 343     virtual void do_generation(Generation* gen) = 0;
 344   };
 345 
 346   // Apply "cl.do_generation" to all generations in the heap
 347   // If "old_to_young" determines the order.
 348   void generation_iterate(GenClosure* cl, bool old_to_young);
 349 
 350   // Return "true" if all generations have reached the
 351   // maximal committed limit that they can reach, without a garbage
 352   // collection.
 353   virtual bool is_maximal_no_gc() const;
 354 
 355   // This function returns the CardTableRS object that allows us to scan




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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 ConcurrentMarkSweepGeneration;
  49   friend class CMSCollector;
  50   friend class GenMarkSweep;
  51   friend class VM_GenCollectForAllocation;


  84 
  85   // Indicates that the most recent previous incremental collection failed.
  86   // The flag is cleared when an action is taken that might clear the
  87   // condition that caused that incremental collection to fail.
  88   bool _incremental_collection_failed;
  89 
  90   // In support of ExplicitGCInvokesConcurrent functionality
  91   unsigned int _full_collections_completed;
  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                           bool restore_marks_for_biased_locking);
  97 
  98   // Reserve aligned space for the heap as needed by the contained generations.
  99   char* allocate(size_t alignment, ReservedSpace* heap_rs);
 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   // The set of potentially parallel tasks in root scanning.
 109   enum GCH_strong_roots_tasks {
 110     GCH_PS_Universe_oops_do,
 111     GCH_PS_JNIHandles_oops_do,
 112     GCH_PS_ObjectSynchronizer_oops_do,
 113     GCH_PS_FlatProfiler_oops_do,
 114     GCH_PS_Management_oops_do,
 115     GCH_PS_SystemDictionary_oops_do,
 116     GCH_PS_ClassLoaderDataGraph_oops_do,
 117     GCH_PS_jvmti_oops_do,
 118     GCH_PS_CodeCache_oops_do,
 119     AOT_ONLY(GCH_PS_aot_oops_do COMMA)
 120     GCH_PS_younger_gens,
 121     // Leave this one last.
 122     GCH_PS_NumElements
 123   };
 124 
 125   // Data structure for claiming the (potentially) parallel tasks in


 318 
 319   // Update the gc statistics for each generation.
 320   void update_gc_stats(Generation* current_generation, bool full) {
 321     _old_gen->update_gc_stats(current_generation, full);
 322   }
 323 
 324   bool no_gc_in_progress() { return !is_gc_active(); }
 325 
 326   // Override.
 327   void prepare_for_verify();
 328 
 329   // Override.
 330   void verify(VerifyOption option);
 331 
 332   // Override.
 333   virtual void print_on(outputStream* st) const;
 334   virtual void print_gc_threads_on(outputStream* st) const;
 335   virtual void gc_threads_do(ThreadClosure* tc) const;
 336   virtual void print_tracing_info() const;
 337 
 338   void print_heap_change(const PreGenGCValues& pre_gc_values) const;
 339 
 340   // The functions below are helper functions that a subclass of
 341   // "CollectedHeap" can use in the implementation of its virtual
 342   // functions.
 343 
 344   class GenClosure : public StackObj {
 345    public:
 346     virtual void do_generation(Generation* gen) = 0;
 347   };
 348 
 349   // Apply "cl.do_generation" to all generations in the heap
 350   // If "old_to_young" determines the order.
 351   void generation_iterate(GenClosure* cl, bool old_to_young);
 352 
 353   // Return "true" if all generations have reached the
 354   // maximal committed limit that they can reach, without a garbage
 355   // collection.
 356   virtual bool is_maximal_no_gc() const;
 357 
 358   // This function returns the CardTableRS object that allows us to scan


< prev index next >