RFR: 8311279: TestStressIGVNAndCCP.java failed with different IGVN traces for the same seed
Christian Hagedorn
chagedorn at openjdk.org
Wed Jul 5 09:18:12 UTC 2023
In `TestStressIGVNAndCCP`, we are executing a JVM twice and only want to compile and then run a single method `sum()`. The expectation is that we get the same output with `-XX:+TraceIterativeGVN`. However, our testing found a case where this did not match. When looking at the diff, I've noticed that with one JVM `sum()` had compile id 1, while the other JVM used compile id 2 for `sum()`. This makes a difference for the `debug_idx` which is printed for a dead node as "`compile id * 10000000000 + node index`":
Compile id 1:
80 Phi === _ _ _ [[ ]] [10000000080] ...
Compile id 2:
80 Phi === _ _ _ [[ ]] [20000000080] ...
I was not able to reproduce the original report but my suspicion is that one JVM additionally compiled a native method wrapper or a method handle intrinsic for some reason but the other one did not. This would explain the different compile id because we are should only compiling `sum()` with the given `CompileOnly` JVM flag. A native compilation can be triggered, for example, by passing additionally passing `-esa` with `CompileOnly`. We get compile id 3 for `sum()`:
60 1 n java.lang.invoke.MethodHandle::invokeBasic()I (native)
60 2 n java.lang.invoke.MethodHandle::linkToSpecial(LL)I (native) (static)
69 3 b compiler.debug.TestStressIGVNAndCCP::sum (27 bytes)
To fix this, I suggest to use the `-XX:+CICountNative` flag which uses a separate counter for native compilations. Then, we'll always get compile id 1 for `sum()`:
50 1 n java.lang.invoke.MethodHandle::invokeBasic()I (native)
51 2 n java.lang.invoke.MethodHandle::linkToSpecial(LL)I (native) (static)
59 1 b compiler.debug.TestStressIGVNAndCCP::sum (27 bytes)
This is the same approach as done in [JDK-8269342](https://bugs.openjdk.org/browse/JDK-8269342) to reliably crash with `-XX:CICrashAt=1` in the first non-native compilation.
Thanks,
Christian
-------------
Commit messages:
- 8311279: TestStressIGVNAndCCP.java failed with different IGVN traces for the same seed
Changes: https://git.openjdk.org/jdk/pull/14771/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14771&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8311279
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/14771.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14771/head:pull/14771
PR: https://git.openjdk.org/jdk/pull/14771
More information about the hotspot-compiler-dev
mailing list