[Reprint] java compiler, interpreter and time compiler concept

java compiler, interpreter and time compiler concept

Disclaimer: This article is a blogger original article, follow the  CC 4.0 BY-SA  copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/wabiaozia/article/details/89414045

Pineapple Note:

I prefer to think of Zhou Zhiming compiler "classification", the compilation process there are three categories are more representative of the compiler:

  • Front-end compiler: Sun's javac, Eclipse incremental compiler EJC. * .Java to compile the * .class
  • JIT compiler: Hotsport VM of c1, c2 compiler to compile the bytecode into machine code.
  • AOT compiler: GCJ (GNU Compiler for Java), excelsior JET. * .Java files compiled to native machine code.

Compiler of this chapter refers only to compile the first category: the compiler front end. After defining the scope of the compilation, optimization will facilitate the discussion, as this first class compiler optimizations for almost no code to run as efficient as javac. Virtual machine design team to optimize the performance of concentrated focus to the back-end compilation. But like many freshmen java syntax features are relying on syntactic sugar compiler implementation. It can be said front-end compiler and program code closer in the optimization process, time compilation is more important for the program to run during the optimization run-in.

HotSpot virtual machine built into the two-time compiler: Client Complier and Server Complier, referred to as C1, C2 compiler, respectively, with the client and the server. Current mainstream HotSpot virtual machine, the default is to use an interpreter and a compiler which directly mate the way to work. Program which compiler, depending on the mode of operation of the virtual machine. HotSpot virtual machine and the host's own hardware performance version of the machine automatically selects the mode of operation based on, users can also use the "-client" or "-server" parameter to enforce the virtual machine running mode or Client Server mode.

Obtain higher speeds compiled by Client Complier, with Server Complier to get better compiler quality. Why provide more time compiler and why the garbage collector provides more similar, they are designed to adapt to different application scenarios.

2 time compiler
in the virtual machine commercial portion (e.g. HotSpot), Java program is initially interpreted by the interpreter (Interpreter), when the virtual machine to run a discovery method particularly frequent code blocks, these will code is identified as "hot spots Code." In order to improve the efficiency of the hot code at runtime, the virtual machine will put that code compiled into machine code associated with the native platform, and various levels of optimization, this task is called a compiler-time compiler (Just In Time compiler, hereinafter collectively referred JIT compiler).

 

3 JIT compiler, the compiler and the dynamic adaptive dynamic compilation - RednaxelaFX article - known almost https://zhuanlan.zhihu.com/p/19977592

  • Dynamic compilation (dynamic compilation) means "to be compiled at run time"; as opposed to the pre-compiled (ahead-of-time compilation, referred AOT), also known as static compiler (static compilation).
  • JIT compiler (just-in-time compilation) is a narrow piece of code to be compiled when about to be executed for the first time, so called "in-time compilation." JIT compiler is a special case of dynamic compilation.
  • The term was later generalized JIT compilation, and dynamic compilation is often equivalent; but pay attention to the difference between broad and narrow sense of the meaning of the JIT compiler.
  • Adaptive dynamic compilation (adaptive dynamic compilation) is also a dynamic compiler, but the timing is usually performed later than compiled JIT, then let the program do the dynamic compiler "in some form" first up and running, gather some information. This compilation can be more optimized, it can be naturally integrated into the PGO optimizations. This "some form" can be called "baseline execution", may simply be borne by the interpreter or JIT compiler.
  • JIT compilation and adaptive compilation are "dynamic compilation" (dynamic compilation), or category called "run-time compilation," the. Features are compiled when the program is running, rather than before the program starts running to complete the compilation; the latter also known as "static compilation" (static compilation) or AOT compiler (ahead-of-time compilation).

HotSpot VM is a typical adaptive dynamic compilation system, using an interpreter or Client Compiler (C1) and to enable the collection of the initial execution of the profile, and the profile information to the Server Compiler (C2) do optimizing compiler.

Zing VM HotSpot VM-based development, the HotSpot VM execution mode is similar, the interpreter is a multilayer + C1 + C2 blend mode execution engine using adaptive dynamic compilation.

Attachment:

CLR, JIT compiler and link PGO see reference 2.

 

Reference link:
"in-depth understanding of java virtual machine"

Link: https: //www.zhihu.com/question/26913901/answer/35303563

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11614829.html