registers vs stacks

前端 未结 8 767
半阙折子戏
半阙折子戏 2021-01-29 19:13

What exactly are the advantages and disadvantages to using a register-based virtual machine versus using a stack-based virtual machine?

To me, it would seem as though a

8条回答
  •  逝去的感伤
    2021-01-29 19:51

    Stack based VM's are simpler and the code is much more compact. As a real world example, a friend built (about 30 years ago) a data logging system with a homebrew Forth VM on a Cosmac. The Forth VM was 30 bytes of code on a machine with 2k of ROM and 256 bytes of RAM.

提交回复
热议问题