[jdk17] RFR: 8268362: [REDO] C2 crash when compile negative Arrays.copyOf length after loop [v3]

Hui Shi hshi at openjdk.java.net
Fri Jun 18 07:50:25 UTC 2021


> This redos PR https://github.com/openjdk/jdk/pull/4238
> 
> Some closed tests fail due to original PR, the main reasons are:
> 
> 8268325/8268345
> CastIINode created in AllocateArrayNode::make_ideal_length apply on a negative array length. GVN transform converts these CastIINode to top. This breaks assumptions, eg., array index node type is TypeInt.
> 8268345
> Some CastIINode is created in LoadRange::Ideal, which doesn't apply GVN transform. CastIINode can not be found in GVN hashtable and cause assertion failure.
> Based on previous PR #4238, this PR unifies CastIINode processing post AllocateArrayNode::make_ideal_length. Setup type and add into igvn worklist. Avoid apply GVN transform to break different assumptions in parser.
> 
> Based on closed test failrue message, two new tests are added
> 
> TestNegArrayLengthAsIndex1 : fail in debug build even without previous PR #4238, it loads a negative array length and apply GVN transform (In GraphKit::load_array_length) which covert length to top node. It also assert in Parse::array_addressing.
> 
> TestNegArrayLengthAsIndex2 : similar with failrue in https://bugs.openjdk.java.net/browse/JDK-8268301

Hui Shi has updated the pull request incrementally with one additional commit since the last revision:

  Add GraphKit::array_ideal_length wrapper for all CastIINode generation after array allocation. Update comments.

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

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/49/files
  - new: https://git.openjdk.java.net/jdk17/pull/49/files/a2989cd8..853bb36a

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17&pr=49&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17&pr=49&range=01-02

  Stats: 33 lines in 6 files changed: 12 ins; 6 del; 15 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/49.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/49/head:pull/49

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


More information about the hotspot-compiler-dev mailing list