[jdk17] RFR: 8268371: C2: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed

Vladimir Ivanov vlivanov at openjdk.java.net
Tue Jun 15 14:51:12 UTC 2021


The way `CheckCastPP` nodes are handled now doesn't let redundant casts to be completely removed: even when the corresponding runtime check disappears, the cast node stays in the graph and it broadens/worsens the type of casted value.   

Proposed fix leaves `CheckCastPP` handling intact, but skips the insertion of redundant cast nodes as part of receiver subtype check. ​

Also, interface casts on receiver temporarily don't get a `CheckCastPP` irrespective of whether the subtype check is redundant or not. 

Thought the assertion failures showed up after JDK-8267807, the bug was there long before. 

Testing: 
- [x] hs-tier1 - hs-tier4

-------------

Commit messages:
 - Fix

Changes: https://git.openjdk.java.net/jdk17/pull/55/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=55&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8268371
  Stats: 205 lines in 2 files changed: 187 ins; 1 del; 17 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/55.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/55/head:pull/55

PR: https://git.openjdk.java.net/jdk17/pull/55


More information about the hotspot-compiler-dev mailing list