Inside of .NET compiler: builder.com www.ASPCool.com Time: 2002-4-23 14:07:34 Views: 5221
As a code instruction platform, Microsoft .NET is more complicated than other technical platforms previously launched by Microsoft. Since .NET provides support for multiple programming languages and (in theory), it is necessary to add an intermediate code layer in the traditional two code layers. Here, the traditional two layers are the source code layer and the compiled native code layer. The new code layer has brought additional flexibility to the .NET platform, but in turn increases the complexity of the system. In addition, due to the appearance of this new code layer, a series of new application deployment options also presented in front of the programmer. The main purpose of this article is to lead the .NET application developer understands the code compilation process of the .NET, understands the additional compilation option. The .NET is different: MSIL can write, create, create, create, such as VB.NET, C # or Cobol .NET, such as VB.NET, C # or COBOL .NET, etc. in the Microsoft .NET framework. The program code written by each comply with the .NET specification first has to become a public standard language from the source code from the source code from the source code: MSIL (Microsoft Media Language: Microsoft Intermediate Language). MSIL itself is a complete, and object-related language, only it can create an application. In order to roughly understand some of MSIL, you can see "Understanding the Run Principle of CLR through the MSIL language". The .NET application is in the form of MSIL, and only the instant compiler (JIT) is compiled as the native code when the program is executed. Figure A will explain this process. Figure a .NET compilation process: From the source code to this unit, just load the assembly code, JIT compilation is performed, which is a compilation-level compilation (see more than Assembly technology, please refer to "Assembly-cure" A good party of DLL Hell? "One article). During the compilation process, once the JIT compiler will load the corresponding procedures for each method declared by each method of the object. Thus, when the method is called later, its IL will be compiled, and the corresponding root procedure of the method is replaced by the address of the compiled post code of the method. This process is performed when the first time is first called, and the generated native code is buffered to be used next time the Assembly code is next loaded during the session. Obviously, such instruction systems require greater processing capabilities compared to traditional compiled languages, but they don't think so high. Here you must clarify a universal misunderstanding error concept, that is, many people think that .NET application is an interpretation rather than compiler. In addition, there is a common error known: JIT-compiled code is stored on disk and can be executed for the same application. Although this is not ok, it will soon understand, this is not the default compilation program. The IL code of the application is actually re-compiled as native code when the application is running. Two compilers are in fact, the JIT compiler is divided into two (economic compilers and ordinary compilers), and they are not equal. The economic JIT compiler represents the least function required to run a .NET application, which replaces each MSIL instruction directly with a peer-to-peer code, and does not perform any optimization thereby brings less system load. This also means that it is primarily applied to a platform for more tight resources such as memory. On the other hand, the normal JIT compiler is the default runtime configuration, which will instantly optimize the code generated. This is given in invisible. Net exceeds the advantage of traditional pre-compiled languages: The pre-compiled language can only be processed from the platform that will be processed.