< prev index next >

src/share/vm/gc/g1/g1AllocRegion.cpp

Print this page




 260                                     size_t allocated_bytes) {
 261   _g1h->retire_gc_alloc_region(alloc_region, allocated_bytes, _purpose);
 262 }
 263 
 264 size_t G1GCAllocRegion::retire(bool fill_up) {
 265   HeapRegion* retired = get();
 266   size_t end_waste = G1AllocRegion::retire(fill_up);
 267   // Do not count retirement of the dummy allocation region.
 268   if (retired != NULL) {
 269     _stats->add_region_end_waste(end_waste / HeapWordSize);
 270   }
 271   return end_waste;
 272 }
 273 
 274 HeapRegion* OldGCAllocRegion::release() {
 275   HeapRegion* cur = get();
 276   if (cur != NULL) {
 277     // Determine how far we are from the next card boundary. If it is smaller than
 278     // the minimum object size we can allocate into, expand into the next card.
 279     HeapWord* top = cur->top();
 280     HeapWord* aligned_top = (HeapWord*)align_ptr_up(top, G1BlockOffsetSharedArray::N_bytes);
 281 
 282     size_t to_allocate_words = pointer_delta(aligned_top, top, HeapWordSize);
 283 
 284     if (to_allocate_words != 0) {
 285       // We are not at a card boundary. Fill up, possibly into the next, taking the
 286       // end of the region and the minimum object size into account.
 287       to_allocate_words = MIN2(pointer_delta(cur->end(), cur->top(), HeapWordSize),
 288                                MAX2(to_allocate_words, G1CollectedHeap::min_fill_size()));
 289 
 290       // Skip allocation if there is not enough space to allocate even the smallest
 291       // possible object. In this case this region will not be retained, so the
 292       // original problem cannot occur.
 293       if (to_allocate_words >= G1CollectedHeap::min_fill_size()) {
 294         HeapWord* dummy = attempt_allocation(to_allocate_words, true /* bot_updates */);
 295         CollectedHeap::fill_with_object(dummy, to_allocate_words);
 296       }
 297     }
 298   }
 299   return G1AllocRegion::release();
 300 }


 260                                     size_t allocated_bytes) {
 261   _g1h->retire_gc_alloc_region(alloc_region, allocated_bytes, _purpose);
 262 }
 263 
 264 size_t G1GCAllocRegion::retire(bool fill_up) {
 265   HeapRegion* retired = get();
 266   size_t end_waste = G1AllocRegion::retire(fill_up);
 267   // Do not count retirement of the dummy allocation region.
 268   if (retired != NULL) {
 269     _stats->add_region_end_waste(end_waste / HeapWordSize);
 270   }
 271   return end_waste;
 272 }
 273 
 274 HeapRegion* OldGCAllocRegion::release() {
 275   HeapRegion* cur = get();
 276   if (cur != NULL) {
 277     // Determine how far we are from the next card boundary. If it is smaller than
 278     // the minimum object size we can allocate into, expand into the next card.
 279     HeapWord* top = cur->top();
 280     HeapWord* aligned_top = (HeapWord*)align_ptr_up(top, G1BlockOffsetTable::N_bytes);
 281 
 282     size_t to_allocate_words = pointer_delta(aligned_top, top, HeapWordSize);
 283 
 284     if (to_allocate_words != 0) {
 285       // We are not at a card boundary. Fill up, possibly into the next, taking the
 286       // end of the region and the minimum object size into account.
 287       to_allocate_words = MIN2(pointer_delta(cur->end(), cur->top(), HeapWordSize),
 288                                MAX2(to_allocate_words, G1CollectedHeap::min_fill_size()));
 289 
 290       // Skip allocation if there is not enough space to allocate even the smallest
 291       // possible object. In this case this region will not be retained, so the
 292       // original problem cannot occur.
 293       if (to_allocate_words >= G1CollectedHeap::min_fill_size()) {
 294         HeapWord* dummy = attempt_allocation(to_allocate_words, true /* bot_updates */);
 295         CollectedHeap::fill_with_object(dummy, to_allocate_words);
 296       }
 297     }
 298   }
 299   return G1AllocRegion::release();
 300 }
< prev index next >