JIT compilation in Dot Net Framework

The .NET Framework contains one or more JIT compilers that compile your IL code down to machine code, or code that is CPU-specific. This is done when the application is executed for the first time.

            You will notice this process after you build your first ASP.NET page. After you build any ASP.NET page, you compile the page down to IL. When you go to the browser and call the page by typing its URL in the address bar, you notice a slight pause of a few seconds as the computer seems to think about what it is doing. It is actually calling this IL code and converting it with a JIT compiler to machine code. This happens only the first time that someone requests the page. After the first time, you can hit F5 to refresh the page, and the page is immediately executed. The page has already been converted to machine code and is now stored in memory. The CLR knows the JIT compiler has already compiled the page. Therefore, it gets the output of the page from memory. If you later make a change to your ASP.NET page, recompile, and then run the page again, CLR detects that there was a change to the original file. It uses the JIT compiler once again to compile the IL code down to machine code.

            The JIT compiler, as it compiles to machine code, makes sure that the code is type safe. It does this to ensure that objects are separate, thereby making certain that objects won’t unintentionally corrupt one another.


Post a Comment