[Q] stackbased/registerbased VM

Hans-Martin Mosner hmm at heeg.de
Sat Dec 13 14:59:26 UTC 2003


Chris Burkert wrote:

> Hi,
>
> Can somebody tell me, why Smalltalk (and other OO-environments)
> uses a stackbased VM? Were there reasons not to take a
> registerbased VM or was a stackbased VM just the first idea? Are
> there other Pros and Cons that would help to understand this?

Stack based VMs were pretty common at the time (and still are). They map
very nicely to the nested syntax structures common in programming
languages and generally lead to simple compilers, which are easier and
less error-prone to implement.
Register based VMs probably can lead to faster dynamic translators to
real machine code if the target has an adequate number of real registers.
Sadly, the world's dominant PC CPU hasn't.

Off the top of my head I don't see really significant advantages of
register-based VMs...
The Apple link in your mail was for the 68k emulator in MacOS IIUC. The
simple reason that this VM is register-based is that its model is so - a
real processor :-)
For the Perl VM, I did not follow the links deep enough to understand the
design decision.

Cheers,
Hans-Martin




More information about the Squeak-dev mailing list