RFR: 8320308: C2 compilation crashes in LibraryCallKit::inline_unsafe_access
Tobias Holenstein
tholenstein at openjdk.org
Thu Sep 5 13:57:52 UTC 2024
On Wed, 4 Sep 2024 17:23:54 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> Thanks for the clarifications, Toby. I reconsidered my conclusion about root cause. I agree that redundant `CheckCastPP` causes problems here, but what surprises me is that `null_check_oop` successfully detects that `base == NULL` while `LibraryCallKit::classify_unsafe_addr()` has a hard time doing the same. IMO the discrepancy is the source of the problem here. Can you share more details why it happens?
`classify_unsafe_addr` relies on the type information provided by `_gvn.type(base).` If this type information is speculative or imprecise, the function might misclassify the address. This is the case here since `147 CheckCastPP` isn't equal to `TypePtr::NULL_PTR` in `classify_unsafe_addr`.
`null_check_oop` uses more explicit checks to determine if a value is null and handles them by inserting traps if necessary. It uses `null_check_common` to perform the actual null check. `null_check_common` insert __chk__ = `150 CmpP`.
`chk = _gvn.transform(chk);` then determined it to be null.
https://github.com/openjdk/jdk/blob/34c6e0deac567c0f4ed08aa2824671551d843e95/src/hotspot/share/opto/graphKit.cpp#L1316
<img width="330" alt="150" src="https://github.com/user-attachments/assets/cdc1f095-55e0-4aef-9c73-dc6490f3708f">
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20033#issuecomment-2331745915
More information about the hotspot-compiler-dev
mailing list