RFR: 8285984: G1: Use standard idiom for inlined payload in G1MonotonicArena::Segment [v2]
Leo Korinth
lkorinth at openjdk.org
Fri Sep 12 14:02:13 UTC 2025
On Fri, 12 Sep 2025 13:37:10 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision:
>>
>> may fail on 32 bit machines, added explicit alignas
>
> src/hotspot/share/gc/g1/g1MonotonicArena.hpp line 113:
>
>> 111: };
>> 112:
>> 113: static constexpr uint SegmentAlignment = 8;
>
> Maybe this should be called `SegmentMaxAlignment`, or `SegmentPayloadMaxAlignment`.
>
> And have a comment describing that we align the Segment class to this alignment to guarantee that the payload is aligned to all powers of 2 less than or equal to this value.
`SegmentPayloadMaxAlignment` is okay with me. `SegmentMaxAlignment` sounds wrong, as it is actually the minimum alignment for the Segment.
> 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?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27258#discussion_r2344340038
PR Review Comment: https://git.openjdk.org/jdk/pull/27258#discussion_r2344348392
More information about the hotspot-gc-dev
mailing list