On Mon, 31 Aug 2026 14:13:36 GMT, Frederic Parain <[email protected]> wrote:
>> Johan Sjölen has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Self-review
>
> src/hotspot/share/oops/layoutKind.hpp line 161:
>
>> 159:
>> 160: // Returns default value if missing
>> 161: int size_in_bytes_of(LayoutKind lk, int default_value = -1) const {
>
> Why is there a default_value argument? Looks dangerous to return a value when
> no value is available. An error should be detected instead.
Often, we are not concerned with the exact size, but simply wants the largest
size available among a few layouts. Then, we can do something like what we do
here:
https://github.com/openjdk/jdk/pull/32276/changes#diff-bdfdbe1685717bf0c72c691043ced9bbe148364cbe7bf055857c72eb07f4ad62L1306
The reason that I went for having a `default_value` is that I think it's more
dangerous to depend on the exact choice of sentinel value.
We might want to introduce a helper `largest_layout_of(LK::A, ..., LK::N)`, but
I'd really like to hold off on that for a future RFE.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32276#discussion_r3900801384