On Fri, 28 Aug 2026 09:21:22 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 with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 13 additional 
> commits since the last revision:
> 
>  - Check null marker for value object
>  - Merge branch 'master' into JDK-8390106
>  - Update comments
>  - Add isInline()
>  - Update 
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/FlattenedInline.java
>    
>    Co-authored-by: Chris Plummer <[email protected]>
>  - Introduce FlattenedInline.java in SA
>  - Add comments for Inline
>  - Use if-else to create new oop
>  - Refactoring
>  - Remove isInline()
>  - ... and 3 more: https://git.openjdk.org/jdk/compare/cf30e60e...ae766f2a

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/FlattenedInline.java 
line 40:

> 38:  * in SA to handle a flattened object in same way as an oop.
> 39:  */
> 40: public class FlattenedInline extends Inline {

Aren't there a bunch of Oop methods that if called on a FlattenedInline would 
fail because they assume `handle` really is a pointer to the start of the 
object and expect to find an object header there? Where are the safeguards for 
that? It seems the only useful thing FlattenedInline is doing is supporting 
getKlass() without the need for an object header, but there is a bunch of other 
Oop functionality missing, and I'm not sure if it ever needed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3881653165

Reply via email to