Executable exe in Windows call procedure

Source: Internet
Author: User

For example, a test program written in C #,

output two sentences respectively: Hello, GoodBye, describes its invocation procedure for the CLR on Windows.

1. Before executing the main method, the CLR detects all the types of code references in main . This causes the CLR to allocate an internal data structure to manage access to reference types.

When the Main method calls WriteLine for the first time , the JIT function is called, and the JIT function compiles the IL code of the method into the CPU instructions of the machine.

Because IL is compiled on the fly, the CLR component is called the JIT compiler .

2. When the JIT function is called, it knows which method to invoke and what type defines the method.

The JIT then looks for the il of the called method in the metadata of the assembly that defines the type.

Next, the JIT validates the IL code, and the IL code compiles the cost machine CPU instructions. The native CPU instruction is saved in a dynamically allocated memory block.

The JIT then returns to the CLR to create an internal data structure for the type, finding the record that corresponds to the called method,

Modify the original reference to the JIT so that it points to the address of the memory block.

Finally, the JIT function jumps to the code in the memory block, the code formally WriteLine the method, and when the code execution is returned,

Will go back to the code in main and proceed as usual.

Executable exe in Windows call procedure

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.