[virtmach] parrot VM?

Manoj Plakal virtmach@iecc.com
Fri, 12 Jul 2002 17:26:08 -0500


Chris Lattner wrote (Fri, Jul 12, 2002 at 04:42:05PM -0500) :
> > > and (b) simpler compiler?
> > Yes.  I imagine register allocation (done right) would be a significant
> > complication in the bytecode compiler.
> 
> Although the register allocator would give much better results than simple 
> tree based heuristics used for stack machines.  Linear scan register 
> allocation isn't that hard, and gives quite reasonable results.
> 
> > > Is there some other obvious reason to use a stack VM?
> 
> One very significant drawback of stack-based VMs is that they are almost 
> impossible to do meaningful optimizations on.  If your VM performs any 
> substation optimization, you will often find that you have to translate 
> from a stack-based rep to a register based representation anyway, losing 
> any advantages the stack based VM gives you.

	True. I think that if you want a high-performance VM,
	then you probably want to do a register VM.

	But aren't there some portability issues with a register VM?
	Wouldn't you want to map the VM registers to real registers
	(since you want performance in the first place)? That
	might make it difficult to have a register VM that runs fast
        on both, say, x86 and MIPS.
	
	I'd say that a stack-based VM seems a good option if
	you want a portable VM and a simple compiler and code size
	is an issue. 

        The Parrot folks (based on some browsing of the Perl lists) seem
	to opt for register VMs for performance and "easier debugging."

	Manoj