What is the use of Just - In - Time (JIT)? [Resolved]

Posted by Programmer123 under C# on 12/19/2013 | Points: 10 | Views : 1401 | Status : [Member] | Replies : 3
What is the use of Just - In - Time (JIT)?


Posted by: Allemahesh on: 12/19/2013 [Member] [MVP] Silver | Points: 50


Below is the use of JIT.

1. JIT is a compiler which converts MSIL code to Native Code (ie.. CPU-specific code that runs on the same computer architecture).
2. Because the common language runtime supplies a JIT compiler for each supported CPU architecture, developers can write a set of MSIL that can be JIT-compiled and run on computers with different architectures.
3. However, your managed code will run only on a specific operating system if it calls platform-specific native APIs, or a platform-specific class library.
4. JIT compilation takes into account the fact that some code might never get called during execution.
5. Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls.
6. The loader creates and attaches a stub to each of a type's methods when the type is loaded.
7. On the initial call to the method, the stub passes control to the JIT compiler, which converts the MSIL for that method into native code and modifies the stub to direct execution to the location of the native code.
8. Subsequent calls of the JIT-compiled method proceed directly to the native code that was previously generated, reducing the time it takes to JIT-compile and run the code.

If this help, click on Mark As Answer link.

Happy coding.

Programmer123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/19/2013 [Member] [MVP] Platinum | Points: 50


Please refer:-

Programmer123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 12/20/2013 [Member] [MVP] Silver | Points: 50

Login to post response