< prev index next >

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

Print this page
rev 11010 : 8155082: Refactor mutator region restriction
Reviewed-by:


5310          "value: " SIZE_FORMAT " recalculated: " SIZE_FORMAT,
5311          used_unlocked(), recalculate_used());
5312 }
5313 
5314 void G1CollectedHeap::set_refine_cte_cl_concurrency(bool concurrent) {
5315   _refine_cte_cl->set_concurrent(concurrent);
5316 }
5317 
5318 bool G1CollectedHeap::is_in_closed_subset(const void* p) const {
5319   HeapRegion* hr = heap_region_containing(p);
5320   return hr->is_in(p);
5321 }
5322 
5323 // Methods for the mutator alloc region
5324 
5325 HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
5326                                                       bool force) {
5327   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
5328   assert(!force || g1_policy()->can_expand_young_list(),
5329          "if force is true we should be able to expand the young list");
5330   bool young_list_full = g1_policy()->is_young_list_full();
5331   if (force || !young_list_full) {
5332     HeapRegion* new_alloc_region = new_region(word_size,
5333                                               false /* is_old */,
5334                                               false /* do_expand */);
5335     if (new_alloc_region != NULL) {
5336       set_region_short_lived_locked(new_alloc_region);
5337       _hr_printer.alloc(new_alloc_region, young_list_full);
5338       _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region);
5339       return new_alloc_region;
5340     }
5341   }
5342   return NULL;
5343 }
5344 
5345 void G1CollectedHeap::retire_mutator_alloc_region(HeapRegion* alloc_region,
5346                                                   size_t allocated_bytes) {
5347   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
5348   assert(alloc_region->is_eden(), "all mutator alloc regions should be eden");
5349 
5350   collection_set()->add_eden_region(alloc_region);
5351   increase_used(allocated_bytes);
5352   _hr_printer.retire(alloc_region);
5353   // We update the eden sizes here, when the region is retired,
5354   // instead of when it's allocated, since this is the point that its
5355   // used space has been recored in _summary_bytes_used.
5356   g1mm()->update_eden_size();
5357 }




5310          "value: " SIZE_FORMAT " recalculated: " SIZE_FORMAT,
5311          used_unlocked(), recalculate_used());
5312 }
5313 
5314 void G1CollectedHeap::set_refine_cte_cl_concurrency(bool concurrent) {
5315   _refine_cte_cl->set_concurrent(concurrent);
5316 }
5317 
5318 bool G1CollectedHeap::is_in_closed_subset(const void* p) const {
5319   HeapRegion* hr = heap_region_containing(p);
5320   return hr->is_in(p);
5321 }
5322 
5323 // Methods for the mutator alloc region
5324 
5325 HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
5326                                                       bool force) {
5327   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
5328   assert(!force || g1_policy()->can_expand_young_list(),
5329          "if force is true we should be able to expand the young list");
5330   bool should_allocate = g1_policy()->should_allocate_mutator_region();
5331   if (force || should_allocate) {
5332     HeapRegion* new_alloc_region = new_region(word_size,
5333                                               false /* is_old */,
5334                                               false /* do_expand */);
5335     if (new_alloc_region != NULL) {
5336       set_region_short_lived_locked(new_alloc_region);
5337       _hr_printer.alloc(new_alloc_region, !should_allocate);
5338       _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region);
5339       return new_alloc_region;
5340     }
5341   }
5342   return NULL;
5343 }
5344 
5345 void G1CollectedHeap::retire_mutator_alloc_region(HeapRegion* alloc_region,
5346                                                   size_t allocated_bytes) {
5347   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
5348   assert(alloc_region->is_eden(), "all mutator alloc regions should be eden");
5349 
5350   collection_set()->add_eden_region(alloc_region);
5351   increase_used(allocated_bytes);
5352   _hr_printer.retire(alloc_region);
5353   // We update the eden sizes here, when the region is retired,
5354   // instead of when it's allocated, since this is the point that its
5355   // used space has been recored in _summary_bytes_used.
5356   g1mm()->update_eden_size();
5357 }


< prev index next >