--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp Tue Aug 25 21:05:26 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp Tue Aug 25 17:22:56 2015 -0400
@@ -426,7 +426,7 @@
(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);
+ shrink_at(idx_last_found + num_last_found - to_remove, to_remove);
cur = idx_last_found;
removed += to_remove;
@@ -437,6 +437,17 @@
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");