CodeRunning PROCESS IN CLR
1. Select the Compiler
First, CLR selects the compiler, because the CLR can run code developed in different languages.
2. Compile the code into msil
CLR uses the selected compiler to generate msil (Microsoft intermediate language) and metadata to load them to PE (portable executable file ).
Msil: An interpreted language that contains code information, making JIT easy to compile into a machine language. With the operating system andProgramming LanguageIrrelevant.
PE: the executable file format. Windows is DLL or EXE.
3. Use the JIT compiler to compile msil into a machine language.
One method is to compile only the code snippet currently executed, and the other is to compile the entire code at one time. JIT checks the code security.
4. Run the code
When the code is called for the first time, it will be compiled into the machine code. When the code is called again, it will not be re-compiled.