When a method is chosen to be compiled, it is handed to the IL(Intermediate Language) generator first. The IL generator translates Java bytecodes to IL trees.
Next, IL trees are processed by many independent optimization passes in the Optimizer. The optimizations first analyze the IL trees to find opportunities to optimize. Secondly, they transform the IL trees for better performance. Each method is compiled at different optimization levels based on its hotness such as cold, warm, etc.
Code generators translate IL trees to assembly instructions for the target architecture. They first generate machine instructions wherein the result of each (value-producing) IL node is placed in a virtual register. Register Assignment (RA) replaces virtual registers with real registers. In the end code generators perform binary encoding to write the appropriate bits to the code cache buffer.
Java Bytecode
|
+----------------------+--------------------+
| Compilation Thread | |
| +----------v---------+ |
| | IL | |
+-------------+ | | +----------------+ | |
| Compilation | | | | IL Generator | | |
| Control +----> | +----------------+ | |
+------^------+ | +----------+---------+ |
| | | |
| | +----------------v----------------+ |
+------v-----+ | | Optimizer | |
| | | | +----------+ +----------------+ | |
| Profiler <-----> | | Analyses | | Optimizations | | |
| | | | +----------+ +----------------+ | |
+------------+ | +----------------+----------------+ |
| | |
| +-------------------v------------------+ |
| | Code Generators | |
| | +-----+ +---+ +---------+ +--------+ | |
| | | X86 | | Z | | PowerPC | | ARM | | |
| | +-----+ +---+ +---------+ +--------+ | |
| +-------------------+------------------+ |
| | |
+----------------------+--------------------+
|
+-----------------------------+ +-----+-----+
| Runtime | | |
| +----------+ +------------+ |+-----v----+ +---v--+
| | JIT Hooks| | RT Helpers | || Metadata | | Code |
| +----------+ +------------+ |+----------+ +------+
+-----------------------------+
-
1. Fundamental Data Structures JIT Operates on
- OpenJ9 Object Model
- C vs Java Stack
- Heap and Thread Local Storage
-
2. IL
- Overview of IL Generator (OMR)
- Introduction on Nodes, Trees, Treetops, Blocks, CFGs, and Structures (OMR)
- Symbols, Symbol References, and Aliasing in the OMR compiler (OMR)
- Reference of IL OpCodes
- Node Transmutation (OMR)
- Things to Consider When Adding a New IL Opcode (OMR)
- IL FAQs (OpenJ9)
- Tril (OMR)
-
3. Optimizer
- Overview of Optimizer
- Analyses
- Local Optimizations
- Global Optimizations
- Control Flow Optimizations
- Inlining
- Loop Optimizations
- Value Propagation
- Hot Code Replacement (HCR)
- On Stack Replacement (OSR)
- Method Handles (OpenJ9)
-
4. Code Generator
- Overview of Code Generator
- Tree Evaluator
- Register Assignment
- X86
- PowerPC
- s390
- ARM
-
6. Profiling
-
7. Runtime
- Overview of Runtime
- Code Metadata and Code Metadata Manager (OMR)
- Code Cache Reclamation (OpenJ9)
- Metadata Reclamation (OpenJ9)
- JIT Hooks (OpenJ9)
- Recompilation (OpenJ9)
- Exception Handling (OpenJ9)
- Runtime Assumption (OpenJ9)
- ELF Generator (OMR)
- Dynamic Loop Transfer (DLT) (OpenJ9)
- Stack Walker
- J9JITExceptionTable (OpenJ9)
-
12. Debug
- Problem Determination Guide (OMR)
- Introduction on Reading JIT Compilation Logs (OMR)
- Part 1: Diagnosing Compilation Problems Using the JIT Verbose Log (YouTube)
- Part 2: Diagnosing Compilation Problems Using the JIT Verbose Log (YouTube)
- Command-line Options
- Lightning Talks - Verbose JIT Logs (YouTube)
- Lightning Talks - JIT Compiler Logs (YouTube)
- Debug Counters (OMR)
- JitDump
-
14. Miscellaneous