[virtmach] parrot VM?

Ian Piumarta ian.piumarta@inria.fr
Fri, 12 Jul 2002 23:37:01 +0200 (MET DST)


On Fri, 12 Jul 2002, Manoj Plakal wrote:

> Aren't the main advantages of stack VMs: 
> (a) smaller (interpreted) code size

Depends on the insn encoding.  But in practice almost always.

> and (b) simpler compiler?

Yes.  I imagine register allocation (done right) would be a significant
complication in the bytecode compiler.

> Is there some other obvious reason to use a stack VM?

When dynamically translating to native code at runtime it's much easier to
generate register-based native code off a stack-based bytecode than it is
to do it off a register-based one (or even convert back to pure
stack-based code for some architectures which have no registers).  One
reason for this is that the stack manipulation in the bytecode has lots of
implicit information in it (e.g., lifetimes) that would be missing in
register-based code.

Ian