< prev index next >

src/share/vm/gc/serial/defNewGeneration.hpp

Print this page




 137   ContiguousSpace* _from_space;
 138   ContiguousSpace* _to_space;
 139 
 140   STWGCTimer* _gc_timer;
 141 
 142   enum SomeProtectedConstants {
 143     // Generations are GenGrain-aligned and have size that are multiples of
 144     // GenGrain.
 145     MinFreeScratchWords = 100
 146   };
 147 
 148   // Return the size of a survivor space if this generation were of size
 149   // gen_size.
 150   size_t compute_survivor_size(size_t gen_size, size_t alignment) const {
 151     size_t n = gen_size / (SurvivorRatio + 2);
 152     return n > alignment ? align_size_down(n, alignment) : alignment;
 153   }
 154 
 155  public:  // was "protected" but caused compile error on win32
 156   class IsAliveClosure: public BoolObjectClosure {
 157     Generation* _g;
 158   public:
 159     IsAliveClosure(Generation* g);
 160     bool do_object_b(oop p);
 161   };
 162 
 163   class KeepAliveClosure: public OopClosure {
 164   protected:
 165     ScanWeakRefClosure* _cl;
 166     CardTableRS* _rs;
 167     template <class T> void do_oop_work(T* p);
 168   public:
 169     KeepAliveClosure(ScanWeakRefClosure* cl);
 170     virtual void do_oop(oop* p);
 171     virtual void do_oop(narrowOop* p);
 172   };
 173 
 174   class FastKeepAliveClosure: public KeepAliveClosure {
 175   protected:
 176     HeapWord* _boundary;
 177     template <class T> void do_oop_work(T* p);
 178   public:
 179     FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl);
 180     virtual void do_oop(oop* p);
 181     virtual void do_oop(narrowOop* p);
 182   };
 183 
 184   class EvacuateFollowersClosure: public VoidClosure {
 185     GenCollectedHeap* _gch;
 186     int _level;
 187     ScanClosure* _scan_cur_or_nonheap;
 188     ScanClosure* _scan_older;
 189   public:
 190     EvacuateFollowersClosure(GenCollectedHeap* gch, int level,
 191                              ScanClosure* cur, ScanClosure* older);
 192     void do_void();
 193   };
 194 
 195   class FastEvacuateFollowersClosure: public VoidClosure {
 196     GenCollectedHeap* _gch;
 197     int _level;
 198     DefNewGeneration* _gen;
 199     FastScanClosure* _scan_cur_or_nonheap;
 200     FastScanClosure* _scan_older;
 201   public:
 202     FastEvacuateFollowersClosure(GenCollectedHeap* gch, int level,
 203                                  DefNewGeneration* gen,
 204                                  FastScanClosure* cur,
 205                                  FastScanClosure* older);
 206     void do_void();
 207   };
 208 
 209  public:
 210   DefNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
 211                    const char* policy="Copy");
 212 
 213   virtual void ref_processor_init();
 214 
 215   virtual Generation::Name kind() { return Generation::DefNew; }
 216 
 217   // Accessing spaces
 218   ContiguousSpace* eden() const           { return _eden_space; }
 219   ContiguousSpace* from() const           { return _from_space; }
 220   ContiguousSpace* to()   const           { return _to_space;   }
 221 
 222   virtual CompactibleSpace* first_compaction_space() const;
 223 
 224   // Space enquiries
 225   size_t capacity() const;
 226   size_t used() const;
 227   size_t free() const;
 228   size_t max_capacity() const;
 229   size_t capacity_before_gc() const;
 230   size_t unsafe_max_alloc_nogc() const;




 137   ContiguousSpace* _from_space;
 138   ContiguousSpace* _to_space;
 139 
 140   STWGCTimer* _gc_timer;
 141 
 142   enum SomeProtectedConstants {
 143     // Generations are GenGrain-aligned and have size that are multiples of
 144     // GenGrain.
 145     MinFreeScratchWords = 100
 146   };
 147 
 148   // Return the size of a survivor space if this generation were of size
 149   // gen_size.
 150   size_t compute_survivor_size(size_t gen_size, size_t alignment) const {
 151     size_t n = gen_size / (SurvivorRatio + 2);
 152     return n > alignment ? align_size_down(n, alignment) : alignment;
 153   }
 154 
 155  public:  // was "protected" but caused compile error on win32
 156   class IsAliveClosure: public BoolObjectClosure {
 157     Generation* _young_gen;
 158   public:
 159     IsAliveClosure(Generation* young_gen);
 160     bool do_object_b(oop p);
 161   };
 162 
 163   class KeepAliveClosure: public OopClosure {
 164   protected:
 165     ScanWeakRefClosure* _cl;
 166     CardTableRS* _rs;
 167     template <class T> void do_oop_work(T* p);
 168   public:
 169     KeepAliveClosure(ScanWeakRefClosure* cl);
 170     virtual void do_oop(oop* p);
 171     virtual void do_oop(narrowOop* p);
 172   };
 173 
 174   class FastKeepAliveClosure: public KeepAliveClosure {
 175   protected:
 176     HeapWord* _boundary;
 177     template <class T> void do_oop_work(T* p);
 178   public:
 179     FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl);
 180     virtual void do_oop(oop* p);
 181     virtual void do_oop(narrowOop* p);
 182   };
 183 
 184   class EvacuateFollowersClosure: public VoidClosure {
 185     GenCollectedHeap* _gch;

 186     ScanClosure* _scan_cur_or_nonheap;
 187     ScanClosure* _scan_older;
 188   public:
 189     EvacuateFollowersClosure(GenCollectedHeap* gch,
 190                              ScanClosure* cur, ScanClosure* older);
 191     void do_void();
 192   };
 193 
 194   class FastEvacuateFollowersClosure: public VoidClosure {
 195     GenCollectedHeap* _gch;

 196     DefNewGeneration* _gen;
 197     FastScanClosure* _scan_cur_or_nonheap;
 198     FastScanClosure* _scan_older;
 199   public:
 200     FastEvacuateFollowersClosure(GenCollectedHeap* gch,

 201                                  FastScanClosure* cur,
 202                                  FastScanClosure* older);
 203     void do_void();
 204   };
 205 
 206  public:
 207   DefNewGeneration(ReservedSpace rs, size_t initial_byte_size,
 208                    const char* policy="Copy");
 209 
 210   virtual void ref_processor_init();
 211 
 212   virtual Generation::Name kind() { return Generation::DefNew; }
 213 
 214   // Accessing spaces
 215   ContiguousSpace* eden() const           { return _eden_space; }
 216   ContiguousSpace* from() const           { return _from_space; }
 217   ContiguousSpace* to()   const           { return _to_space;   }
 218 
 219   virtual CompactibleSpace* first_compaction_space() const;
 220 
 221   // Space enquiries
 222   size_t capacity() const;
 223   size_t used() const;
 224   size_t free() const;
 225   size_t max_capacity() const;
 226   size_t capacity_before_gc() const;
 227   size_t unsafe_max_alloc_nogc() const;


< prev index next >