jdk
jdk copied to clipboard
8342387: C2 SuperWord: refactor and improve compiler/loopopts/superword/TestDependencyOffsets.java
I want to refactor TestDependencyOffsets.java
using the CompileFramework
.
Reasons:
- I soon need to modify the IR rules in this test soon anyway (https://github.com/openjdk/jdk/pull/21521), and so a refactor might be good to do first.
- The generator script used to be a
generator.py
, stored not ongit
butJBS
. Not great. Now we have it in Java code, and maintenance is easier. - Since I first wrote that test, I have now introduced the
IRNode.VECTOR_SIZE
. This allows:- Simplifying the logic for the IR rules (removed the
IRRange
andIRBool
, and thePlatform
). - Strengthening the rules.
- Simplifying the logic for the IR rules (removed the
- I was able to add
random
offsets. This means we have better coverage, and do not rely on just hand-crafted values.
I extensively use String.format
and StringBuilder
... would be nicer to have string-templates but they don't exist yet.
Recommendation for review: the old file was huge. Finding the new code in the diff can be hard. I would start by only reading the new file.
Ah. And about runtime of the test. On my machine I get this (in ms):
Generate: 27
Compile: 5845
Run: 23435
Test generation is negligible. 6sec on compilation, 20+sec on execution. I think that is an ok balance, at least we can say that generation and compilation only take about 1/6 of total time - an acceptable overhead I would say.
Progress
- [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8342387: C2 SuperWord: refactor and improve compiler/loopopts/superword/TestDependencyOffsets.java (Enhancement - P4)
Reviewers
- Tobias Hartmann (@TobiHartmann - Reviewer)
- Christian Hagedorn (@chhagedorn - Reviewer)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21541/head:pull/21541
$ git checkout pull/21541
Update a local copy of the PR:
$ git checkout pull/21541
$ git pull https://git.openjdk.org/jdk.git pull/21541/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21541
View PR using the GUI difftool:
$ git pr show -t 21541
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21541.diff