@@ -66,7 +66,7 @@ G1HeapRegionManager::G1HeapRegionManager() :
66
66
_bot_mapper(nullptr ),
67
67
_cardtable_mapper(nullptr ),
68
68
_committed_map(),
69
- _allocated_heapregions_length (0 ),
69
+ _next_highest_used_hrm_index (0 ),
70
70
_regions(), _heap_mapper(nullptr ),
71
71
_bitmap_mapper(nullptr ),
72
72
_free_list(" Free list" , new G1MasterFreeRegionListChecker())
@@ -76,7 +76,7 @@ void G1HeapRegionManager::initialize(G1RegionToSpaceMapper* heap_storage,
76
76
G1RegionToSpaceMapper* bitmap,
77
77
G1RegionToSpaceMapper* bot,
78
78
G1RegionToSpaceMapper* cardtable) {
79
- _allocated_heapregions_length = 0 ;
79
+ _next_highest_used_hrm_index = 0 ;
80
80
81
81
_heap_mapper = heap_storage;
82
82
@@ -169,7 +169,7 @@ void G1HeapRegionManager::expand(uint start, uint num_regions, WorkerThreads* pr
169
169
hr = new_heap_region (i);
170
170
OrderAccess::storestore ();
171
171
_regions.set_by_index (i, hr);
172
- _allocated_heapregions_length = MAX2 (_allocated_heapregions_length , i + 1 );
172
+ _next_highest_used_hrm_index = MAX2 (_next_highest_used_hrm_index , i + 1 );
173
173
}
174
174
G1HeapRegionPrinter::commit (hr);
175
175
}
@@ -489,7 +489,7 @@ uint G1HeapRegionManager::find_contiguous_allow_expand(uint num_regions) {
489
489
G1HeapRegion* G1HeapRegionManager::next_region_in_heap (const G1HeapRegion* r) const {
490
490
guarantee (r != nullptr , " Start region must be a valid region" );
491
491
guarantee (is_available (r->hrm_index ()), " Trying to iterate starting from region %u which is not in the heap" , r->hrm_index ());
492
- for (uint i = r->hrm_index () + 1 ; i < _allocated_heapregions_length ; i++) {
492
+ for (uint i = r->hrm_index () + 1 ; i < _next_highest_used_hrm_index ; i++) {
493
493
G1HeapRegion* hr = _regions.get_by_index (i);
494
494
if (is_available (i)) {
495
495
return hr;
@@ -583,16 +583,16 @@ void G1HeapRegionManager::par_iterate(G1HeapRegionClosure* blk, G1HeapRegionClai
583
583
584
584
uint G1HeapRegionManager::shrink_by (uint num_regions_to_remove) {
585
585
assert (length () > 0 , " the region sequence should not be empty" );
586
- assert (length () <= _allocated_heapregions_length , " invariant" );
587
- assert (_allocated_heapregions_length > 0 , " we should have at least one region committed" );
586
+ assert (length () <= _next_highest_used_hrm_index , " invariant" );
587
+ assert (_next_highest_used_hrm_index > 0 , " we should have at least one region committed" );
588
588
assert (num_regions_to_remove < length (), " We should never remove all regions" );
589
589
590
590
if (num_regions_to_remove == 0 ) {
591
591
return 0 ;
592
592
}
593
593
594
594
uint removed = 0 ;
595
- uint cur = _allocated_heapregions_length ;
595
+ uint cur = _next_highest_used_hrm_index ;
596
596
uint idx_last_found = 0 ;
597
597
uint num_last_found = 0 ;
598
598
@@ -624,7 +624,7 @@ void G1HeapRegionManager::shrink_at(uint index, size_t num_regions) {
624
624
}
625
625
626
626
uint G1HeapRegionManager::find_empty_from_idx_reverse (uint start_idx, uint * res_idx) const {
627
- guarantee (start_idx <= _allocated_heapregions_length , " checking" );
627
+ guarantee (start_idx <= _next_highest_used_hrm_index , " checking" );
628
628
guarantee (res_idx != nullptr , " checking" );
629
629
630
630
auto is_available_and_empty = [&] (uint index ) {
@@ -658,20 +658,20 @@ uint G1HeapRegionManager::find_empty_from_idx_reverse(uint start_idx, uint* res_
658
658
}
659
659
660
660
void G1HeapRegionManager::verify () {
661
- guarantee (length () <= _allocated_heapregions_length ,
662
- " invariant: _length: %u _allocated_length : %u" ,
663
- length (), _allocated_heapregions_length );
664
- guarantee (_allocated_heapregions_length <= reserved_length (),
665
- " invariant: _allocated_length : %u _max_length: %u" ,
666
- _allocated_heapregions_length , reserved_length ());
661
+ guarantee (length () <= _next_highest_used_hrm_index ,
662
+ " invariant: _length: %u _next_highest_used_hrm_index : %u" ,
663
+ length (), _next_highest_used_hrm_index );
664
+ guarantee (_next_highest_used_hrm_index <= reserved_length (),
665
+ " invariant: _next_highest_used_hrm_index : %u _max_length: %u" ,
666
+ _next_highest_used_hrm_index , reserved_length ());
667
667
guarantee (length () <= max_length (),
668
668
" invariant: committed regions: %u max_regions: %u" ,
669
669
length (), max_length ());
670
670
671
671
bool prev_committed = true ;
672
672
uint num_committed = 0 ;
673
673
HeapWord* prev_end = heap_bottom ();
674
- for (uint i = 0 ; i < _allocated_heapregions_length ; i++) {
674
+ for (uint i = 0 ; i < _next_highest_used_hrm_index ; i++) {
675
675
if (!is_available (i)) {
676
676
prev_committed = false ;
677
677
continue ;
@@ -693,7 +693,7 @@ void G1HeapRegionManager::verify() {
693
693
prev_committed = true ;
694
694
prev_end = hr->end ();
695
695
}
696
- for (uint i = _allocated_heapregions_length ; i < reserved_length (); i++) {
696
+ for (uint i = _next_highest_used_hrm_index ; i < reserved_length (); i++) {
697
697
guarantee (_regions.get_by_index (i) == nullptr , " invariant i: %u" , i);
698
698
}
699
699
@@ -708,7 +708,7 @@ void G1HeapRegionManager::verify_optional() {
708
708
#endif // PRODUCT
709
709
710
710
G1HeapRegionClaimer::G1HeapRegionClaimer (uint n_workers) :
711
- _n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm._allocated_heapregions_length ), _claims(nullptr ) {
711
+ _n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm._next_highest_used_hrm_index ), _claims(nullptr ) {
712
712
uint * new_claims = NEW_C_HEAP_ARRAY (uint , _n_regions, mtGC);
713
713
memset (new_claims, Unclaimed, sizeof (*_claims) * _n_regions);
714
714
_claims = new_claims;
0 commit comments