Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As Jon Skeet says, JIT is part of the CLR. Basically this is what is happening under the hood:</p> <ol> <li>Your source code is compiled into a byte code know as the common intermediate language (CIL).</li> <li>Metadata from every class and every methods (and every other thing :O) is included in the PE header of the resulting executable (be it a dll or an exe).</li> <li>If you're producing an executable the PE Header also includes a conventional bootstrapper which is in charge of loading the CLR (Common language runtime) when you execute you executable.</li> </ol> <p>Now, when you execute:</p> <ol> <li>The bootstraper initializes the CLR (mainly by loading the mscorlib assembly) and instructs it to execute your assembly.</li> <li>The CLR executes your main entry.</li> <li>Now, classes have a vector table which hold the addresses of the method functions, so that when you call MyMethod, this table is searched and then a corresponding call to the address is made. Upon start ALL entries for all tables have the address of the JIT compiler.</li> <li>When a call to one of such method is made, the JIT is invoked instead of the actual method and takes control. The JIT then compiles the CIL code into actual assembly code for the appropiate architecture.</li> <li>Once the code is compiled the JIT goes into the method vector table <strong>and replaces the address with the one of the compiled code, so that every subsequent call no longer invokes the JIT.</strong></li> <li>Finally, the JIT handles the execution to the compiled code.</li> <li>If you call another method which haven't yet being compiled then go back to 4... and so on...</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload