dotNET跨平台 - 2023-11-16T00:01:33Z
1.前言.NET8正式版于今天发布了,很多人期待已久。我们继续来看下核心部分的技术，在JIT里面个人认为核心的部分不是：MSIL二进制，BasickBlock，IR中间表示，机器码生成，而是分层编译。本篇来看下它的原理。2.概述分层编译在.NET Core2.0中引入，在.NET Core3.0中启用。在.NET8里面已经完全成熟，可以经过分层编译优化(GDV,PGO,OSR,Quick等等)之后...
.NET 8 has been officially released, and the core part of the technology is layered compilation. Layered compilation was introduced in .NET Core 2.0 and enabled in .NET Core 3.0. It allows for optimization after compilation, resulting in performance similar to C++. In previous versions, once a managed function was compiled, its entry point could not be changed. With layered compilation, the entry point is managed by the CodeVersionManager class. When a function meets certain criteria, such as running a certain number of times or exceeding a certain compilation time, it undergoes layered compilation. The layered compilation thread runs concurrently with the JIT thread and replaces the function's entry point. The layered compilation process stops after all functions have been replaced, and new functions will be processed in subsequent rounds.