diff options
author | Pekka Enberg <penberg@kernel.org> | 2012-02-17 10:53:49 +0200 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-02-17 10:53:49 +0200 |
commit | f1599e465c57f71ed48edd2733106fcea690140f (patch) | |
tree | 88277918f54b725bba98adfb457ee43f44dd70ec | |
parent | b833b44f0327dabeabd51a7ea01011771d58cc92 (diff) | |
download | jato-f1599e465c57f71ed48edd2733106fcea690140f.tar.gz |
Documentation, internals: Merge sections on intermediate representations
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | Documentation/internals.txt | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/Documentation/internals.txt b/Documentation/internals.txt index c00f2fb7..24730ff5 100644 --- a/Documentation/internals.txt +++ b/Documentation/internals.txt @@ -68,26 +68,6 @@ Programs are compiled one method at a time. Invocation of a method is replaced with an invocation of a special per-method JIT trampoline that is responsible for compiling the actual target method upon first invocation. -Intermediate Representations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The compiler has two intermediate representations: expression tree and -three-address code. The expression tree is constructed from bytecode sequence -of a method whereas three-address code is the result of instruction selection. -Three-address code is translated to executable machine code. - -The JIT compiler operates on one method at a time called a compilation unit. A -compilation unit is made up of one or more basic blocks which represent -straight-line code. Each basic block has a list of one or more statements that -can either be standalone or operate on one or two expression trees. - -The instruction selector emits three-address code for a compilation unit from -the expression tree. This intermediate representation is essentially a -sequence of instructions that mimic the native instruction set. One notable -exception is branch targets which are represented as pointers to instructions. -The pointers are converted to real machine code targets with back-patching -during code emission. - Subroutine Inlining ~~~~~~~~~~~~~~~~~~~ @@ -182,11 +162,25 @@ representation (LIR) in the backend. The HIR is an abstract syntax tree (AST) of the compiled bytecode whereas LIR is corresponds almost one-to-one to the target machine instructions. +The JIT compiler operates on one method at a time called a compilation unit. A +compilation unit is made up of one or more basic blocks which represent +straight-line code. In HIR, each basic block has a list of one or more +statements that can either be standalone or operate on one or two expression +trees. + +The instruction selector emits LIR for a compilation unit from HIR expression +tree. This intermediate representation is essentially a sequence of +instructions that mimic the native instruction set. One notable exception is +branch targets which are represented as pointers to instructions. The pointers +are converted to real machine code targets with back-patching during code +emission. + Both HIR and LIR are standard intermediate representations that are documented in detail in, for example, <<Muchnick97>> and <<Burke99>>. Literature also describes a middle-level intermediate representation (MIR) but the compiler does not use that. + High-Level Intermediate Representation (HIR) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -196,8 +190,8 @@ divided into basic blocks that contain a list of statements and each statement can operate on an expression tree. Examples of statements include STMT_STORE that stores an expression to a local variable and STMT_IF that does conditional branch. The simplest form of expression is EXPR_VALUE which represents a -constant value but there are more complex types of expressions including binary -operations (EXPR_BINOP) and method invocation (EXPR_INVOKE). +constant value but there are more complex types of expressions including +EXPR_BINOP for binary operations and EXPR_INVOKE for method invocation. - struct statement |