JIT 编译器文档翻译 _ jit-compiler-design.txt



JIT Compiler Design       即时(just in time)编译器设计
                              



  Copyright (C) 2006 Pekka Enberg


  This file is released under the GPLv2.




Introduction 简介
============


The compiler is divided into the following passes: control-flow graph 这个编译器可分为以下步骤:控制流图构造,
construction, bytecode parsing, instruction selection, and code 字节码解析,指令选择 和代码发布。
emission.  The compiler analyzes the given bytecode sequence to find 编译器解析字节码序列,寻找基本的块来构造控制流图
basic blocks for constructing the control-flow graph.  This pass is 
done first to simplify parsing of bytecode branches.  Bytecode 这一步会先执行,以便简化字节码分支的解析
sequence is then parsed and converted to an expression tree. The tree 然后字节码序列被解析和转化为表达式树
is given to the instruction selector to lower the IR to three-address 这个树传给指令选择器以降低三地址代码的(IR?)
code.  Code emission phase converts that sequence to machine code  代码发布阶段把序列转化为可执行的机器代码
which can be executed.


Programs are compiled one method at a time.  Invocation of a method is 程序(java程序)被一次编译为一个方法。
replaced with an invocation of a special per-method JIT trampoline     方法的调用被替换为一个特殊的per-method JIT弹簧床
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  JIT编译器一次操作一个被称为编译单元的方法。
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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值