字节码被视为JVM的指令集吗? [英] is bytecode treated as instruction set for JVM?

查看:247
本文介绍了字节码被视为JVM的指令集吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 wiki 中读到有关instruction set的内容,并且遇到了以下段落:

I was reading about instruction set in wiki and I came across this paragraph:

一些支持字节码作为其ISA的虚拟机,例如 Smalltalk,Java虚拟机和Microsoft的通用语言 运行时,通过翻译常用的字节码来实现 代码路径转换为本机代码.另外,这些虚拟 机器通过解释执行较少使用的代码路径 (请参阅:即时编译). Transmeta实现了x86 以这种方式在VLIW处理器上设置指令.

Some virtual machines that support bytecode as their ISA such as Smalltalk, the Java virtual machine, and Microsoft's Common Language Runtime, implement this by translatin the bytecode for commonly used code paths into native machine code. In addition, these virtual machines execute less frequently used code paths by interpretation (see: Just-in-time compilation). Transmeta implemented the x86 instruction set atop VLIW processors in this fashion.

这到底是什么意思? 是JVMJVM依次支持处理器的ISAbytecodesISA.

What does this exactly mean? is the bytecodes are ISA for JVM and JVM in-turn support ISA of processors.

推荐答案

是的,正如您所猜测的那样. JVM/JRE使用Java字节码作为其指令集,每个JVM需要在本机/本地硬件(因此是本地指令集)上编译并在其上运行.维基百科的这张图很好地说明了这一点:

Yes, it is as you guessed. The JVM/JRE uses Java bytecode as its instruction set and each JVM needs to be compiled on and be runnable on the native/local hardware (and therefore the local instruction set). This diagram from Wikipedia illustrates this well I think:

尽管JVM本身的Java字节码定义和解释保持不变,但仍需要为其运行的特定硬件编译JRE/JVM.如您所指出的,Java字节码可以看作是Java源代码和本地机器/二进制代码之间的一种抽象层.它的确可以将典型的Java程序员与需要了解任何特定于机器的事情之间的关注点分离开来,因为几乎所有这些事情都是由JVM/JRE处理的.

The JRE/JVM needs to be compiled for the specific hardware it runs on, though the Java bytecode definitions and interpretations by the JVM itself stay the same. As you point out, the Java bytecode can be seen as a kind of abstraction layer between the Java source code and the local machine/binary code. It does allow for a separation of concerns between the typical Java programmer and needing to know anything machine-specific, as almost all of that is handled by the JVM/JRE.

这篇关于字节码被视为JVM的指令集吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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