On Thu, 16 Apr 2026 11:17:48 GMT, Christian Hagedorn <[email protected]> 
wrote:

>> This patch fixes various issues found with abstract value classes where the 
>> assumption was that we have a concrete value class but we actually could 
>> have an abstract value class as well.
>> 
>> The main issue found is that a concrete value class is represented with an 
>> `InlineKlass` while an abstract value class is represented with an 
>> `InstanceKlass`. Therefore, we cannot cast the latter to `InlineKlass`. 
>> While working on this, I checked all `is_inlinetype()` uses and found more 
>> issues. I also found issues around the `Arrays.copyOf/copyOfRange` intrinsic 
>> but left it as follow-up work and filed 
>> [JDK-8382226](https://bugs.openjdk.org/browse/JDK-8382226) for it. 
>> 
>> Here is a list of fixes included in this patch, together with corresponding 
>> tests:
>> 1. `GraphKit::get_layout_helper()`: Wrong old assumption that nullable 
>> implies not-flat.
>> 2. Checking whether we have a load/store from/to a field of an empty value 
>> class:
>> a. C1: `GraphBuilder::access_field()`, for static and instance field.
>> b. C2: `Parse::do_get_xxx()`, for loading
>> c. C2: `Parse::do_set_xxx()`, for storing
>> 3. `arraycopy` instrinsic: Not bailing out when src or dest is a flat 
>> abstract value class array - in this case we don't know the layout. We 
>> currently hit an assert due to an invalid cast, assuming concrete value 
>> classes when an array is flat.
>> 
>> Additional changes:
>> - Added some more asserts
>> - Some small code cleanups
>> 
>> Thanks,
>> Christian
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Christian Hagedorn has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   improve assert message

src/hotspot/share/c1/c1_GraphBuilder.cpp line 1902:

> 1900: 
> 1901:         ciType* field_type = field->type();
> 1902:         if (field_type->is_loaded() && field_type->is_inlinetype() && 
> field->type()->as_inline_klass()->is_empty() &&

Suggestion:

        if (field_type->is_loaded() && field_type->is_inlinetype() && 
field_type->as_inline_klass()->is_empty() &&

src/hotspot/share/c1/c1_GraphBuilder.cpp line 2098:

> 2096:       ciType* field_type = field->type();
> 2097:       if (field->is_null_free() && field_type->is_loaded() && 
> field_type->is_inlinetype() &&
> 2098:           field->type()->as_inline_klass()->is_empty() && 
> (!method()->is_object_constructor() || field->is_flat())) {

Suggestion:

          field_type->as_inline_klass()->is_empty() && 
(!method()->is_object_constructor() || field->is_flat())) {

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2325#discussion_r3097819991
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2325#discussion_r3097822662

Reply via email to