RFR: 8275201: C2: hide klass() accessor from TypeOopPtr and typeKlassPtr subclasses [v3]
Roland Westrelin
roland at openjdk.java.net
Thu May 19 07:39:59 UTC 2022
On Wed, 18 May 2022 17:10:36 GMT, Xin Liu <xliu at openjdk.org> wrote:
> I don't mean that you should remove it. The hotspot code style uses "avoid" instead of "forbid". I am curious what we gain when we use this feature. in some scenarios, we are operating subclass pointers. eg. in flatten_alias_type() const TypeInstPtr *to = tj->isa_instptr();
>
> we can save static_cast<> for them. It has better for expressiveness, doesn't it?
The usual pattern in c2 code is to use of the isa_xxx()/is_xxx() methods to downcast. The covariant return types made it possible to remove some of those calls resulting in less clutter. Anyway, it was mostly convenience and it's a part of the change that can easily be adjusted.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6717
More information about the hotspot-compiler-dev
mailing list