Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Java HotSpot JIT compiler is running?

I would like to know if my no VM argument invocation of HotSpot Java is running with -client, -server, or tiered compilation options. When I supply no VM arguments, which one is chosen by default? Is there a way to output diagnostics about which JIT compiler is running?

like image 367
Julien Chastang Avatar asked Feb 11 '13 18:02

Julien Chastang


People also ask

Does Java have a JIT compiler?

The Just-In-Time (JIT) compiler is a component of the Java™ Runtime Environment that improves the performance of Java applications at run time. Java programs consists of classes, which contain platform-neutral bytecodes that can be interpreted by a JVM on many different computer architectures.

What is HotSpot JIT?

JIT is "Just In Time" compiling, basically compiling on the fly. Hotspot is the concept within the JVM where it only compiles the code that's actually being used. That is, the "hot" pieces of code being used over and over.

Is JIT compiler inside JVM?

In order to improve performance, JIT compilers interact with the Java Virtual Machine (JVM) at run time and compile suitable bytecode sequences into native machine code.

Is Java bytecode JIT compiled?

The JIT compiler helps improve the performance of Java programs by compiling bytecodes into native machine code at run time. The JIT compiler is enabled by default. When a method has been compiled, the JVM calls the compiled code of that method directly instead of interpreting it.


1 Answers

Slightly better method of determining which JIT compiler is in use.

On a Windows machine with 32-bit JDK8:

    $ java -version
    java version "1.8.0"
    Java(TM) SE Runtime Environment (build 1.8.0-b132)
    Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)

    $ java -XshowSettings -version 2>&1 | grep sun.management.compiler
        sun.management.compiler = HotSpot Client Compiler

    $ java -server -XshowSettings -version 2>&1 | grep sun.management.compiler
        sun.management.compiler = HotSpot Tiered Compilers

So the Client Compiler is the default with the Windows 32-bit JDK8 and the '-server' option gets you the 32-bit Tiered Compiler.

On a Windows machine with 64-bit JDK8:

    $ java -version
    java version "1.8.0"
    Java(TM) SE Runtime Environment (build 1.8.0-b132)
    Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

    $ java -XshowSettings -version 2>&1 | grep sun.management.compiler
        sun.management.compiler = HotSpot 64-Bit Tiered Compilers

So the Tiered Compiler is the default with the Windows 64-bit JDK8. Oracle does not provide a 64-bit Client VM.

like image 85
user3594142 Avatar answered Oct 03 '22 17:10

user3594142