Jump to content

Microsoft Intermediate Language

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 203.199.216.217 (talk) at 06:27, 7 September 2006 (Metadata). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Microsoft Intermediate Language (MSIL) is a byte-code that Microsoft .NET technology uses to accomplish platform independence and runtime safety.

General information

During compilation of .NET programming languages, the source code is translated into MSIL code rather than machine-specific object code. MSIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the .NET framework. MSIL code is verified for safety during runtime, providing better security and reliability than natively compiled binaries.

Just-In-Time (JIT) Compilation

This technique involves the byte-code being turned into code immediately executable by the CPU. The conversion is performed gradually during the program's execution. JIT compilation provides environment-specific optimization, runtime type safety, and assembly verification. To accomplish this, the JIT compiler examines the assembly metadata for any illegal accesses and handles violations appropriately.

NGEN (Native Image Generator) Compilation

NGEN allows to produce a native binary image for the current environment. The byte-code is either skipped entirely or converted into native CPU instructions completely before runtime. This eliminates the JIT overhead at the expense of portability; whenever an NGEN-generated image is run in an incompatible environment, .NET framework automatically reverts to using JIT.

Once NGEN is run against an assembly, the resulting native image is placed into the Global Assembly Cache for use by all other .NET assemblies. It is advised that NGEN is run during applications' deployment.