官术网_书友最值得收藏!

From compilation to execution – Under the hood

The .NET Core compilation process is like the one used with the .NET Framework. When the project is built, the internal .NET CLI command is invoked by the MSBuild system, which builds the project and generates the assembly (.dll) or executable (.exe) file. This assembly contains the manifest that contains the assembly's metadata, and includes the version number, culture, type-reference information, information about the referenced assemblies, and a list of other files in the assembly and their association. This assembly manifest is stored either in the MSIL code or in a standalone portable executable (PE) file:

Now, when the executable is run, a new process is started and bootstraps the .NET Core runtime, which then initializes the execution environment, sets up the heap and thread pool, and loads the assembly into the process address space. Based on the program, it then executes the main entry point method (Main) and performs a JIT compilation. From here, the code starts executing and the objects start allocating memory on heap, where primitive types store on stack. For each method, the JIT compilation is done and the native machine code gets generated.

When JIT compilation is done, and before generating a native machine code, however, it also performs a few validations. These validations include the following:

  • Verifying, that the MSIL was generated during the build process
  • Verifying, whether any code was modified or new types added during the JIT compilation process
  • Verifying, that the optimized code for the target machine has been generated
主站蜘蛛池模板: 吕梁市| 永宁县| 南汇区| 芷江| 龙岩市| 道真| 府谷县| 女性| 宁城县| 新源县| 昭通市| 富宁县| 东海县| 邮箱| 互助| 桂林市| 泰顺县| 且末县| 桂阳县| 太仆寺旗| 新竹市| 营口市| 山阳县| 琼海市| 积石山| 鄂托克前旗| 佛冈县| 女性| 镇沅| 绥德县| 西贡区| 定南县| 长沙县| 青海省| 萨迦县| 阿巴嘎旗| 双城市| 肇东市| 本溪市| 辽宁省| 永平县|