JVM指令的基于堆栈的体系结构的优点 [英] Advantages of stack-based architecture of the JVM's instruction

查看:92
本文介绍了JVM指令的基于堆栈的体系结构的优点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Java虚拟机的设计没有寄存器来保存中间数据值?相反,每件事都在堆栈上工作。有基于堆栈的架构而不是寄存器有什么特别的优势吗?

Why the Java virtual machine was designed with no registers to hold intermediate data values? Instead every thing works on stack. is there any specific advantage of having a stack-based architecture instead of register?

推荐答案

Java旨在从头开始实现便携。但是,如果依赖于运行它的平台上存在的某些寄存器,如何保持字节码可移植?特别是考虑到它原本打算(也)在机顶盒上运行,它与主流PC有着截然不同的处理器架构。

Java was designed to be portable from the ground up. But how can you keep your bytecode portable if it depends on certain registers being present on the platform you are running it on? Especially taking into account that originally it was intended to run (also) on set-top boxes, which have a very different processor architecture from mainstream PCs.

它只是运行时间JVM实际上知道可用的寄存器和其他硬件特定的东西。然后,JIT编译器可以(并将)根据需要对这些进行优化。

It is only runtime that the JVM actually knows the available registers and other hardware specific stuff. Then the JIT compiler can (and will) optimize for these as applicable.

这篇关于JVM指令的基于堆栈的体系结构的优点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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