COMMON INTERMEDIATE LANGUAGE
'Common Intermediate Language' (CIL, pronounced either "sill" or "kill") (formerly called 'Microsoft Intermediate Language' or MSIL) is the lowest-level human-readable programming language in the Common Language Infrastructure and in the .NET Framework. Languages which target the .NET Framework compile to CIL, which is assembled into bytecode. CIL resembles an object-oriented assembly language, and is entirely stack-based. It is executed by a virtual machine. The primary .NET languages are C#, Visual Basic .NET, C++/CLI, and J#.
CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta releases of the .NET languages. Due to standardization of C# and the Common Language Infrastructure, the bytecode is now officially known as CIL. Because of this legacy, CIL is still frequently referred to as MSIL, especially by long-standing users of the .NET languages.
During compilation of .NET programming languages, the source code is translated into CIL code rather than platform or processor-specific object code. CIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the .NET framework. CIL code is verified for safety during runtime, providing better security and reliability than natively compiled binaries.
Just-in-time compilation 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 produces 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 Native Image Cache for use by all other .NET assemblies. It is advised that NGEN is run during applications' deployment.
Metadata is information about the compiled classes. It serves the same purpose as a type library in COM. Metadata enables applications to support and discover the interfaces, classes, types, methods, and fields in the assembly. The process of reading metadata is called ''reflection''.
★ Source code is converted to Common Intermediate Language and an assembly is created.
★ Upon execution of a .NET assembly, its CIL is passed through the Common Language Runtime's JIT compiler to generate native code. (NGEN compilation eliminates this step at run time.)
★ The native code is executed by the computer's processor.
★ Phalanger (PHP into CIL compiler)
★
★ Kenny Kerr's intro to CIL (called MSIL in the tutorial)
★ Common Language Infrastructure (CLI ) - Partition III - CIL Instruction Set
★ Tutorial including CIL (called MSIL in the tutorial) by Aleksey Nudelman
★ Common Language Infrastructure (Standard ECMA-335)
★ Speed: NGen Revs Up Your Performance With Powerful New Features -- MSDN Magazine, April 2005
CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta releases of the .NET languages. Due to standardization of C# and the Common Language Infrastructure, the bytecode is now officially known as CIL. Because of this legacy, CIL is still frequently referred to as MSIL, especially by long-standing users of the .NET languages.
| Contents |
| General information |
| Just-In-Time (JIT) Compilation |
| NGEN (Native Image Generator) Compilation |
| Metadata |
| Executing CIL |
| See also |
| External links |
General information
During compilation of .NET programming languages, the source code is translated into CIL code rather than platform or processor-specific object code. CIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the .NET framework. CIL code is verified for safety during runtime, providing better security and reliability than natively compiled binaries.
Just-In-Time (JIT) Compilation
Just-in-time compilation 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 produces 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 Native Image Cache for use by all other .NET assemblies. It is advised that NGEN is run during applications' deployment.
Metadata
Metadata is information about the compiled classes. It serves the same purpose as a type library in COM. Metadata enables applications to support and discover the interfaces, classes, types, methods, and fields in the assembly. The process of reading metadata is called ''reflection''.
Executing CIL
★ Source code is converted to Common Intermediate Language and an assembly is created.
★ Upon execution of a .NET assembly, its CIL is passed through the Common Language Runtime's JIT compiler to generate native code. (NGEN compilation eliminates this step at run time.)
★ The native code is executed by the computer's processor.
See also
★ Phalanger (PHP into CIL compiler)
External links
★
★ Kenny Kerr's intro to CIL (called MSIL in the tutorial)
★ Common Language Infrastructure (CLI ) - Partition III - CIL Instruction Set
★ Tutorial including CIL (called MSIL in the tutorial) by Aleksey Nudelman
★ Common Language Infrastructure (Standard ECMA-335)
★ Speed: NGen Revs Up Your Performance With Powerful New Features -- MSDN Magazine, April 2005
This article provided by Wikipedia. To edit the contents of this article, click here for original source.
psst.. try this: add to faves

العربية
中国
Français
Deutsch
Ελληνική
हिन्दी
Italiano
日本語
Português
Русский
Español