[lworld] Integrated: 8330691: [lworld] C2: assert(gvn().type(n)->is_zero_type()) failed: Should have been scalarized
Christian Hagedorn
chagedorn at openjdk.org
Sun May 12 11:00:18 UTC 2024
On Wed, 8 May 2024 08:57:04 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
This pull request has now been integrated.
Changeset: 1d322d52
Author: Christian Hagedorn <chagedorn at openjdk.org>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL: https://git.openjdk.org/valhalla/commit/1d322d52c4e396898dec4b837e86a7c475bbfd15
Stats: 47 lines in 5 files changed: 47 ins; 0 del; 0 mod
8330691: [lworld] C2: assert(gvn().type(n)->is_zero_type()) failed: Should have been scalarized
Reviewed-by: thartmann
-------------
PR: https://git.openjdk.org/valhalla/pull/1099
More information about the valhalla-dev
mailing list