< prev index next >

src/share/vm/gc_implementation/g1/g1Allocator.cpp

Print this page




  48   // We will discard the current GC alloc region if:
  49   // a) it's in the collection set (it can happen!),
  50   // b) it's already full (no point in using it),
  51   // c) it's empty (this means that it was emptied during
  52   // a cleanup and it should be on the free list now), or
  53   // d) it's humongous (this means that it was emptied
  54   // during a cleanup and was added to the free list, but
  55   // has been subsequently used to allocate a humongous
  56   // object that may be less than the region size).
  57   if (retained_region != NULL &&
  58       !retained_region->in_collection_set() &&
  59       !(retained_region->top() == retained_region->end()) &&
  60       !retained_region->is_empty() &&
  61       !retained_region->is_humongous()) {
  62     retained_region->record_timestamp();
  63     // The retained region was added to the old region set when it was
  64     // retired. We have to remove it now, since we don't allow regions
  65     // we allocate to in the region sets. We'll re-add it later, when
  66     // it's retired again.
  67     _g1h->_old_set.remove(retained_region);
  68     bool during_im = _g1h->g1_policy()->during_initial_mark_pause();
  69     retained_region->note_start_of_copying(during_im);
  70     old->set(retained_region);
  71     _g1h->_hr_printer.reuse(retained_region);
  72     evacuation_info.set_alloc_regions_used_before(retained_region->used());
  73   }
  74 }
  75 
  76 void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) {
  77   assert_at_safepoint(true /* should_be_vm_thread */);
  78 
  79   _survivor_gc_alloc_region.init();
  80   _old_gc_alloc_region.init();
  81   reuse_retained_old_region(evacuation_info,
  82                             &_old_gc_alloc_region,
  83                             &_retained_old_gc_alloc_region);
  84 }
  85 
  86 void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) {
  87   AllocationContext_t context = AllocationContext::current();
  88   evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() +




  48   // We will discard the current GC alloc region if:
  49   // a) it's in the collection set (it can happen!),
  50   // b) it's already full (no point in using it),
  51   // c) it's empty (this means that it was emptied during
  52   // a cleanup and it should be on the free list now), or
  53   // d) it's humongous (this means that it was emptied
  54   // during a cleanup and was added to the free list, but
  55   // has been subsequently used to allocate a humongous
  56   // object that may be less than the region size).
  57   if (retained_region != NULL &&
  58       !retained_region->in_collection_set() &&
  59       !(retained_region->top() == retained_region->end()) &&
  60       !retained_region->is_empty() &&
  61       !retained_region->is_humongous()) {
  62     retained_region->record_timestamp();
  63     // The retained region was added to the old region set when it was
  64     // retired. We have to remove it now, since we don't allow regions
  65     // we allocate to in the region sets. We'll re-add it later, when
  66     // it's retired again.
  67     _g1h->_old_set.remove(retained_region);
  68     bool during_im = _g1h->collector_state()->during_initial_mark_pause();
  69     retained_region->note_start_of_copying(during_im);
  70     old->set(retained_region);
  71     _g1h->_hr_printer.reuse(retained_region);
  72     evacuation_info.set_alloc_regions_used_before(retained_region->used());
  73   }
  74 }
  75 
  76 void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) {
  77   assert_at_safepoint(true /* should_be_vm_thread */);
  78 
  79   _survivor_gc_alloc_region.init();
  80   _old_gc_alloc_region.init();
  81   reuse_retained_old_region(evacuation_info,
  82                             &_old_gc_alloc_region,
  83                             &_retained_old_gc_alloc_region);
  84 }
  85 
  86 void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) {
  87   AllocationContext_t context = AllocationContext::current();
  88   evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() +


< prev index next >