Machine code is a processor-executable form of instructions. It must match a processor instruction set, such as x86 or ARM, and may also depend on the operating system. .NET takes a different route: language compilers produce CIL, which the .NET runtime translates into machine code. section 1.5.1 section 1.5.2
The compilation route determines when platform-specific machine code is produced:
- A native build targets a specific processor and operating system; other targets may require different compilers or builds. section 1.5.1
- .NET compilers put CIL in a DLL. The runtime JIT-compiles only code about to be used, producing machine code for the current processor. section 1.5.1 section 1.5.2
Ahead-of-time compilation
When the deployment processor and operating system are known, AOT can compile code ahead of time and reduce startup waiting; unused-code trimming should be tested because it can remove too much. section 1.5.2
Figure 1.4 .NET languages compile to CIL in a DLL file that can be run on any machine with a .NET runtime.
Use the diagram to follow the path from .NET language compilation to a CIL DLL and runtime conversion into machine code. section 1.5.1
