The relationship between Javac, JIT, and AOT in Java

Javac: javac is a java language programming compiler. The full name is java compiler. But at this time, it still cannot be executed directly, because the machine can only understand assembly, that is, binary, so it is necessary to further compile the .class file into a binary file.

Java execution process

insert image description here

Detailed process

insert image description here
Conclusion: The .class file compiled by javac is still bytecode and cannot be recognized by the machine. The .class bytecode file must be further compiled into machine code by the JVM. The JVM has built-in interpreter interpreter and compiler compiler, from which we can see that Java is a semi-compiled and semi-interpreted high-level language. Therefore, javac cannot be said to be a real compilation.

Compilation: source code (.java) === "machine code (binary)

Advantages and disadvantages of AOT and JIT

AOT: Ahead-of-Time (compiled in advance): Before the program is executed, all are compiled into machine code
JIT: Just in Time (just-in-time compilation): The program is compiled while running,
so javac is before AOT and JIT operations. As far as the Java language is concerned, AOT and JIT are for processing .class files. It's just that one of them is compiled in a different order.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43933728/article/details/131478644