< prev index next >

src/share/vm/gc/g1/heapRegionManager.cpp

Print this page
rev 8825 : [mq]: rev2
rev 8826 : [mq]: rev3

*** 424,444 **** while ((removed < num_regions_to_remove) && (num_last_found = find_empty_from_idx_reverse(cur, &idx_last_found)) > 0) { uint to_remove = MIN2(num_regions_to_remove - removed, num_last_found); ! uncommit_regions(idx_last_found + num_last_found - to_remove, to_remove); cur -= num_last_found; removed += to_remove; } verify_optional(); return removed; } uint HeapRegionManager::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const { guarantee(start_idx < _allocated_heapregions_length, "checking"); guarantee(res_idx != NULL, "checking"); uint num_regions_found = 0; --- 424,455 ---- while ((removed < num_regions_to_remove) && (num_last_found = find_empty_from_idx_reverse(cur, &idx_last_found)) > 0) { uint to_remove = MIN2(num_regions_to_remove - removed, num_last_found); ! shrink_at(idx_last_found + num_last_found - to_remove, to_remove); cur -= num_last_found; removed += to_remove; } verify_optional(); return removed; } + void HeapRegionManager::shrink_at(uint index, size_t num_regions) { + #ifdef ASSERT + for (uint i = index; i < (index + num_regions); i++) { + assert(is_available(i), err_msg("Expected available region at index %u", i)); + assert(at(i)->is_empty(), err_msg("Expected empty region at index %u", i)); + assert(at(i)->is_free(), err_msg("Expected free region at index %u", i)); + } + #endif + uncommit_regions(index, num_regions); + } + uint HeapRegionManager::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const { guarantee(start_idx < _allocated_heapregions_length, "checking"); guarantee(res_idx != NULL, "checking"); uint num_regions_found = 0;
< prev index next >