Something overlooked in this (and many other articles about stack based VMs): if the stack based VM requires a well balanced stack (as is the case for JVM), the bytecode can be trivially rewritten to a register based VM: number each stack location and trace all basic-blocks to see which stackslot they hit. Then just replace all the push 10, pop with "move 10 to slot/register-1", "load slot/register-1" etc. The converse is much harder, so I really prefer to work with stack based VMs as they are more condense and if speed is needed a linear (in function size) scan can rewrite it to make the mapping to cpu registers much easier.