Integrated: 8273359: CI: ciInstanceKlass::get_canonical_holder() doesn't respect instance size
Vladimir Ivanov
vlivanov at openjdk.java.net
Wed Sep 8 16:22:20 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
This pull request has now been integrated.
Changeset: f7e9f56e
Author: Vladimir Ivanov <vlivanov at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/f7e9f56e235dc50daae0a85c9790d5b04c9c60f0
Stats: 68 lines in 5 files changed: 61 ins; 0 del; 7 mod
8273359: CI: ciInstanceKlass::get_canonical_holder() doesn't respect instance size
Reviewed-by: kvn
-------------
PR: https://git.openjdk.java.net/jdk/pull/5395
More information about the hotspot-compiler-dev
mailing list