RFR(S): 8223444: Improve CodeHeap Free Space Management

Tobias Hartmann tobias.hartmann at oracle.com
Mon May 20 10:59:28 UTC 2019


Hi Lutz,

On 20.05.19 12:49, Schmidt, Lutz wrote:
> Hi Tobias, 
> 
> thank you for your comments.
> 
> I do not need "res". It's just personal preference. I like variable names which tell something about their contents. A reasonably capable compiler should be able to avoid stack footprint for res.

Okay, fine with me.

> Yes, I can convert the warning into an assert if you like. I opted for warning to get information about all segments with unexpected state, not just the first one. Now that it works, I can live with assert as well. Do you need to see a new full webrev? Here is the delta: 
> 
> diff -r 802d016189e0 src/hotspot/share/memory/heap.cpp
> --- a/src/hotspot/share/memory/heap.cpp	Mon May 20 12:12:01 2019 +0200
> +++ b/src/hotspot/share/memory/heap.cpp	Mon May 20 12:43:31 2019 +0200
> @@ -629,14 +629,10 @@
>        size_t segn = seg1 + b->length();
>        for (size_t i = seg1; i < segn; i++) {
>          nseg++;
> -        if (is_segment_unused(seg_map[i])) {
> -          warning("CodeHeap: unused segment. %d [%d..%d], %s block", (int)i, (int)seg1, (int)segn, b->free()? "free":"used");
> -        }
> +        assert(is_segment_unused(seg_map[i]), "CodeHeap: unused segment. %d [%d..%d], %s block", (int)i, (int)seg1, (int)segn, b->free()? "free":"used");
>        }
>      }
> -    if (nseg != _next_segment) {
> -      warning("CodeHeap: segment count mismatch. found %d, expected %d.", (int)nseg, (int)_next_segment);
> -    }
> +    assert(nseg != _next_segment, "CodeHeap: segment count mismatch. found %d, expected %d.", (int)nseg, (int)_next_segment);
>  
>      // Verify that the number of free blocks is not out of hand.
>      static int free_block_threshold = 10000;

Looks good. Please re-run testing before pushing.

Thanks,
Tobias


More information about the hotspot-compiler-dev mailing list