Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Most compilers, even native code compilers, use some sort of intermediate language.</p> <p>This is mainly done to reduce compiler construction costs. There are many (N) programing languages in the world. There are also many (M) hard ware platforms in the world. If compilers worked without using an intermediate language, the total number of "compilers" that would need to be written to support all languages on all hardware platforms would be N*M.</p> <p>However, by defining an intermediate language and breaking a compiler up into 2 parts, a front end and a back end, with the front end compiling source code into IL and the back end compiling IL into machine code, you can get away with writing only N+M compilers. This ends up being a huge cost savings.</p> <p>The big difference between CLR / JVM compilers and native code compilers is the way the front end and the back end compilers are linked to each other. In a native code compiler the two components are usually combined into the same executable, and both are run when the programmer hits "build" in the IDE.</p> <p>With CLR / JVM compilers, the front end and the back end are run at different times. The front end is run at compile time, producing IL that is actually shipped to customers. The back end is then embodied in a separate component that is invoked at runtime.</p> <p>So, this brings up the alternate question, "What are the benefits of delaying back end compilation until runtime"?</p> <p>The answer is: "It depends".</p> <p>By delaying back end compilation until runtime, it becomes possible to ship one set of binaries that can run on multiple hardware platforms. It also makes it possible for programs to take advantage of improvements in the back end compilation technology without being redeployed. It can also provide a foundation for efficiently implementing many dynamic language features. Finally, it offers the ability to introduce security and reliability constraints between separately compiled, dynamically linked libraries (dlls) that is not possible with upfront machine code compilation.</p> <p>However, there are also draw backs. The analysis necessary to implement extensive compiler optimizations can be expensive. This means that "JIT" back ends will often do less optimizations than upfront backends do. This can hurt performance. Also, the need to invoke the compiler at runtime also increases the time necessary to load programs. Programs generated with "upfront" compilers don't have those problems.</p>
 

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