Implemented at the hardware level, a register-based machine will be more efficient, simply because access to slower RAM is less. However, in software, even based on register architecture, there will most likely be “registers” in RAM. In this case, a stack-based machine will be just as efficient.
In addition, a stack-based virtual machine will make it much easier to write compilers. You do not need to deal with register allocation strategies. You have, in fact, an unlimited number of registers to work with.
Update: I wrote this answer assuming an interpreted virtual machine. This may not correspond to the VM JIT compilation. I came across this article , which apparently indicates that a compiled JIT virtual machine can be more efficient using the register architecture.
Ferruccio Oct 02 '08 at 19:43 2008-10-02 19:43
source share