RFR: 8352131: [REDO] C2: Print compilation bailouts with PrintCompilation compile command

Christian Hagedorn chagedorn at openjdk.org
Wed Mar 19 15:13:18 UTC 2025


We currently only print a compilation bailout with `-XX:+PrintCompilation`:

7782 90 b 4 Test::main (19 bytes)
7792 90 b 4 Test::main (19 bytes) COMPILE SKIPPED: StressBailout

But not when using `-XX:CompileCommand=printcompilation,*::*`. This patch enables this.

The original fix with https://github.com/openjdk/jdk/pull/24031 missed the following: We release the memory for the directives here:
https://github.com/openjdk/jdk/blob/fed34e46b89bc9b0462d9b5f5e5ab5516fe18c6e/src/hotspot/share/compiler/compileBroker.cpp#L2343

and then wrongly accessed the memory again to fetch `PrintCompilationOption` on this line:
https://github.com/openjdk/jdk/blob/fed34e46b89bc9b0462d9b5f5e5ab5516fe18c6e/src/hotspot/share/compiler/compileBroker.cpp#L2377

This worked most of the time because the memory was not overridden, yet, but of course is a wrong use after free case. We only noticed this in some intermittent test failures where we suddenly dumped `COMPILE SKIPPED` where it was unexpected for tests.

I now moved the memory release down after we access it for `PrintCompilationOption`.

Thanks,
Christian

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

Commit messages:
 - 8352131: [REDO] C2: Print compilation bailouts with PrintCompilation compile command

Changes: https://git.openjdk.org/jdk/pull/24117/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24117&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8352131
  Stats: 4 lines in 1 file changed: 2 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/24117.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24117/head:pull/24117

PR: https://git.openjdk.org/jdk/pull/24117


More information about the hotspot-compiler-dev mailing list