4641 register_region_with_region_attr(new_alloc_region);
4642 _hr_printer.alloc(new_alloc_region);
4643 return new_alloc_region;
4644 }
4645 return NULL;
4646 }
4647
4648 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
4649 size_t allocated_bytes,
4650 G1HeapRegionAttr dest) {
4651 policy()->record_bytes_copied_during_gc(allocated_bytes);
4652 if (dest.is_old()) {
4653 old_set_add(alloc_region);
4654 } else {
4655 assert(dest.is_young(), "Retiring alloc region should be young (%d)", dest.type());
4656 _survivor.add_used_bytes(allocated_bytes);
4657 }
4658
4659 bool const during_im = collector_state()->in_initial_mark_gc();
4660 if (during_im && allocated_bytes > 0) {
4661 _cm->root_regions()->add(alloc_region);
4662 }
4663 _hr_printer.retire(alloc_region);
4664 }
4665
4666 HeapRegion* G1CollectedHeap::alloc_highest_free_region() {
4667 bool expanded = false;
4668 uint index = _hrm->find_highest_free(&expanded);
4669
4670 if (index != G1_NO_HRM_INDEX) {
4671 if (expanded) {
4672 log_debug(gc, ergo, heap)("Attempt heap expansion (requested address range outside heap bounds). region size: " SIZE_FORMAT "B",
4673 HeapRegion::GrainWords * HeapWordSize);
4674 }
4675 _hrm->allocate_free_regions_starting_at(index, 1);
4676 return region_at(index);
4677 }
4678 return NULL;
4679 }
4680
4681 // Optimized nmethod scanning
|
4641 register_region_with_region_attr(new_alloc_region);
4642 _hr_printer.alloc(new_alloc_region);
4643 return new_alloc_region;
4644 }
4645 return NULL;
4646 }
4647
4648 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
4649 size_t allocated_bytes,
4650 G1HeapRegionAttr dest) {
4651 policy()->record_bytes_copied_during_gc(allocated_bytes);
4652 if (dest.is_old()) {
4653 old_set_add(alloc_region);
4654 } else {
4655 assert(dest.is_young(), "Retiring alloc region should be young (%d)", dest.type());
4656 _survivor.add_used_bytes(allocated_bytes);
4657 }
4658
4659 bool const during_im = collector_state()->in_initial_mark_gc();
4660 if (during_im && allocated_bytes > 0) {
4661 _cm->root_regions()->add(alloc_region->next_top_at_mark_start(), alloc_region->top());
4662 }
4663 _hr_printer.retire(alloc_region);
4664 }
4665
4666 HeapRegion* G1CollectedHeap::alloc_highest_free_region() {
4667 bool expanded = false;
4668 uint index = _hrm->find_highest_free(&expanded);
4669
4670 if (index != G1_NO_HRM_INDEX) {
4671 if (expanded) {
4672 log_debug(gc, ergo, heap)("Attempt heap expansion (requested address range outside heap bounds). region size: " SIZE_FORMAT "B",
4673 HeapRegion::GrainWords * HeapWordSize);
4674 }
4675 _hrm->allocate_free_regions_starting_at(index, 1);
4676 return region_at(index);
4677 }
4678 return NULL;
4679 }
4680
4681 // Optimized nmethod scanning
|