Java code and JIT compilation

Java code is compiled into bytecode, which is portable across many platforms. But Java is also a JIT compilation that happens on the fly.

Does this mean that Java compiles twice? First we create bytecode, and second - JVM? Thank.

+3
source share
5 answers

Your code can be compiled from bytecode to native JVM code if it is "hot enough"; and it can be compiled several times, while the old version will be discarded depending on the characteristics of the execution of your program.

JIT - ; Sun JVM JIT (- -), - , JIT , ( -, , JIT- ).

Hotspot ( JIT, Sun), . Sun page.

+7

TMK, , JVM. , JVM , , , , .

: ,

+7

, Java ? - - JVM? .

, , , (), (JVM/JIT), , , JIT .

+2

Java β†’ - ( java-)

ByteCode β†’ ( JVM)

+1

: , .

: . - (IR) .

VM - , .

These are 2 completely different types of compilation. Secondly, this is not entirely compilation, since there is no syntax visibility analyzer ... Well, there is some kind of check, but not the same check as your compiler.

0
source

Source: https://habr.com/ru/post/1757576/


All Articles