[3] Windows Defender virus definitions continue to refer to binaries compiled with it as MSIL.
CIL code is verified for safety during runtime, providing better security and reliability than natively compiled executable files.
[5][6] The execution process looks like this: CIL bytecode has instructions for the following groups of tasks: The Common Intermediate Language is object-oriented and stack-based, which means that instruction parameters and results are kept on a single stack instead of in several registers or other memory locations, as in most programming languages.
When the add-instruction is called the operands are "popped", or retrieved, and the result is "pushed", or stored, on the stack.
In C# class instances are created like this: And those statements are roughly the same as these instructions in CIL: Instance methods are invoked in C# as the one that follows: As invoked in CIL: The Common Language Infrastructure (CLI) records information about compiled classes as metadata.
Just-in-time compilation (JIT) involves turning the byte-code into code immediately executable by the CPU.
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.
In the .NET Framework there is a special tool called the Native Image Generator (NGEN) that performs the AOT.
A different approach for AOT is CoreRT that allows the compilation of .Net Core code to a single executable with no dependency on a runtime.