JDK-8299179 : ArrayFill with store on backedge needs to reduce length by 1
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16,17,19,20,21
  • Priority: P3
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2022-12-21
  • Updated: 2023-01-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21Unresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
Please change the generic bug title to something more descriptive once the root cause is known.

The attached Java Fuzzer test results in a wrong execution with C2 compared to a run with the interpreter/C1 after JDK-8247307 on aarch64 and x64:
- aarch64: fails after JDK-8247307 since -XX:+OptimizeFill is set by default
- x64: only fails with -XX:UseAVX=3 (and before JDK-8275047, -XX:+OptimizeFill must be set as it was false by default):

To reproduce:
$ java -Xint Test.java > interpreter.log
$ java -XX:-TieredCompilation -Xcomp -XX:CompileOnly=Test (-XX:UseAVX=3) Test.java > c2_test.log
$ java -XX:-TieredCompilation -Xcomp -XX:CompileOnly=Reduced (-XX:UseAVX=3) Reduced.java > c2_reduced.log

$ diff interpreter.log c2_test.log:
7c7
< vMeth1_check_sum: 585775794890188912
---
> vMeth1_check_sum: 585775794890188648
16c16
< vMeth1_check_sum: 1171551947176573060
---
> vMeth1_check_sum: 1171551947176572796
25c25
< vMeth1_check_sum: 1757328099462957208
---
> vMeth1_check_sum: 1757328099462956944
34c34
< vMeth1_check_sum: 2343104251749341356
---
> vMeth1_check_sum: 2343104251749341092
43c43
< vMeth1_check_sum: 2928880404035725504
---
> vMeth1_check_sum: 2928880404035725240
52c52
< vMeth1_check_sum: 3514656556322109652
---
> vMeth1_check_sum: 3514656556322109388
61c61
< vMeth1_check_sum: 4100432708608493800
---
> vMeth1_check_sum: 4100432708608493536
70c70
< vMeth1_check_sum: 4686208860894877948
---
> vMeth1_check_sum: 4686208860894877684
79c79
< vMeth1_check_sum: 5271985013181262096
---
> vMeth1_check_sum: 5271985013181261832
88c88
< vMeth1_check_sum: 5857761165467646244
---
> vMeth1_check_sum: 5857761165467645980

$ diff interpreter.log c2_reduced.log:
134c134
< iArrFld[63]: 0
---
> iArrFld[63]: 4
204c204
< iArrFld[63]: 0
---
> iArrFld[63]: 4
274c274
< iArrFld[63]: 0
---
> iArrFld[63]: 4
344c344
< iArrFld[63]: 0
---
> iArrFld[63]: 4
414c414
< iArrFld[63]: 0
---
> iArrFld[63]: 4
484c484
< iArrFld[63]: 0
---
> iArrFld[63]: 4
554c554
< iArrFld[63]: 0
---
> iArrFld[63]: 4
624c624
< iArrFld[63]: 0
---
> iArrFld[63]: 4
694c694
< iArrFld[63]: 0
---
> iArrFld[63]: 4

Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11904 Date: 2023-01-09 14:48:00 +0000
10-01-2023

JDK-8247307 has probably just revealed an existing issue as it just enables more patterns to use array fill stub.
21-12-2022

ILW = Wrong execution of C2 compiled array stub, single Java Fuzzer test, use -XX:-OptimizeFill = HLM = P3
21-12-2022