On Sat, 12 Sep 2026 05:51:12 GMT, Yasumasa Suenaga <[email protected]> wrote:

> After Valhalla, `InstanceKlass::size()` in HotSpot adds sizeof 
> `ValueKlass::Members` for value class, however SA does not do. It caused the 
> failure in TestInstanceKlassSize.java with `--enable-preview`.
> 
> This PR fixes the problem, and adds the test for `java.lang.Byte` to 
> TestInstanceKlassSize.java again (removed by JEP 401).
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

The test is intended to cover both cases.

With `--enable-preview` (via `JTREG=VM_OPTIONS=--enable-preview`), 
`java.lang.Byte` becomes a value object, and the test verifies that 
`InstanceKlass::getSize()` correctly includes the additional 
`ValueKlass::Members` area.

Without `--enable-preview`, the test verifies that this change does not affect 
the existing `InstanceKlass::getSize()` behavior.

So I think running the test both with and without `--enable-preview` provides 
coverage for both the existing behavior and the value-class-specific change.

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

PR Comment: https://git.openjdk.org/jdk/pull/32848#issuecomment-5694362635

Reply via email to