0% found this document useful (0 votes)
34 views17 pages

Just in Time (JIT) Compiler in

Uploaded by

aaradhana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views17 pages

Just in Time (JIT) Compiler in

Uploaded by

aaradhana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Just-In-Time(JIT)

Compiler and Base


Class Library
Compile Time and Runtime
Just-In-Time(JIT) Compiler in .NET

• Just-In-Time compiler(JIT) is a part of


Common Language Runtime (CLR) in .NET which is
responsible for managing the execution
of .NET programs regardless of
any .NET programming language.
• A language-specific compiler converts the source
code to the intermediate language.
• This intermediate language is then converted into
the machine code by the Just-In-Time (JIT) compiler.
• This machine code is specific to the computer
environment that the JIT compiler runs on.
Just-In-Time(JIT) Compiler in .NET
• The JIT compiler is an important element of
CLR, which loads MSIL on target machines for
execution.
• The MSIL is stored in .NET assemblies after the
developer has compiled the code written in any
.NET-compliant programming language, such as
Visual Basic and C#.
• The JIT compiler is required to speed up the
code execution and provide support for
multiple platforms.
Working of JIT Compiler
Working of JIT Compiler
• The JIT compiler converts the Microsoft Intermediate
Language(MSIL) or Common Intermediate Language(CIL) into
the machine code.
• This is done before the MSIL or CIL can be executed.
• The MSIL is converted into machine code on a requirement
basis i.e. the JIT compiler compiles the MSIL or CIL as required
rather than the whole of it.
• The compiled MSIL or CIL is stored so that it is available for
subsequent calls if required.
There are 3 types of JIT compilers

• Pre-JIT Compiler: All the source code is compiled into the


machine code at the same time in a single compilation cycle
using the Pre-JIT Compiler.
• This compilation process is performed at application deployment
time. And this compiler is always implemented in the Ngen.exe
(Native Image Generator).
• The Native Image Generator (Ngen.exe) is a tool that improves
the performance of managed applications. Ngen.exe creates
native images, which are files containing compiled processor-
specific machine code, and installs them into the native image
cache on the local computer
Pre-JIT compiler
Econo JIT Compiler
• Econo JIT Compiler:
• Only the source code methods that are required at run-time
are compiled into machine code by the Econo JIT Compiler.
• After these methods are not required anymore, then they are
removed.
Econo JIT Compiler
Normal JIT Compiler
• Normal JIT Compiler:
• The source code methods that are required at run-time are
compiled into machine code the first time they are called by the
Normal JIT Compiler.
• After that, they are stored in the cache and used whenever they
are called again.
Normal JIT Compiler
Advantages of JIT Compiler
• The JIT compiler requires less memory usage as only the
methods that are required at run-time are compiled into
machine code by the JIT Compiler.
• Page faults are reduced by using the JIT compiler as the methods
required together are most probably in the same memory page.
• Code optimization based on statistical analysis can be
performed by the JIT compiler while the code is running.
Disadvantages of JIT compiler:
• The JIT compiler requires more startup time while the
application is executed initially.
• The cache memory is heavily used by the JIT compiler to store
the source code methods that are required at run-time
Base Class Library
• .NET Framework Class Library is the collection of
classes, namespaces, interfaces and value types that
are used for .NET applications.
• It contains thousands of classes that supports the
following functions.
• Base and user-defined data types
• Support for exceptions handling
• input/output and stream operations
• Communications with the underlying system
• Access to data
• Ability to create Windows-based GUI applications
• Ability to create web-client and server applications
• Support for creating web services
Class Library Namespaces
.Net Framework Base Class Library

You might also like