RFR: 8273359: CI: ciInstanceKlass::get_canonical_holder() doesn't respect instance size
Vladimir Kozlov
kvn at openjdk.java.net
Tue Sep 7 19:29:40 UTC 2021
On Tue, 7 Sep 2021 17:37:40 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> `Compile::flatten_alias_type()` relies on `ciInstanceKlass::get_canonical_holder()` to canonicalise holder class.
> When a declared field is not found for a fixed offset (it can happen for unsafe accesses), the next thing `ciInstanceKlass::get_canonical_holder()` does it ascends class hierarchy looking for a most specific class without instance fields declared. But it completely ignores the instance size, so it can report a class as canonical while its size is smaller than the offset. It makes the address looks out-of-bounds which breaks idempotence property of address type flattening, because out-of-bounds field address types are flattened to `TypeOopPtr::BOTTOM`.
>
> Proposed fix stops the ascend when superclass size shrinks below `offset`.
>
> Testing: hs-tier1 - hs-tier4
Looks good.
-------------
Marked as reviewed by kvn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/5395
More information about the hotspot-compiler-dev
mailing list