RFR: 8273359: CI: ciInstanceKlass::get_canonical_holder() doesn't respect instance size
Vladimir Ivanov
vlivanov at openjdk.java.net
Tue Sep 7 17:58:55 UTC 2021
`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
-------------
Commit messages:
- 8273359: assert(flat == flatten_alias_type(flat)) failed: not idempotent
Changes: https://git.openjdk.java.net/jdk/pull/5395/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5395&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8273359
Stats: 68 lines in 5 files changed: 61 ins; 0 del; 7 mod
Patch: https://git.openjdk.java.net/jdk/pull/5395.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5395/head:pull/5395
PR: https://git.openjdk.java.net/jdk/pull/5395
More information about the hotspot-compiler-dev
mailing list