Skip to content
Permalink
Browse files
8253286: Use expand_exact() instead of expand_at() for fixed requests…
… in G1

Reviewed-by: tschatzl, ayang
  • Loading branch information
kstefanj committed Sep 21, 2020
1 parent bba948f commit edc14f92d92f40e596ef89ad57330ea70b1542df
Showing 1 changed file with 8 additions and 7 deletions.
@@ -468,16 +468,17 @@ HeapRegionRange HeapRegionManager::find_unavailable_from_idx(uint index) const {
uint HeapRegionManager::find_highest_free(bool* expanded) {
// Loop downwards from the highest region index, looking for an
// entry which is either free or not yet committed. If not yet
// committed, expand_at that index.
// committed, expand at that index.
uint curr = reserved_length() - 1;
while (true) {
HeapRegion *hr = _regions.get_by_index(curr);
if (hr == NULL || !is_available(curr)) {
uint res = expand_at(curr, 1, NULL);
if (res == 1) {
*expanded = true;
return curr;
}
// Found uncommitted and free region, expand to make it available for use.
expand_exact(curr, 1, NULL);
assert(at(curr)->is_free(), "Region (%u) must be available and free after expand", curr);

*expanded = true;
return curr;
} else {
if (hr->is_free()) {
*expanded = false;
@@ -501,7 +502,7 @@ bool HeapRegionManager::allocate_containing_regions(MemRegion range, size_t* com
for (uint curr_index = start_index; curr_index <= last_index; curr_index++) {
if (!is_available(curr_index)) {
commits++;
expand_at(curr_index, 1, pretouch_workers);
expand_exact(curr_index, 1, pretouch_workers);
}
HeapRegion* curr_region = _regions.get_by_index(curr_index);
if (!curr_region->is_free()) {

1 comment on commit edc14f9

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on edc14f9 Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.