RFR: 8328480: C2: SubTypeCheckNode in checkcast should use the klass constant of a unique concrete sub class [v2]
Roland Westrelin
roland at openjdk.org
Thu Mar 28 16:46:32 UTC 2024
On Thu, 28 Mar 2024 16:24:48 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>>> Do you really need to special case that one? Wouldn't the CastPP constant fold if improved_klass_ptr_type is a singleton?
>>
>> For `Y <: abstract X`, when `superklass` is a precise constant `X` and `improved_klass_ptr_type` is a precise constant `Y`, then `CastPP(nullptr, superklass, improved_klass_ptr_type)` will be replaced by `top` and assigned to `improved_superklass` which is probably not what we want. That's why I special cased the singleton case. This could happen, for example, with:
>>
>> obj = (X)o; // superklass = ConP #precise X, improved_klass_ptr_type = precise Y
>>
>>
>>> Also there is the question of whether a CastPP or a CheckCastPP should be used here and if it matters. They don't differ that much anymore so I suppose CastPP is ok.
>>
>> Okay, sound good.
>
> Ok. Makes sense. Thanks for the explanation.
Then isn't there a risk that after some transformation the `CastPP` ends up with an input that's a constant superklass which would cause the `CastPP` to transform to top?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18515#discussion_r1543293569
More information about the hotspot-compiler-dev
mailing list