Pages

Wednesday 23 April 2014

What is the role of JIT in JVM?



This session will explain you brief description about JIT  and how it is different from Interpreter:

JIT (Just In Time):

  In the Java programming language and environment, a just-in-time (JIT) compiler is a program that turns Java byte code into instructions that can be sent directly to the processor. After you've written a Java program, the source language statements are compiled by the Java compiler into bytecode rather than into code that contains instructions that match a particular hardware platform's processor (for example, an Intel Pentium microprocessor). The bytecode is platform-independent code that can be sent to any platform and run on that platform.

 The Java on any platform will interpret the compiled bytecode into instructions understandable by the particular processor. However, the virtual machine handles one bytecode instruction at a time. Using the Java just-in-time compiler at the particular system platform compiles the bytecode into the particular system code (as though the program had been compiled initially on that platform). Once the code has been (re-)compiled by the JIT compiler, it will usually run more quickly in the computer.


This means that in general JIT compiled languages run faster than interpreted language.


Interpreter:
     With interpretation there is no compile stage at all. The code in interpreted line by line, much the same as a language interpreters converts between two languages. Memory hold the state of the application between lines being executed. The interpreter itself runs as the "executable" and is the "middle man" between the programming language being interpreted and the operating system. 

No comments:

Post a Comment