Chapter 1: CLR execution model and chapter 1 clr execution model
1. Overview
This chapter mainly introduces the work done by CLR from the source code to the executable program.
2. Glossary
① Common Language Runtime (CLR) is a Runtime that can be used by multiple languages, core functions (memory management, assembly loading, security, exception handling, and thread synchronization) can be used in all CLR-oriented languages.
② PE32: 32-bit Microsoft Windows Executable.
PE32 +: 64-bit Microsoft Windows Executable.
③ Metadata is a set of data tables that describe the content defined in the module or referenced by the hosting module.
④ The hosting module is a standard PE32 or PE32 + file, and they all need CLR for execution. It consists of the PE32 (+) header, CLR header, metadata, and IL intermediate code.
⑤ An assembly is a logical grouping of one or more modules/resource files. It is the minimum unit for reuse, security, and version control.
6. manifest is another collection composed of metadata tables, which describes the files that constitute the assembly.
7. Compile the Code Generator (ngen.exe) to compile the IL code at the cost.
Framework class library (FCL), a group of DLL Assembly released by Microsoft.
Generic Common Type System (CTS): A specification defined by Microsoft to describe the Type and behavior.
Common Language Specification (CLS): defines a minimum set of functions. Any compiler-generated type must support this feature set to be compatible with components generated by other "CLS-compliant and CLR-oriented" languages.
3. Execution Process
① Compile the source code into a hosting module.
② Merge the hosting module into an assembly. (Loader al.exe)
③ Load public language runtime.
④ Run the assembly code.
CLR's JIT (just-in-time) compiler converts IL to local cpu commands.
One compilation and multiple operations. During the code optimization.
⑤ Interoperability with unmanaged code.
4. Summary
This section describes each part related to CLR and describes the execution logic of CLR.