Skip to content

Latest commit

 

History

History
 
 

compiler

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Table of Contents


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