RFR: 8266550: C2: mirror TypeOopPtr/TypeInstPtr/TypeAryPtr with TypeKlassPtr/TypeInstKlassPtr/TypeAryKlassPtr [v2]
Vladimir Ivanov
vlivanov at openjdk.java.net
Mon Jun 7 14:09:25 UTC 2021
On Mon, 7 Jun 2021 12:38:28 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> This is some refactoring in another attempt to fix JDK-6312651
>> (Compiler should only use verified interface types for
>> optimization). Rather than propose the patch from:
>>
>> https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-May/033803.html
>>
>> as a single big patch. I've been working on splitting it. The plan is
>> to have this and another refactoring patch that include no change to
>> the way interfaces are handled as preparation. Then only, in a third
>> patch, interface support along the lines of the patch I proposed 2
>> years ago would be introduces.
>>
>> This patch changes the class hierarchy of types that C2 uses and
>> introduces TypeInstKlassPtr/TypeAryKlassPtr that mirror
>> TypeInstPtr/TypeAryPtr. The motivation for this is that a single:
>>
>> ciKlass* _klass;
>>
>> is no longer sufficient to describe a type (a set of interfaces must
>> also be carried around). That's not possible with TypeKlassPtr.
>>
>> The meet methods for TypeInstPtr/TypeInstKlassPtr and
>> TypeAryPtr/TypeAryKlassPtr are largely similar. I moved the most
>> complicated logic in helper methods:
>>
>> meet_instptr() and meet_aryptr()
>>
>> (Thanks to Vladimir I for testing the refactoring patches)
>
> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>
> instklassptr/aryklassptr
I started reviewing the patch.
Can you, please, elabroate on design goals of the patch?
I don't fully understand the intended relation between `TypeInstKlassPtr`, `TypeAryKlassPtr`, and `TypeKlassPtr`.
My observations so far:
* `Type::base()` can never be `Type::KlassPtr` anymore: it's either `InstKlassPtr` or `AryKlassPtr`; all `t->base() == Type::KlassPtr` should be replaced by `t->base() == Type::InstKlassPtr || t1->base() == Type::AryKlassPtr`;
* `java.lang.Object` is represented with `InstKlassPtr` (`TypeInstKlassPtr::OBJECT`) and as a consequence type flattening can turn `TypeAryKlassPtr` into `TypeInstKlassPtr`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3880
More information about the hotspot-compiler-dev
mailing list