RFR: 8285984: G1: Use standard idiom for inlined payload in G1MonotonicArena::Segment [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Fri Sep 12 14:52:53 UTC 2025


On Fri, 12 Sep 2025 13:58:06 GMT, Leo Korinth <lkorinth at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1MonotonicArena.hpp line 239:
>> 
>>> 237:     assert(_max_num_slots > 0, "Must be");
>>> 238:     assert(_slot_alignment > 0, "Must be");
>>> 239:     assert(_slot_alignment <= SegmentAlignment, "Must be");
>> 
>> Not sure if it should be clarified that this assert is sufficient because we only ever use allow alignments which are a power of two.
>
> Do you wish me to assert that it is a power of two as well?

Not sure. Technically it is already asserted in the `align_up` call above. 

I guess what we really want to ensure is that `_slot_alignment` is a divisor of `SegmentAlignment`. So maybe `SegmentAlignment % _slot_alignment == 0` is the correct assert.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27258#discussion_r2344487467


More information about the hotspot-gc-dev mailing list