< prev index next >

src/share/vm/memory/generation.cpp

Print this page
rev 7696 : 8061802: REDO - Remove the generations array
Summary: The _gens array is removed and replaced by explicit _young_gen and _old_gen variables.
Reviewed-by:


 138   const void* _p;
 139   Space* sp;
 140   virtual void do_space(Space* s) {
 141     if (sp == NULL) {
 142       if (s->is_in(_p)) sp = s;
 143     }
 144   }
 145   GenerationIsInClosure(const void* p) : _p(p), sp(NULL) {}
 146 };
 147 
 148 bool Generation::is_in(const void* p) const {
 149   GenerationIsInClosure blk(p);
 150   ((Generation*)this)->space_iterate(&blk);
 151   return blk.sp != NULL;
 152 }
 153 
 154 Generation* Generation::next_gen() const {
 155   GenCollectedHeap* gch = GenCollectedHeap::heap();
 156   int next = level() + 1;
 157   if (next < gch->_n_gens) {
 158     return gch->_gens[next];
 159   } else {
 160     return NULL;
 161   }
 162 }
 163 
 164 size_t Generation::max_contiguous_available() const {
 165   // The largest number of contiguous free words in this or any higher generation.
 166   size_t max = 0;
 167   for (const Generation* gen = this; gen != NULL; gen = gen->next_gen()) {
 168     size_t avail = gen->contiguous_available();
 169     if (avail > max) {
 170       max = avail;
 171     }
 172   }
 173   return max;
 174 }
 175 
 176 bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
 177   size_t available = max_contiguous_available();
 178   bool   res = (available >= max_promotion_in_bytes);




 138   const void* _p;
 139   Space* sp;
 140   virtual void do_space(Space* s) {
 141     if (sp == NULL) {
 142       if (s->is_in(_p)) sp = s;
 143     }
 144   }
 145   GenerationIsInClosure(const void* p) : _p(p), sp(NULL) {}
 146 };
 147 
 148 bool Generation::is_in(const void* p) const {
 149   GenerationIsInClosure blk(p);
 150   ((Generation*)this)->space_iterate(&blk);
 151   return blk.sp != NULL;
 152 }
 153 
 154 Generation* Generation::next_gen() const {
 155   GenCollectedHeap* gch = GenCollectedHeap::heap();
 156   int next = level() + 1;
 157   if (next < gch->_n_gens) {
 158     return gch->get_gen(next);
 159   } else {
 160     return NULL;
 161   }
 162 }
 163 
 164 size_t Generation::max_contiguous_available() const {
 165   // The largest number of contiguous free words in this or any higher generation.
 166   size_t max = 0;
 167   for (const Generation* gen = this; gen != NULL; gen = gen->next_gen()) {
 168     size_t avail = gen->contiguous_available();
 169     if (avail > max) {
 170       max = avail;
 171     }
 172   }
 173   return max;
 174 }
 175 
 176 bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
 177   size_t available = max_contiguous_available();
 178   bool   res = (available >= max_promotion_in_bytes);


< prev index next >