RFR: JDK-8275865: Print deoptimization statistics in product builds

Vladimir Kozlov kvn at openjdk.java.net
Tue Oct 26 16:28:18 UTC 2021

On Mon, 25 Oct 2021 11:46:06 GMT, Volker Simonis <simonis at openjdk.org> wrote:

> Deoptimization statistics are already gathered in product builds but for some (probably historical) reasons aren't printed to the VM/Compiler log. These statics can be useful when analyzing the reasons for deoptimization and frequent recompilations.
> Because the statistics are already collected anyway, printing them at VM-exit if either `-XX:+LogCompilation` or `-XX:+LogVMOutput` are set won't introduce any runtime overhead.

src/hotspot/share/runtime/java.cpp line 355:

> 353:   }
> 354: 
> 355: #if defined(COMPILER1) || defined(COMPILER2) || defined(INCLUDE_JVMCI)

Deoptimization statistic is collected and printed only for C2 and JVMCI otherwise it is empty:

There are calls to `Deoptimization::print_statistics()` at lines #234 and #244:

In Tiered VM the call at line #234 will be executed when `LogVMOutput || LogCompilation` is true. But not when only `PrintOptoStatistics` is true. Which is bug.

My suggestion is to remove call from line #234 and move call at #244 from under `#ifndef COMPILER1` guard.


PR: https://git.openjdk.java.net/jdk/pull/6103

More information about the hotspot-runtime-dev mailing list