RFR: 8311248: Refactor CodeCache::initialize_heaps to simplify adding new CodeCache segments [v7]

Evgeny Astigeevich eastigeevich at openjdk.org
Mon Feb 19 20:36:56 UTC 2024


On Fri, 16 Feb 2024 10:23:06 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:

>> These changes clean up the logic and the code of allocating codecache segments and add more testing of it, to open a door for further optimization of code cache segmentation.  The goal was to keep the behavior as close to the existing behavior as possible, even if it's not quite logical.
>> 
>> Also, these changes better account for alignment - PrintFlagsFinal shows the final aligned segment sizes, and the segments fill the ReservedCodeCacheSize without gaps caused by alignment.
>
> Boris Ulasevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   minor update. removed helper function as it caused many comments in the review

src/hotspot/share/code/codeCache.cpp line 278:

> 276:   if (!check_min_size("non-nmethod code heap", non_nmethod.size, non_nmethod_min_size) ||
> 277:      (profiled.enabled && !check_min_size("profiled code heap", profiled.size, min_size)) ||
> 278:      (non_profiled.enabled && !check_min_size("non-profiled code heap", non_profiled.size, min_size)) ||

A redundant check: the non-profiled code heap is always enabled.

src/hotspot/share/code/codeCache.cpp line 289:

> 287:       message.append(" + ProfiledCodeHeapSize (" SIZE_FORMAT "K)", profiled.size/K);
> 288:     }
> 289:     if (non_profiled.enabled) {

A redundant check: the non-profiled code heap is always enabled.

src/hotspot/share/code/codeCache.cpp line 312:

> 310:   // last adjustment: leftovers from page alignment go to non_nmethod segment
> 311:   non_nmethod.size += non_profiled.size & alignment_mask(min_size);
> 312:   non_nmethod.size += profiled.size & alignment_mask(min_size);

Why do we need this code?

src/hotspot/share/code/codeCache.cpp line 343:

> 341:   add_heap(non_method_space, "CodeHeap 'non-nmethods'", CodeBlobType::NonNMethod);
> 342: 
> 343:   if (non_profiled.enabled) {

A redundant check: the non-profiled code heap is always enabled.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17244#discussion_r1494990084
PR Review Comment: https://git.openjdk.org/jdk/pull/17244#discussion_r1494990866
PR Review Comment: https://git.openjdk.org/jdk/pull/17244#discussion_r1494993633
PR Review Comment: https://git.openjdk.org/jdk/pull/17244#discussion_r1494994590


More information about the hotspot-dev mailing list