What is JIT, JDK17 removed JIT?

foreword

  • In the articles about JDK17 released by major official accounts, it is mentioned that the experimental AOT and JIT have been removed in the changes of JDK17 . Let’s not talk about AOT, it feels irrelevant. However, it does not explain what is an experimental JIT . This article makes its own explanation here.
  • Needless to say, what Java started from, it must be JIT. It is precisely because of the existence of JIT that Java has significantly improved its running speed . At present, it is not even weaker than the two giants of C or C++.

Doubt may be confusing a concept. JIT refers to a class of things, not a thing. Just like the JVM we are talking about, and HotSpot is a specific JVM.

Removed and deprecated items in the jdk17 release document

image-1669691248130

Translation (JEP 410):
移除实验性的 AOT 和 JIT 编译器 — 基于 Java 的提前 (AOT) 和即时 (JIT) 实验性编译器并未被广泛采用。作为一个选择性功能,AOT 和 JIT 编译器已在 JDK 16 中移除,本次在 JDK 源代码中移除。

That said, it was indeed removed.

doubt:

  1. Was the JIT removed? Removed, but experimental JIT
  2. So what is the experimental JIT? see below

What is the experimental JIT?

Finally found the answer in the release document of JDK17, see the picture below

image-1669692124459
Translation:
Graal 编译器通过JEP 317在 JDK 10 中作为实验性 JIT 编译器提供。

动机The explanation given in the documentation is that the Graal compiler is included in JDK 10 as an experimental JIT compiler . So before JDK10, there are three types of JIT in JVM (HotStpot virtual machine), namely C1 ('Client Compiler'), C2 ('Server Compiler' (Server Compiler)) and Graal Compiler

in conclusion

The conclusion is that what is removed in JDK17 is not the JIT we thought, but the Graal compiler. What we think of as JIT is actually C2.

Extracurricular Supplementary Instructions

What is JIT? How many JITs does HotSpot have?

In the current two mainstream commercial Java virtual machines (HotSpot, OpenJ9), Java programs are initially interpreted and executed through an interpreter (Interpreter) . When the virtual machine finds that a certain method or code block runs particularly frequently , it will put These codes are identified as " Hot Spot Codes" . In order to improve the execution efficiency of hot spot codes , the virtual machine will compile these codes into local machine codes at runtime , and optimize the codes as much as possible by various means. , the back-end compiler that does this at runtime is called a just-in-time compiler.

Two (or three) just-in-time compilers are built into the HotSpot virtual machine, two of which have existed for a long time and are called "Client Compiler" and "Server Compiler" respectively. Compiler), or C1 compiler and C2 compiler for short (C2 is also called Opto compiler in some materials and JDK source code), the third one only appeared in JDK10, and it is also in the experiment, and the long-term goal is to replace C2 The Graal compiler, which is the JIT discussed in this article .

The detailed trigger conditions of JIT can be introduced in detail in another article of mine (personal blog). The introduction of JIT and other detailed information can also be clicked on my homepage to view articles on this platform.

Guess you like

Origin blog.csdn.net/qq_49619863/article/details/128095550