Microsoft Intermediate Language

MicrosoftIntermediateLanguage, or MSIL, is the lowest level language that all high-level languages compile to on the MicrosoftDotNet platform.

MSIL is similar to the instruction set of a CPU; its simple binary structures mirror those in any modern microprocessor instruction set. Like regular CPU instruction sets, it is able to encode a wide spectrum of operations such as loading, storing, arithmetic and logical operations, and control flow. Unlike regular CPU instruction sets, it is able to express object oriented concepts such as object creation, method invocation, access to properties, and exception handling.

MSIL has some similarities to JavaByteCode, but there is an important distinction to be made. IntermediateLanguages are designed differently depending on whether they are to be interpreted or JustInTime compiled. Unlike JavaByteCode, MSIL is designed to benefit from JustInTime compilation.

MSIL code is executed in a runtime called the CommonLanguageRuntime. The CLR is responsible for performing garbage collection, type verification, and JIT compiling the MSIL code to native code for the current architecture (the same MSIL binary can be jitted and executed on any supported architecture).

Because of the close correlation between MSIL instructions and their machine code equivalents, the compilation from MSIL to machine code occurs quickly.

Type verification is possible because along with the MSIL code, each DotNet binary contains tables of metadata. The metadata includes the definition of each type, the signatures of each type's members, and other data that the runtime locates and extracts from the file at execution time.

The presence of metadata in the file along with the MSIL enables the module to describe itself, which means that there is no need for type libraries, IDL files, or header files.

History

The first version of the CLR specification (which includes MSIL), was standardized as ECMA standard 335. This initial version lacks the ability to express ParametricPolymorphism. While the CLR is intended to be more general than the Java runtime, their similarities are obvious at this stage. The type system has strong preconceptions that are very Java-like.

The second version of the CLR specification, yet to be standardized, adds ParametricPolymorphism support, among other minor improvements. The new features set it on a divergent path from Java, which does not have similar features at the runtime level. At the time of this writing, this version is only available in beta form in VisualStudioWhidbey, the MonoProject, and the SharedSourceCli.

Microsoft are now working to extend MSIL with constructs that better support functional programming. For more information, see http://research.microsoft.com/projects/ilx.


CategoryDotNet


EditText of this page (last edited March 28, 2005) or FindPage with title or text search