On Wed, 26 Aug 2026 13:02:08 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:
>
> Introduce FlattenedInline.java in SA
This looks a lot better now. I have some minor comments:
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/FlattenedInline.java
line 37:
> 35: * FlattenedInline represents flattened object in HotSpot.
> 36: * Note that there is no corresponding class in HotSpot. This class is
> used
> 37: * in SA to handle flattened object in same way with oop.
Suggestion:
* FlattenedInline represents a flattened object in HotSpot.
* Note that there is no corresponding class in HotSpot. This class is used
* in SA to handle a flattened object in same way as an oop.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java line
198:
> 196:
> 197: // This method would be used to instantiate flattened object.
> 198: public Oop newOop(OopHandle handle, InlineKlass klass) {
Just want to make sure I'm understanding this correctly. `handle` is not
actually a valid handle, but is instead an offset off of a valid handle. I
think this should be made clear here.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java line
199:
> 197: // This method would be used to instantiate flattened object.
> 198: public Oop newOop(OopHandle handle, InlineKlass klass) {
> 199: return (handle == null) ? null
Can it really ever be null? This seems like it would be a bug.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Oop.java line 102:
> 100:
> 101: // Type test operations
> 102: public boolean isInline() { return false; }
This isn't used or overridden. It might be worth keeping around, but I think it
needs to be overridden in Inline.
-------------
Changes requested by cjplummer (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/32310#pullrequestreview-5035174758
PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3866820591
PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3866917728
PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3866920233
PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3866898970