src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/parallelScavenge

src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp

Print this page




  38 class CollectorPolicy;
  39 class GCHeapSummary;
  40 class GCTaskManager;
  41 class GenerationSizer;
  42 class CollectorPolicy;
  43 class PSAdaptiveSizePolicy;
  44 class PSHeapSummary;
  45 
  46 class ParallelScavengeHeap : public CollectedHeap {
  47   friend class VMStructs;
  48  private:
  49   static PSYoungGen* _young_gen;
  50   static PSOldGen*   _old_gen;
  51 
  52   // Sizing policy for entire heap
  53   static PSAdaptiveSizePolicy* _size_policy;
  54   static PSGCAdaptivePolicyCounters*   _gc_policy_counters;
  55 
  56   static ParallelScavengeHeap* _psh;
  57 
  58   size_t _young_gen_alignment;
  59   size_t _old_gen_alignment;
  60 
  61   GenerationSizer* _collector_policy;
  62 
  63   inline size_t set_alignment(size_t& var, size_t val);
  64 
  65   // Collection of generations that are adjacent in the
  66   // space reserved for the heap.
  67   AdjoiningGenerations* _gens;
  68   unsigned int _death_march_count;
  69 
  70   static GCTaskManager*          _gc_task_manager;      // The task manager.
  71 
  72   void trace_heap(GCWhen::Type when, GCTracer* tracer);
  73 
  74  protected:
  75   static inline size_t total_invocations();
  76   HeapWord* allocate_new_tlab(size_t size);
  77 
  78   inline bool should_alloc_in_eden(size_t size) const;
  79   inline void death_march_check(HeapWord* const result, size_t size);
  80   HeapWord* mem_allocate_old_gen(size_t size);
  81 
  82  public:
  83   ParallelScavengeHeap() : CollectedHeap() {
  84     _death_march_count = 0;
  85     set_alignment(_young_gen_alignment, intra_heap_alignment());
  86     set_alignment(_old_gen_alignment, intra_heap_alignment());
  87   }
  88 
  89   // Return the (conservative) maximum heap alignment
  90   static size_t conservative_max_heap_alignment() {
  91     return intra_heap_alignment();
  92   }
  93 
  94   // For use by VM operations
  95   enum CollectionType {
  96     Scavenge,
  97     MarkSweep
  98   };
  99 
 100   ParallelScavengeHeap::Name kind() const {
 101     return CollectedHeap::ParallelScavengeHeap;
 102   }
 103 
 104   virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
 105 
 106   static PSYoungGen* young_gen()     { return _young_gen; }
 107   static PSOldGen* old_gen()         { return _old_gen; }
 108 
 109   virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; }
 110 
 111   static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; }
 112 
 113   static ParallelScavengeHeap* heap();
 114 
 115   static GCTaskManager* const gc_task_manager() { return _gc_task_manager; }
 116 
 117   AdjoiningGenerations* gens() { return _gens; }
 118 
 119   // Returns JNI_OK on success
 120   virtual jint initialize();
 121 
 122   void post_initialize();
 123   void update_counters();
 124   // The alignment used for the various generations.
 125   size_t young_gen_alignment() const { return _young_gen_alignment; }
 126   size_t old_gen_alignment()  const { return _old_gen_alignment; }
 127 
 128   // The alignment used for eden and survivors within the young gen
 129   // and for boundary between young gen and old gen.
 130   static size_t intra_heap_alignment() { return 64 * K * HeapWordSize; }
 131 
 132   size_t capacity() const;
 133   size_t used() const;
 134 
 135   // Return "true" if all generations have reached the
 136   // maximal committed limit that they can reach, without a garbage
 137   // collection.
 138   virtual bool is_maximal_no_gc() const;
 139 
 140   // Return true if the reference points to an object that
 141   // can be moved in a partial collection.  For currently implemented
 142   // generational collectors that means during a collection of
 143   // the young gen.
 144   virtual bool is_scavengable(const void* addr);
 145 
 146   // Does this heap support heap inspection? (+PrintClassHistogram)
 147   bool supports_heap_inspection() const { return true; }
 148 
 149   size_t max_capacity() const;
 150 


 246   void resize_young_gen(size_t eden_size, size_t survivor_size);
 247 
 248   // Resize the old generation.  The reserved space for the
 249   // generation may be expanded in preparation for the resize.
 250   void resize_old_gen(size_t desired_free_space);
 251 
 252   // Save the tops of the spaces in all generations
 253   void record_gen_tops_before_GC() PRODUCT_RETURN;
 254 
 255   // Mangle the unused parts of all spaces in the heap
 256   void gen_mangle_unused_area() PRODUCT_RETURN;
 257 
 258   // Call these in sequential code around the processing of strong roots.
 259   class ParStrongRootsScope : public MarkingCodeBlobClosure::MarkScope {
 260   public:
 261     ParStrongRootsScope();
 262     ~ParStrongRootsScope();
 263   };
 264 };
 265 
 266 inline size_t ParallelScavengeHeap::set_alignment(size_t& var, size_t val)
 267 {
 268   assert(is_power_of_2((intptr_t)val), "must be a power of 2");
 269   var = round_to(val, intra_heap_alignment());
 270   return var;
 271 }
 272 
 273 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP


  38 class CollectorPolicy;
  39 class GCHeapSummary;
  40 class GCTaskManager;
  41 class GenerationSizer;
  42 class CollectorPolicy;
  43 class PSAdaptiveSizePolicy;
  44 class PSHeapSummary;
  45 
  46 class ParallelScavengeHeap : public CollectedHeap {
  47   friend class VMStructs;
  48  private:
  49   static PSYoungGen* _young_gen;
  50   static PSOldGen*   _old_gen;
  51 
  52   // Sizing policy for entire heap
  53   static PSAdaptiveSizePolicy* _size_policy;
  54   static PSGCAdaptivePolicyCounters*   _gc_policy_counters;
  55 
  56   static ParallelScavengeHeap* _psh;
  57 
  58   // Actual alignment for generation sizes.
  59   size_t alignment();
  60 
  61   GenerationSizer* _collector_policy;
  62 


  63   // Collection of generations that are adjacent in the
  64   // space reserved for the heap.
  65   AdjoiningGenerations* _gens;
  66   unsigned int _death_march_count;
  67 
  68   static GCTaskManager*          _gc_task_manager;      // The task manager.
  69 
  70   void trace_heap(GCWhen::Type when, GCTracer* tracer);
  71 
  72  protected:
  73   static inline size_t total_invocations();
  74   HeapWord* allocate_new_tlab(size_t size);
  75 
  76   inline bool should_alloc_in_eden(size_t size) const;
  77   inline void death_march_check(HeapWord* const result, size_t size);
  78   HeapWord* mem_allocate_old_gen(size_t size);
  79 
  80  public:
  81   ParallelScavengeHeap() : CollectedHeap(), _death_march_count(0) {



  82   }
  83 
  84   // Return the (conservative) maximum heap alignment
  85   static size_t conservative_max_heap_alignment() {
  86     return GenCollectorPolicy::intra_heap_alignment();
  87   }
  88 
  89   // For use by VM operations
  90   enum CollectionType {
  91     Scavenge,
  92     MarkSweep
  93   };
  94 
  95   ParallelScavengeHeap::Name kind() const {
  96     return CollectedHeap::ParallelScavengeHeap;
  97   }
  98 
  99   virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
 100 
 101   static PSYoungGen* young_gen()     { return _young_gen; }
 102   static PSOldGen* old_gen()         { return _old_gen; }
 103 
 104   virtual PSAdaptiveSizePolicy* size_policy() { return _size_policy; }
 105 
 106   static PSGCAdaptivePolicyCounters* gc_policy_counters() { return _gc_policy_counters; }
 107 
 108   static ParallelScavengeHeap* heap();
 109 
 110   static GCTaskManager* const gc_task_manager() { return _gc_task_manager; }
 111 
 112   AdjoiningGenerations* gens() { return _gens; }
 113 
 114   // Returns JNI_OK on success
 115   virtual jint initialize();
 116 
 117   void post_initialize();
 118   void update_counters();
 119   // The alignment used for the various generations.
 120   size_t young_gen_alignment() { return alignment(); }
 121   size_t old_gen_alignment()  { return alignment(); }
 122 
 123   // The alignment used for eden and survivors within the young gen
 124   // and for boundary between young gen and old gen.
 125   size_t intra_heap_alignment();
 126 
 127   size_t capacity() const;
 128   size_t used() const;
 129 
 130   // Return "true" if all generations have reached the
 131   // maximal committed limit that they can reach, without a garbage
 132   // collection.
 133   virtual bool is_maximal_no_gc() const;
 134 
 135   // Return true if the reference points to an object that
 136   // can be moved in a partial collection.  For currently implemented
 137   // generational collectors that means during a collection of
 138   // the young gen.
 139   virtual bool is_scavengable(const void* addr);
 140 
 141   // Does this heap support heap inspection? (+PrintClassHistogram)
 142   bool supports_heap_inspection() const { return true; }
 143 
 144   size_t max_capacity() const;
 145 


 241   void resize_young_gen(size_t eden_size, size_t survivor_size);
 242 
 243   // Resize the old generation.  The reserved space for the
 244   // generation may be expanded in preparation for the resize.
 245   void resize_old_gen(size_t desired_free_space);
 246 
 247   // Save the tops of the spaces in all generations
 248   void record_gen_tops_before_GC() PRODUCT_RETURN;
 249 
 250   // Mangle the unused parts of all spaces in the heap
 251   void gen_mangle_unused_area() PRODUCT_RETURN;
 252 
 253   // Call these in sequential code around the processing of strong roots.
 254   class ParStrongRootsScope : public MarkingCodeBlobClosure::MarkScope {
 255   public:
 256     ParStrongRootsScope();
 257     ~ParStrongRootsScope();
 258   };
 259 };
 260 







 261 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP
src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File