RFR: 8318817: Could not reserve enough space in CodeHeap 'profiled nmethods' (0K) [v4]

Daniel Lundén duke at openjdk.org
Wed Nov 1 15:57:06 UTC 2023


On Tue, 31 Oct 2023 18:05:24 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Daniel Lundén has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Invert incorrect assert
>
> src/hotspot/share/code/codeCache.cpp line 241:
> 
>> 239:       // Ensure at least min_size is available for profiled and non-profiled
>> 240:       // methods
>> 241:       non_nmethod_size = MIN2(non_nmethod_size, cache_size - 2 * min_size);
> 
> Would it not be simpler to just do above:
> 
> 
> if (cache_size > (non_method_size - 2 * min_size)) {
> 
> 
> ?
> 
> Also, can this calculation produce 0 or negative overflow?

I have changed it a bit now (based on your suggested simplification); please check and see if you agree with the new version. I have also experimented a bit with different flags (`-XX:ReservedCodeCacheSize`, `-XX:InitialCodeCacheSize`, `-XX:+SegmentedCodeCache`, `-XX:CodeCacheMinimumUseSpace`) trying to get the expression `cache_size - 2 * min_size` to negatively overflow, without success. The expression is also present even before my change, so i believe it is safe to assume that `cache_size > 2 * min_size` (but I cannot guarantee it).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16373#discussion_r1378987886


More information about the hotspot-compiler-dev mailing list