Integrated: 8311279: TestStressIGVNAndCCP.java failed with different IGVN traces for the same seed
Christian Hagedorn
chagedorn at openjdk.org
Thu Jul 6 06:35:13 UTC 2023
On Wed, 5 Jul 2023 09:10:48 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: edb2be10
Author: Christian Hagedorn <chagedorn at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/edb2be10fb897834ed78ab4493d3a4f73dc2e140
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
8311279: TestStressIGVNAndCCP.java failed with different IGVN traces for the same seed
Reviewed-by: thartmann
-------------
PR: https://git.openjdk.org/jdk/pull/14771
More information about the hotspot-compiler-dev
mailing list