RFR: 8336378: Parallel: Rename allocate to expand_and_allocate in PSOldGen

Ivan Walulya iwalulya at openjdk.org
Mon Jul 15 09:57:55 UTC 2024


On Mon, 15 Jul 2024 09:49:03 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> src/hotspot/share/gc/parallel/psOldGen.hpp line 124:
>> 
>>> 122:     HeapWord* res;
>>> 123:     do {
>>> 124:       res = cas_allocate_noexpand(word_size);
>> 
>> seems incorrect that we can allocate without expanding, yet the method name is "expand_and_allocate". Or you write a bit more about the motivation behind this renaming.
>
> `ParallelScavengeHeap::expand_heap_and_allocate` can allocate without doing expansion. The renaming is mostly for including the potential expansion in the name. Otherwise, it's not obvious that expansion is attempted in the caller context.

So is the motivation that `ParallelScavengeHeap::expand_heap_and_allocate` already uses the name? `TenuredGeneration::expand_and_allocate` is named correctly as it expands and allocates. In cases where the expansion is optional, it appears to me that that is implementation detail that doesn't need to be part of the interface naming.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20181#discussion_r1677579988


More information about the hotspot-gc-dev mailing list