6512 }
6513 set_par_threads(n_workers);
6514 }
6515
6516 // Methods for the GC alloc regions
6517
6518 HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
6519 uint count,
6520 GCAllocPurpose ap) {
6521 assert(FreeList_lock->owned_by_self(), "pre-condition");
6522
6523 if (count < g1_policy()->max_regions(ap)) {
6524 bool survivor = (ap == GCAllocForSurvived);
6525 HeapRegion* new_alloc_region = new_region(word_size,
6526 !survivor,
6527 true /* do_expand */);
6528 if (new_alloc_region != NULL) {
6529 // We really only need to do this for old regions given that we
6530 // should never scan survivors. But it doesn't hurt to do it
6531 // for survivors too.
6532 new_alloc_region->record_top_and_timestamp();
6533 if (survivor) {
6534 new_alloc_region->set_survivor();
6535 _hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
6536 check_bitmaps("Survivor Region Allocation", new_alloc_region);
6537 } else {
6538 new_alloc_region->set_old();
6539 _hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
6540 check_bitmaps("Old Region Allocation", new_alloc_region);
6541 }
6542 bool during_im = g1_policy()->during_initial_mark_pause();
6543 new_alloc_region->note_start_of_copying(during_im);
6544 return new_alloc_region;
6545 } else {
6546 g1_policy()->note_alloc_region_limit_reached(ap);
6547 }
6548 }
6549 return NULL;
6550 }
6551
6552 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
|
6512 }
6513 set_par_threads(n_workers);
6514 }
6515
6516 // Methods for the GC alloc regions
6517
6518 HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
6519 uint count,
6520 GCAllocPurpose ap) {
6521 assert(FreeList_lock->owned_by_self(), "pre-condition");
6522
6523 if (count < g1_policy()->max_regions(ap)) {
6524 bool survivor = (ap == GCAllocForSurvived);
6525 HeapRegion* new_alloc_region = new_region(word_size,
6526 !survivor,
6527 true /* do_expand */);
6528 if (new_alloc_region != NULL) {
6529 // We really only need to do this for old regions given that we
6530 // should never scan survivors. But it doesn't hurt to do it
6531 // for survivors too.
6532 new_alloc_region->record_timestamp();
6533 if (survivor) {
6534 new_alloc_region->set_survivor();
6535 _hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
6536 check_bitmaps("Survivor Region Allocation", new_alloc_region);
6537 } else {
6538 new_alloc_region->set_old();
6539 _hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
6540 check_bitmaps("Old Region Allocation", new_alloc_region);
6541 }
6542 bool during_im = g1_policy()->during_initial_mark_pause();
6543 new_alloc_region->note_start_of_copying(during_im);
6544 return new_alloc_region;
6545 } else {
6546 g1_policy()->note_alloc_region_limit_reached(ap);
6547 }
6548 }
6549 return NULL;
6550 }
6551
6552 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
|