< prev index next >

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

Print this page




  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_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
  26 #define SHARE_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
  27 
  28 #include "gc/shared/adaptiveSizePolicy.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "gc/shared/collectorPolicy.hpp"
  31 #include "gc/shared/generation.hpp"

  32 
  33 class StrongRootsScope;
  34 class SubTasksDone;
  35 class WorkGang;
  36 
  37 // A "GenCollectedHeap" is a CollectedHeap that uses generational
  38 // collection.  It has two generations, young and old.
  39 class GenCollectedHeap : public CollectedHeap {
  40   friend class GenCollectorPolicy;
  41   friend class Generation;
  42   friend class DefNewGeneration;
  43   friend class TenuredGeneration;
  44   friend class ConcurrentMarkSweepGeneration;
  45   friend class CMSCollector;
  46   friend class GenMarkSweep;
  47   friend class VM_GenCollectForAllocation;
  48   friend class VM_GenCollectFull;
  49   friend class VM_GenCollectFullConcurrent;
  50   friend class VM_GC_HeapInspection;
  51   friend class VM_HeapDumper;


  53   friend class GCCauseSetter;
  54   friend class VMStructs;
  55 public:
  56   friend class VM_PopulateDumpSharedSpace;
  57 
  58   enum GenerationType {
  59     YoungGen,
  60     OldGen
  61   };
  62 
  63 private:
  64   Generation* _young_gen;
  65   Generation* _old_gen;
  66 
  67   // The singleton CardTable Remembered Set.
  68   CardTableRS* _rem_set;
  69 
  70   // The generational collector policy.
  71   GenCollectorPolicy* _gen_policy;
  72 


  73   // Indicates that the most recent previous incremental collection failed.
  74   // The flag is cleared when an action is taken that might clear the
  75   // condition that caused that incremental collection to fail.
  76   bool _incremental_collection_failed;
  77 
  78   // In support of ExplicitGCInvokesConcurrent functionality
  79   unsigned int _full_collections_completed;
  80 
  81   // Collects the given generation.
  82   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
  83                           bool run_verification, bool clear_soft_refs,
  84                           bool restore_marks_for_biased_locking);
  85 
  86   // Reserve aligned space for the heap as needed by the contained generations.
  87   char* allocate(size_t alignment, ReservedSpace* heap_rs);
  88 
  89   // Initialize ("weak") refs processing support
  90   void ref_processing_init();
  91 
  92 protected:


 148   virtual void check_gen_kinds() = 0;
 149 
 150 public:
 151 
 152   // Returns JNI_OK on success
 153   virtual jint initialize();
 154 
 155   // Does operations required after initialization has been done.
 156   void post_initialize();
 157 
 158   Generation* young_gen() const { return _young_gen; }
 159   Generation* old_gen()   const { return _old_gen; }
 160 
 161   bool is_young_gen(const Generation* gen) const { return gen == _young_gen; }
 162   bool is_old_gen(const Generation* gen) const { return gen == _old_gen; }
 163 
 164   // The generational collector policy.
 165   GenCollectorPolicy* gen_policy() const { return _gen_policy; }
 166 
 167   virtual CollectorPolicy* collector_policy() const { return gen_policy(); }


 168 
 169   // Adaptive size policy
 170   virtual AdaptiveSizePolicy* size_policy() {
 171     return gen_policy()->size_policy();
 172   }
 173 
 174   // Return the (conservative) maximum heap alignment
 175   static size_t conservative_max_heap_alignment() {
 176     return Generation::GenGrain;
 177   }
 178 
 179   size_t capacity() const;
 180   size_t used() const;
 181 
 182   // Save the "used_region" for both generations.
 183   void save_used_regions();
 184 
 185   size_t max_capacity() const;
 186 
 187   HeapWord* mem_allocate(size_t size, bool*  gc_overhead_limit_was_exceeded);




  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_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
  26 #define SHARE_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
  27 
  28 #include "gc/shared/adaptiveSizePolicy.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "gc/shared/collectorPolicy.hpp"
  31 #include "gc/shared/generation.hpp"
  32 #include "gc/shared/softRefGenPolicy.hpp"
  33 
  34 class StrongRootsScope;
  35 class SubTasksDone;
  36 class WorkGang;
  37 
  38 // A "GenCollectedHeap" is a CollectedHeap that uses generational
  39 // collection.  It has two generations, young and old.
  40 class GenCollectedHeap : public CollectedHeap {
  41   friend class GenCollectorPolicy;
  42   friend class Generation;
  43   friend class DefNewGeneration;
  44   friend class TenuredGeneration;
  45   friend class ConcurrentMarkSweepGeneration;
  46   friend class CMSCollector;
  47   friend class GenMarkSweep;
  48   friend class VM_GenCollectForAllocation;
  49   friend class VM_GenCollectFull;
  50   friend class VM_GenCollectFullConcurrent;
  51   friend class VM_GC_HeapInspection;
  52   friend class VM_HeapDumper;


  54   friend class GCCauseSetter;
  55   friend class VMStructs;
  56 public:
  57   friend class VM_PopulateDumpSharedSpace;
  58 
  59   enum GenerationType {
  60     YoungGen,
  61     OldGen
  62   };
  63 
  64 private:
  65   Generation* _young_gen;
  66   Generation* _old_gen;
  67 
  68   // The singleton CardTable Remembered Set.
  69   CardTableRS* _rem_set;
  70 
  71   // The generational collector policy.
  72   GenCollectorPolicy* _gen_policy;
  73 
  74   SoftRefGenPolicy _soft_ref_gen_policy;
  75 
  76   // Indicates that the most recent previous incremental collection failed.
  77   // The flag is cleared when an action is taken that might clear the
  78   // condition that caused that incremental collection to fail.
  79   bool _incremental_collection_failed;
  80 
  81   // In support of ExplicitGCInvokesConcurrent functionality
  82   unsigned int _full_collections_completed;
  83 
  84   // Collects the given generation.
  85   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
  86                           bool run_verification, bool clear_soft_refs,
  87                           bool restore_marks_for_biased_locking);
  88 
  89   // Reserve aligned space for the heap as needed by the contained generations.
  90   char* allocate(size_t alignment, ReservedSpace* heap_rs);
  91 
  92   // Initialize ("weak") refs processing support
  93   void ref_processing_init();
  94 
  95 protected:


 151   virtual void check_gen_kinds() = 0;
 152 
 153 public:
 154 
 155   // Returns JNI_OK on success
 156   virtual jint initialize();
 157 
 158   // Does operations required after initialization has been done.
 159   void post_initialize();
 160 
 161   Generation* young_gen() const { return _young_gen; }
 162   Generation* old_gen()   const { return _old_gen; }
 163 
 164   bool is_young_gen(const Generation* gen) const { return gen == _young_gen; }
 165   bool is_old_gen(const Generation* gen) const { return gen == _old_gen; }
 166 
 167   // The generational collector policy.
 168   GenCollectorPolicy* gen_policy() const { return _gen_policy; }
 169 
 170   virtual CollectorPolicy* collector_policy() const { return gen_policy(); }
 171 
 172   virtual SoftRefPolicy* soft_ref_policy() { return &_soft_ref_gen_policy; }
 173 
 174   // Adaptive size policy
 175   virtual AdaptiveSizePolicy* size_policy() {
 176     return gen_policy()->size_policy();
 177   }
 178 
 179   // Return the (conservative) maximum heap alignment
 180   static size_t conservative_max_heap_alignment() {
 181     return Generation::GenGrain;
 182   }
 183 
 184   size_t capacity() const;
 185   size_t used() const;
 186 
 187   // Save the "used_region" for both generations.
 188   void save_used_regions();
 189 
 190   size_t max_capacity() const;
 191 
 192   HeapWord* mem_allocate(size_t size, bool*  gc_overhead_limit_was_exceeded);


< prev index next >