[lworld] RFR: 8330691: [lworld] C2: assert(gvn().type(n)->is_zero_type()) failed: Should have been scalarized [v3]
Christian Hagedorn
chagedorn at openjdk.org
Wed May 8 10:43:30 UTC 2024
> 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
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/1099/files
- new: https://git.openjdk.org/valhalla/pull/1099/files/9fa77a26..381e208e
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=1099&range=02
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1099&range=01-02
Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/valhalla/pull/1099.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1099/head:pull/1099
PR: https://git.openjdk.org/valhalla/pull/1099
More information about the valhalla-dev
mailing list