Home >Java >javaTutorial >How Can I Inspect the JIT-Compiled Assembly Code in the JVM?
Inspecting JIT-Compiled Code in JVM
The Java Virtual Machine (JVM) utilizes Just-In-Time (JIT) compilation to improve code execution efficiency. While the JIT operates seamlessly in the background, there may be instances when developers seek to examine the native code generated by the JIT. This article provides instructions on how to view the assembly code produced by the JIT.
General Usage
Run the JVM with the following options:
-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
Filter on a Specific Method
To isolate the assembly code for a specific method, use the following syntax:
-XX:+UnlockDiagnosticVMOptions -XX:CompileCommand=print,*MyClass.myMethod
Note that the method name might require quotes depending on the operating system. Inlined methods may not display all optimizations.
Installing Required Libraries on Windows
To access these options on Windows, it is necessary to install specific libraries. Prebuilt binaries can be obtained from the fcml project:
Alternatively, the libraries can be built manually using Cygwin. Instructions for both methods are detailed in the guide from fmlc.
Additional Notes
The above is the detailed content of How Can I Inspect the JIT-Compiled Assembly Code in the JVM?. For more information, please follow other related articles on the PHP Chinese website!