For C # compilation and execution,

Source: Internet
Author: User

For C # compilation and execution,

Each programming language must be converted to a language that the target operating system can understand before execution. This language is called native code ). The same is true for C #. This transformation is also required, but it is not in place. Under the. NET Framework platform, this process is divided into two phases.

(1) C # the stage in which the code is compiled into the intermediate language code-when the C # code is compiled, the local code is not created immediately, instead, the C # Compiler (which is integrated in Visual Studio) compiles the code into Common Intermediate Language (CER) code, that is, the IL code, and store it in a set of programs. In addition to the IL code, the Assembly also includes metadata and optional resource files: Metadata is used to describe the type in the Code. This description is applicable to three aspects: the description of the type definition, the description of the type member, and the description of the type reference member. Optional resource files refer to other data and file fragments used in the IL code. (PS: In csung, the program set is divided into two types, the executable file with the extension of .exe and the library file with the extension of. dll that can be called by other programs .)

 

(2) Converting intermediate language code (IL Code) to the stage of local code ----- to enable the code to run on the target operating system, we also need to further convert the pencil code to the local code of a specific CPU. This process is completed by the real-Time Compiler (Just-In-Time, JIT.

The last step is to execute the local code. After JIT compilation generates the local code, the compiled local code will be stored in a buffer cache. When the same assembly is called next time, the local code can be obtained directly from the buffer to avoid secondary verification and compilation. In this way, the system will only cause some performance loss (JIT compilation process) during the first call, so the C # program will obviously feel slower during the first call. The following figure shows the Code Execution Process on the Internet.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.