是CLR,编译器还是执行引擎 [英] Is CLR, a COMPLIER or an EXECUTION ENGINE

查看:112
本文介绍了是CLR,编译器还是执行引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是CLR,编译器还是执行引擎?

虽然,这是一个理论问题,但还需要一些启发.

请帮忙.

解决方案

CLR是一个执行引擎:各种编译器都以CLR为目标,它不知道运行时使用哪种语言代码编写.

OriginalGriff的回答非常好.我只想添加一个基本知识,即需要了解的知识:您需要了解编译分为两个主要阶段:编译为字节代码(CIL代码;这是.NET编译器的工作)和即时编译(JIT) ),这是在加载字节码并与运行时隔行扫描之后完成的.

实际上,JIT编译器是按方法编译为本地(CPU)代码的.结果,即使程序集中存在一些无效代码,也绝不会对其进行JIT编译.如果调用取决于运行时条件,甚至非死代码也可能会编译,也可能不会编译.

从以下内容开始,这是一本好书: http://en.wikipedia.org/wiki/Common_Language_Runtime [ ^ ]


Is CLR, a COMPILER or an EXECUTION ENGINE?

Although, this is a theoretical question, it needs some light on it.

Please help.

解决方案

The CLR is an execution engine: The various compilers target the CLR, it has no idea what language code was written in when it runs.


The answer by OriginalGriff is very good. I only want to add an idea what is essential to know: you need to understand that compilation is divided between two major phases: compilation into byte code (CIL code; this is what a .NET compilers do) and Just In Time compilation (JIT) which is done after loading of the byte code and interlaced with run-time.

In fact, JIT compiler compiles into native (CPU) code on per-method basis; as a result, even if some dead code is present in the assembly, it will be never JIT-compiled; and even non-dead code may or may not be compiled if the call depends on run-time conditions.

This is a good reading for to start with: http://en.wikipedia.org/wiki/Common_Language_Runtime[^]


这篇关于是CLR,编译器还是执行引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆