On Thu, 10 Sep 2026 01:11:43 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 two 
> additional commits since the last revision:
> 
>  - Check null marker
>  - ValueKlass should be evaluated before InstanceKlass

I'd like to double-check if test coverage is good enough.
Do we need test cases for ? :
 - null-restricted flat field without a null marker case
 - non-flattened heap value object case
 - flattened array coverage
 - two class loaders having classes with the same name (it is for completeness 
but not critical)

I'm not sure all this is needed in this fix. I'd leave it to experts to decide.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopField.java line 49:

> 47:     var sig = getSignature().asString();
> 48:     var klsName = sig.substring(1, sig.length() - 1); // extracts L(class 
> name);
> 49:     return SystemDictionaryHelper.findInstanceKlass(klsName);

Q: I'm curious what might happen if there are more than one `ClassLoader` 
having class with the same name? It feels like this potential issue is more 
important for flattened field layouts.

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

PR Review: https://git.openjdk.org/jdk/pull/32310#pullrequestreview-5162356609
PR Review Comment: https://git.openjdk.org/jdk/pull/32310#discussion_r3975212856

Reply via email to