[lworld] RFR: 8330691: [lworld] C2: assert(gvn().type(n)->is_zero_type()) failed: Should have been scalarized [v3]
Tobias Hartmann
thartmann at openjdk.org
Wed May 8 14:09:01 UTC 2024
On Wed, 8 May 2024 10:43:30 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
>> The unique concrete subclass optimization replaces an abstract class with a unique concrete sub class (if there is one). In the test case, `abstractValueClassSingleSubclass` is a field with the abstract value class type `AbstractValueClassSingleSubclass` which has a unique (loaded) concrete value sub class `UniqueValueSubClass`.
>>
>> In `do_get_xxx()`, we get the declared `ciType` of the field:
>> https://github.com/openjdk/valhalla/blob/3b89acb102ddb7b4f318edab5c1a6169b28757c0/src/hotspot/share/opto/parse3.cpp#L143
>>
>> which is `AbstractValueClassSingleSubclass` (i.e. no unique concrete sub class optimization applied). But for the type, we call `make_from_klass()` which does apply the unique concrete sub class optimization:
>> https://github.com/openjdk/valhalla/blob/3b89acb102ddb7b4f318edab5c1a6169b28757c0/src/hotspot/share/opto/parse3.cpp#L173
>> https://github.com/openjdk/valhalla/blob/3b89acb102ddb7b4f318edab5c1a6169b28757c0/src/hotspot/share/opto/type.cpp#L3842-L3859
>>
>> As a result, we create a load that has type `UniqueValueSubClass` while `field_klass` is still abstract. We do not create an `InlineTypeNode` because `is_inlinetype()` returns false for abstract classes:
>> https://github.com/openjdk/valhalla/blob/3b89acb102ddb7b4f318edab5c1a6169b28757c0/src/hotspot/share/opto/parse3.cpp#L191-L193
>>
>> Later, we assert that we've missed a scalarization opportunity based on the concrete inline type load.
>>
>> The fix is straight forward to improve the fetched declared `ciType` in `do_get_xxx()` by applying the unique concrete sub class optimization to match the improved type. We only need to apply it for abstract inline type classes. In other cases, we do not the improved field type. I've added a method to check this accordingly.
>>
>> Thanks,
>> Christian
>
> Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix comment
Thanks, still good!
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1099#issuecomment-2100671497
More information about the valhalla-dev
mailing list