RFR: 8275201: C2: hide klass() accessor from TypeOopPtr and typeKlassPtr subclasses [v2]

Xin Liu xliu at openjdk.java.net
Mon May 16 22:50:43 UTC 2022


On Wed, 11 May 2022 07:24:06 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> Looks very good!
>> 
>> Sorry for the delay with the review.
>
>> 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.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6717


More information about the hotspot-compiler-dev mailing list