IBM User Guide for Java V7 on Windows > IBM SDK for Java > The JIT compiler
How the JIT compiler optimizes code
When a method is chosen for compilation, the JVM feeds its bytecodes to the Just-In-Time compiler (JIT). The JIT needs to understand the semantics and syntax of the bytecodes before it can compile the method correctly.
To help the JIT compiler analyze the method, its bytecodes are first reformulated in an internal representation called trees, which resembles machine code more closely than bytecodes. Analysis and optimizations are then performed on the trees of the method. At the end, the trees are translated into native code. The remainder of this section provides a brief overview of the phases of JIT compilation. For more information, see JIT and AOT problem determination.
The JIT compiler can use more than one compilation thread to perform JIT compilation tasks. Using multiple threads can potentially help Java™ applications to start faster. In practice, multiple JIT compilation threads show performance improvements only where there are unused processing cores in the system.
The default number of compilation threads is identified by the JVM, and is dependent on the system configuration. If the resulting number of threads is not optimum, you can override the JVM decision by using the -XcompilationThreads option. For information on using this option, see JIT and AOT command-line options.
Note: If your system does not have unused processing cores, increasing the number of compilation threads is unlikely to produce a performance improvement.
The compilation consists of the following phases:
- Inlining
- Local optimizations
- Control flow optimizations
- Global optimizations
- Native code generation
All phases except native code generation are cross-platform code.
- Phase 1 - inlining
Inlining is the process by which the trees of smaller methods are merged, or "inlined", into the trees of their callers. This speeds up frequently executed method calls.- Phase 2 - local optimizations
Local optimizations analyze and improve a small section of the code at a time. Many local optimizations implement tried and tested techniques used in classic static compilers.- Phase 3 - control flow optimizations
Control flow optimizations analyze the flow of control inside a method (or specific sections of it) and rearrange code paths to improve their efficiency.- Phase 4 - global optimizations
Global optimizations work on the entire method at once. They are more "expensive", requiring larger amounts of compilation time, but can provide a great increase in performance.- Phase 5 - native code generation
Native code generation processes vary, depending on the platform architecture. Generally, during this phase of the compilation, the trees of a method are translated into machine code instructions; some small optimizations are performed according to architecture characteristics.
Parent: The JIT compiler
Error 404 - Not Found Error 404 - Not Found
The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.