[You must know. NET] The 26th time: Understanding metadata and IL (bottom)

Source: Internet
Author: User

The book is answered:

24th Time: Understanding metadata and IL (upper), 25th back: Understanding Metadata and IL (medium)

Let's move on.

Finally, to say that the metadata and IL role in JIT compilation, although the two-round foreshadowing is extravagant, but it is not too much, because only sufficient knowledge to have enough experience, technology is the same. So, we begin to follow the path of the method call, following the power that metadata and il contribute in that mysterious moment.

5 Meta data and IL at JIT compile time

The CLR ultimately executes only the local machine code, so JIT compilation works by parsing the IL code into machine code execution at run time. For JIT compilation, we will have a dedicated space to fully understand, this article will focus only on the metadata and IL in the execution of the program and participate in the details of the role. First, the IL is executed based on the stack, when executing method calls, method parameters, local variables, and return values are allocated on the stack and execute their invocation process, and since it is concerned with JIT compilation, we naturally focus on the execution of the method, because JIT compilation is triggered by executing a method call.

First, add some new material to the code starting with this article:

// Release : code04, 2009/02/24
// Author : Anytao, http://www.anytao.com
// List  : Base.cs
public class Base
{
   public void M()
   {
     Console.WriteLine("M in Base");
   }

   public virtual void N()
   {
     Console.WriteLine("N in Base");
   }
}

And also:

// Release : code05, 2009/02/24
// Author : Anytao, http://www.anytao.com
// List  : Three.cs
public class Three : Base
{
   private static int ID { get; set; }

   public override void N()
   {
     //Something new in Three
     Console.WriteLine("N in Three");
   }

   public void M()
   {
     Console.WriteLine("M in Three");

     M1();
   }

   public void M1()
   {
     Console.WriteLine("M1 in Three");
   }
}

There are also code execution:

static void Main(string[] args)
{
   Base three = new Three();
   three.M();
   three.N();
}

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.