RFR: 8275201: C2: hide klass() accessor from TypeOopPtr and typeKlassPtr subclasses [v2]
Roland Westrelin
roland at openjdk.java.net
Wed May 18 13:32:50 UTC 2022
On Mon, 16 May 2022 22:47:41 GMT, Xin Liu <xliu at openjdk.org> wrote:
>>> Looks very good!
>>
>> Thanks for the review.
>
> hi, @rwestrel ,
> I see this patch uses covariant return in a few places, eg.
>
> - virtual const Type *cast_to_exactness(bool klass_is_exact) const;
> + virtual const TypeInstPtr* cast_to_exactness(bool klass_is_exact) const;
>
>
> and
>
>
> // Speculative type helper methods.
> - virtual const Type* remove_speculative() const;
> + virtual const TypeOopPtr* remove_speculative() const;
>
>
> This contradicts "Avoid covariant return types." from [hotspot-style](https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md). Is there any particular reason to change like that? I see that compile.cpp leverages that to improve expressiveness.
Hi @navyxliu,
> This contradicts "Avoid covariant return types." from [hotspot-style](https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md). Is there any particular reason to change like that? I see that compile.cpp leverages that to improve expressiveness.
I missed that. I will work on a subsequent change to remove the covariant return types.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6717
More information about the hotspot-compiler-dev
mailing list