Print this page
8236073: G1: Use SoftMaxHeapSize to guide GC heuristics

*** 156,173 **** } if (cur == end_idx + 1) { return num_regions; } *res_idx = cur; ! while (cur <= end_idx && !is_available(cur)) { cur++; } num_regions = cur - *res_idx; #ifdef ASSERT for (uint i = *res_idx; i < (*res_idx + num_regions); i++) { ! assert(!is_available(i), "just checking"); } assert(cur == end_idx + 1 || num_regions == 0 || is_available(cur), "The region at the current position %u must be available or at the end", cur); #endif return num_regions; --- 156,173 ---- } if (cur == end_idx + 1) { return num_regions; } *res_idx = cur; ! while (cur <= end_idx && is_unavailable_for_allocation(cur)) { cur++; } num_regions = cur - *res_idx; #ifdef ASSERT for (uint i = *res_idx; i < (*res_idx + num_regions); i++) { ! assert(is_unavailable_for_allocation(i), "just checking"); } assert(cur == end_idx + 1 || num_regions == 0 || is_available(cur), "The region at the current position %u must be available or at the end", cur); #endif return num_regions;
*** 345,357 **** uint cur = (uint)start; uint length_unavailable = 0; while (length_found < num && cur <= end) { HeapRegion* hr = _regions.get_by_index(cur); ! if ((!empty_only && !is_available(cur)) || (is_available(cur) && hr != NULL && hr->is_empty())) { // This region is a potential candidate for allocation into. ! if (!is_available(cur)) { if(shrink_dram(1) == 1) { uint ret = expand_in_range(cur, cur, 1, NULL); assert(ret == 1, "We should be able to expand at this index"); } else { length_unavailable++; --- 345,357 ---- uint cur = (uint)start; uint length_unavailable = 0; while (length_found < num && cur <= end) { HeapRegion* hr = _regions.get_by_index(cur); ! if ((!empty_only && is_unavailable_for_allocation(cur)) || (is_available(cur) && hr != NULL && hr->is_empty())) { // This region is a potential candidate for allocation into. ! if (is_unavailable_for_allocation(cur)) { if(shrink_dram(1) == 1) { uint ret = expand_in_range(cur, cur, 1, NULL); assert(ret == 1, "We should be able to expand at this index"); } else { length_unavailable++;
*** 369,379 **** if (length_found == num) { for (uint i = found; i < (found + num); i++) { HeapRegion* hr = _regions.get_by_index(i); // sanity check ! guarantee((!empty_only && !is_available(i)) || (is_available(i) && hr != NULL && hr->is_empty()), "Found region sequence starting at " UINT32_FORMAT ", length " SIZE_FORMAT " that is not empty at " UINT32_FORMAT ". Hr is " PTR_FORMAT, found, num, i, p2i(hr)); } if (!empty_only && length_unavailable > (max_expandable_length() - total_regions_committed())) { // if 'length_unavailable' number of regions will be made available, we will exceed max regions. --- 369,379 ---- if (length_found == num) { for (uint i = found; i < (found + num); i++) { HeapRegion* hr = _regions.get_by_index(i); // sanity check ! guarantee((!empty_only && is_unavailable_for_allocation(i)) || (is_available(i) && hr != NULL && hr->is_empty()), "Found region sequence starting at " UINT32_FORMAT ", length " SIZE_FORMAT " that is not empty at " UINT32_FORMAT ". Hr is " PTR_FORMAT, found, num, i, p2i(hr)); } if (!empty_only && length_unavailable > (max_expandable_length() - total_regions_committed())) { // if 'length_unavailable' number of regions will be made available, we will exceed max regions.