On Thu, 10 Sep 2026 06:03:51 GMT, Yasumasa Suenaga <[email protected]> wrote:
>> Value Object has been introduced since JDK 28 (as a preview feature),
>> however it cannot be handled in SA.
>>
>>
>> public value class Test{
>>
>> public static value record Rec(byte recA, byte recB){};
>>
>> byte a;
>>
>> byte b;
>>
>> Rec rec;
>>
>> byte c;
>> }
>>
>>
>> `rec` as `Test$Rec` can be inlined into the instance of `Test`, but it would
>> be shown as "Bad OOP" in "inspect" on SA. SA should show valid values in
>> `rec`.
>>
>> Note that his change would expand flattened object in below in `inspect`
>> CLHSDB command:
>>
>>
>> hsdb> inspect 0xc22419e8
>> instance of Oop for LingeredAppWithValueObject$ValueObj @ 0x00000000c22419e8
>> (size = 16)
>> _mark: 73201086130815105
>> a: 1
>> b: 2
>> rec:
>> recA: 10
>> recB: 20
>> c: 3
>>
>>
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Yasumasa Suenaga has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Refer ValueFieldLayoutInfo to instantiate flattened object
Thank you for updates. It looks good. Still posted one question.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ValueFieldLayoutInfoArray.java
line 56:
> 54:
> 55: public ValueFieldLayoutInfo at(int i) {
> 56: var addr = getDataStart().addOffsetTo(i *
> getElemType().getSize());
Q: I wonder if index bounds check is needed here or an assert for safety .
-------------
Marked as reviewed by sspitsyn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/32310#pullrequestreview-5163805018
PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3976448776