src/share/vm/memory/generation.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/memory

src/share/vm/memory/generation.cpp

Print this page
rev 7211 : [mq]: remove_ngen
rev 7212 : [mq]: remove_get_gen


 144     }
 145   }
 146   GenerationIsInClosure(const void* p) : _p(p), sp(NULL) {}
 147 };
 148 
 149 bool Generation::is_in(const void* p) const {
 150   GenerationIsInClosure blk(p);
 151   ((Generation*)this)->space_iterate(&blk);
 152   return blk.sp != NULL;
 153 }
 154 
 155 DefNewGeneration* Generation::as_DefNewGeneration() {
 156   assert((kind() == Generation::DefNew) ||
 157          (kind() == Generation::ParNew),
 158     "Wrong youngest generation type");
 159   return (DefNewGeneration*) this;
 160 }
 161 
 162 Generation* Generation::next_gen() const {
 163   GenCollectedHeap* gch = GenCollectedHeap::heap();
 164   int next = level() + 1;
 165   if (next < gch->_n_gens) {
 166     return gch->get_gen(next);
 167   } else {
 168     return NULL;
 169   }
 170 }
 171 
 172 size_t Generation::max_contiguous_available() const {
 173   // The largest number of contiguous free words in this or any higher generation.
 174   size_t max = 0;
 175   for (const Generation* gen = this; gen != NULL; gen = gen->next_gen()) {
 176     size_t avail = gen->contiguous_available();
 177     if (avail > max) {
 178       max = avail;
 179     }
 180   }
 181   return max;
 182 }
 183 
 184 bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
 185   size_t available = max_contiguous_available();
 186   bool   res = (available >= max_promotion_in_bytes);




 144     }
 145   }
 146   GenerationIsInClosure(const void* p) : _p(p), sp(NULL) {}
 147 };
 148 
 149 bool Generation::is_in(const void* p) const {
 150   GenerationIsInClosure blk(p);
 151   ((Generation*)this)->space_iterate(&blk);
 152   return blk.sp != NULL;
 153 }
 154 
 155 DefNewGeneration* Generation::as_DefNewGeneration() {
 156   assert((kind() == Generation::DefNew) ||
 157          (kind() == Generation::ParNew),
 158     "Wrong youngest generation type");
 159   return (DefNewGeneration*) this;
 160 }
 161 
 162 Generation* Generation::next_gen() const {
 163   GenCollectedHeap* gch = GenCollectedHeap::heap();
 164   if (level() == 0) {
 165     return gch->old_gen();

 166   } else {
 167     return NULL;
 168   }
 169 }
 170 
 171 size_t Generation::max_contiguous_available() const {
 172   // The largest number of contiguous free words in this or any higher generation.
 173   size_t max = 0;
 174   for (const Generation* gen = this; gen != NULL; gen = gen->next_gen()) {
 175     size_t avail = gen->contiguous_available();
 176     if (avail > max) {
 177       max = avail;
 178     }
 179   }
 180   return max;
 181 }
 182 
 183 bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
 184   size_t available = max_contiguous_available();
 185   bool   res = (available >= max_promotion_in_bytes);


src/share/vm/memory/generation.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File