Search code examples
spring-bootgraalvm

OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled


I'm using Spring Boot and I've just upgraded from OpenJDK 8 to GraalVM GraalVM CE 20.1.0 (OpenJDK 20.0.7) so that I can use the Polyglot features.

I get this worrying message:

OpenJDK 64-Bit Server VM warning: forcing TieredStopAtLevel to full optimization because JVMCI is enabled

Can someone please explain to me what it means or point me to a resource where I can read more about it? Is it of concern?


Solution

  • It's a warning, so it's not critical. At most you'll have the top tier optimizing compiler enabled which might manifest in a bit longer startup/warmup times.

    When you run your application something (maybe it's the docker image configuration, maybe you pass it manually) passes it the TieredStopAtLevel option. Most probably something like -XX:TieredStopAtLevel=1.

    This option will tell the JVM not to use more advanced tiers of JIT compilation: level 0 - interpreter level 1 - C1 with full optimization (no profiling) level 2 - C1 with invocation and backedge counters level 3 - C1 with full profiling (level 2 + MDO) level 4 - C2

    where C1 and C2 are JIT compilers included in OpenJDK.

    Now on GraalVM, the top tier JIT (level 4) is replaced with the GraalVM compiler, which is plugged into JVM using JVMCI - the JVM compiler interface, specifically created for plugging it other JIT compilers.

    When you run GraalVM's java it by default enables JVMCI to be able to use the GraalVM JIT compiler.

    This doesn't make a lot of sense if you stop at tier 1, because you won't reach JVMCI which is also enabled. But I think it's a bug, which if you can reproduce, can you please submit to https://github.com/oracle/graal.

    I tried with JDK8 based GraalVM 20.1.0 CE (because you mention OpenJDK 8):

    ❯ java -XX:TieredStopAtLevel=1 -version
    openjdk version "1.8.0_252"
    OpenJDK Runtime Environment (build 1.8.0_252-b09)
    OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 25.252-b09-jvmci-20.1-b02, mixed mode)
    

    And it doesn't print the warning, maybe it's the OS or some other factor in play.