即时编译器(JIT)
是否真的将程序中的每个通用中间语言(CIL)
指令映射到底层处理器的操作码
?
如果是这样我们可以称 CIL 为汇编语言而 JIT 为汇编程序吗
注意: 维基百科未在其 list of assembly languages 中将 CIL 列为汇编语言
最佳答案
这个问题都是关于定义的,所以让我们正确地定义术语。一、assembly language :
Assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices in which each statement corresponds to a single machine language instruction. An assembly language is specific to a certain computer architecture, in contrast to most high-level programming languages, which generally are portable to multiple systems.
现在,CIL :
Common Intermediate Language is the lowest-level human-readable programming language defined by the Common Language Infrastructure (CLI) specification and is used by the .NET Framework and Mono. Languages which target a CLI-compatible runtime environment compile to CIL, which is assembled into an object code that has a bytecode-style format.
好吧,这部分在技术上是不正确的:例如 C# 编译器直接编译为字节码,它不通过 CIL(人类可读语言),但从理论上讲,我们可以想象这就是正在发生的事情。
根据这两个定义,CIL 是一种汇编语言,因为其中的每条语句都被编译为单个字节码指令。没有可以直接执行该字节码的物理计算机这一事实并不重要。
定义说每种汇编语言都是“特定于特定的计算机体系结构”。在这种情况下,架构是 CLR 虚拟机。
关于 JIT:JIT 编译器不能被视为汇编程序:它不执行从人类可读形式到字节码的 1:1 转换,ilasm
会执行此操作。
JIT 编译器是一种优化的编译器,可将字节码编译为 native 机器码(适用于其运行的任何 ISA/CPU),同时进行优化。
关于c# - CIL是汇编语言,JIT是汇编程序吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11701063/