vm: Don't unconditionally allocate state on stack, do that only if needed.

This makes sure that only as much stack allocated as actually used, reducing
stack usage for each Python function call.