5316 HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, |
5316 HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, |
5317 bool force) { |
5317 bool force) { |
5318 assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); |
5318 assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); |
5319 assert(!force || g1_policy()->can_expand_young_list(), |
5319 assert(!force || g1_policy()->can_expand_young_list(), |
5320 "if force is true we should be able to expand the young list"); |
5320 "if force is true we should be able to expand the young list"); |
5321 bool young_list_full = g1_policy()->is_young_list_full(); |
5321 bool should_allocate = g1_policy()->should_allocate_mutator_region(); |
5322 if (force || !young_list_full) { |
5322 if (force || should_allocate) { |
5323 HeapRegion* new_alloc_region = new_region(word_size, |
5323 HeapRegion* new_alloc_region = new_region(word_size, |
5324 false /* is_old */, |
5324 false /* is_old */, |
5325 false /* do_expand */); |
5325 false /* do_expand */); |
5326 if (new_alloc_region != NULL) { |
5326 if (new_alloc_region != NULL) { |
5327 set_region_short_lived_locked(new_alloc_region); |
5327 set_region_short_lived_locked(new_alloc_region); |
5328 _hr_printer.alloc(new_alloc_region, young_list_full); |
5328 _hr_printer.alloc(new_alloc_region, !should_allocate); |
5329 _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region); |
5329 _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region); |
5330 return new_alloc_region; |
5330 return new_alloc_region; |
5331 } |
5331 } |
5332 } |
5332 } |
5333 return NULL; |
5333 return NULL; |