INTRODUCTION
The high level programming languages has to be compiled as the system on which the language works is given the details that who that code has to be execute. The programming language always uses its corresponding runtime to execute a specific application. For example: If we want to run a program made in Visual Basic, The system should have Visual Basic runtime compiler installed. The Visual Basic runtime compiler can only compile the application which of developed in Visual Basic. This compiler does not able to run the applications developed in other language like JAVA etc. Same is the case with Java, as it also have compiler which can only work over application written in Java not in other language.
Just in Time Compiler use in .NET:
In the .NET Framework, a common language runtime is use by all the Microsoft .NET languages, by doing this we do not have to install again and again for different .NET languages. It means that Microsoft .NET Common Language Runtime installed on a computer can ran all the languages which are compatible with the .NET framework.
The advantage of using .NET is that there is interoperability between different languages which uses .NET framework. As all the languages using .NET framework uses same common runtime compiler. As we can use an program written in VB of Visual Basic .NET than same is applicable to all the language which uses .NET like C#. When we want to compile the code written in Microsoft .NET language, the complier first generates code written in the MSIL. MSIL stands for Microsoft Intermediate Language. MSIL is a set of instructions that can quickly be translated into native code.
A Microsoft.NET program can be run only after the MSIL code is translated into native machine code. As nothing can be done without native code. The Microsoft.NET runtime consists of three JIT compilers.
JIT
Executing of dynamically translating languages like Perl, Python, Java and C# (semi dynamic languages) make Just-In-Time compiler very popular nowadays.
Just-In-Time compilation(JIT) is also known asdynamic translation. It is a technique use for improving the performance at runtime of a computer program.
It converts code at runtimein spite of executing it natively, for examplebyte codeinto native machine code. A just-in-time compiler is a program that turns Javabyte code into instructions that can be sent directly to theprocessor. After we have written a Java program, the source programs are compiled by the Javacompilerinto bytecoderather than into code that contains instructions that match a particular hardware platform's processor. The byte code is platform-independent code that can be sent to any platform and run on that platform.
Working of JIT Compiler:
JAVA the programming language, is the most used language in programming which is used for applications like games and e-business applications, etc. If we want to compile a Java program it has to be first converted into bytecodes (an intermediate language), and it can be downloaded through the network and executed to any machine which support Java.
The I.T. companies have been researching and developing various techniques for the Java Just-In-Time Compiler, which allows much faster execution by compiling byte codes into native machine code. "Our JIT compiler is used on almost all Java platforms of IBM, ranging from network computers (NC) to mainframes" said by IBM.
Why to use JIT Compiler?
In past when JIT Compiler was not there the developed programs which was written in any of the programming language either of .NET or Java, has to be recompile again and again and sometimes there is situation in which we have to write whole program for each computer platform. The biggest advantage of using JIT compiler is that in one go we can compile our program. The Java on any platform will understand the compiled bytecode into instructions which are understandable by the particular processor. However, the virtual machine handles one bytecode instruction at a time.
Goal of JIT Compiler:
The goal of using JIT techniques is to reach or increase the performance of static compilation, while maintaining the advantages of bytecode interpretation. The process of parsing the original source code and performing basic optimization is handled at compile time, prior to deployment: as we know that compilation from bytecode to machine code is much faster than compiling from source. The deployed bytecode is portable, as the native code. Compilers from bytecode to machine code are easier to write, because the portable bytecode compiler has already done much of the work.
We can control when and how the JIT compiler operates using the java.lang. Compiler class that is provided as part of the standard SDK class library. IBM® fully supports the Compile.compileClass(), Compiler.enable() and Compiler.disable() methods.
For example, if you want to warm-up our application and know that the key methods in our application have been compiled, we can call the Compiler.disable() method after we have warmed up our application and be confident that JIT compilation will not occur during the remainder of the execution of your application.
We can control method compilation in two ways:
Compiler.command("{method specification}(compile)");
where method specification is a list of all the methods that have been loaded at this point and should be compiled. method specification describesa fully qualified method name. An asterisk denotes a wildcard match.
For example, if we want to compile all methods starting with java.lang.String that were already loaded, we would specify:
Compiler.command("{java.lang.String*}(compile)");
Note: This command compiles not only methods in the java.lang.String class, but also in the java.lang.StringBuffer class, which might not be what we want. If we want to compile only methods in the java.lang.String class, we specify:
Compiler.command("{java.lang.String.*}(compile)");
Compiler.command("waitOnCompilationQueue");
We might want to ensure that the compilation queue was empty before disabling the compiler. A typical technique for compiling a set of methods and classes could be:
ADVANTAGES
Optimization techniques
REFERENCES:
BIBLIOGRAPHY: