开发者

Why is the JVM a Stack Based virtual Machine?

Why is the JVM a stack based virtual machine? What exactly does that mean and what are the advantages over register based virtual machines? Are there any other major design / implementation choices fo开发者_JAVA技巧r virtual machine builders?


A stack based virtual machine is very simple, both as a concept and to implement. Just about anyone with a CS background can implement a simple fully functional VM in a few hundred lines of code.

You can think of the stack as an arbitrary large number of registers if the need arises. Adding registers from the start would be pre-mature optimization.

A simple concept then makes it simpler to do real magic like Hotspot on top of the model. That's not simple, but you can choose the level of complexity based on your ability from a straight interpreter to a simple JIT to Hotspot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜