[virtmach] Your VM
Wed, 30 May 2001 14:14:49 +0200
> > apart from speed considerations, i recently came across a useful reason
> > for implementing as an array of function pointers rather than a switch
> > statement: the core execution loop is very small, so it's possible to
> > have alternative execution loops for very little cost.
> > the Inferno VM uses this to implement single-step/breakpoint debugging
> > - a process being debugged uses an alternative core execution function;
> > others use the usual one (which is only 22 lines of code).
> In debug mode the traceop() macro expands
> to a print statement that prints out the
> instruction exactly as it was exicuted.
> (including the args.)
Of course, but it means you cannot dynamically switch to/from debug mode.
Since debug is generaly _very_ slow, it can be good to have special opcodes
to switch to debug mode at a particular location where you want to debug,
and switch back to fast(release) mode after that part.