[virtmach] Your VM

Thomas Fjellstrom virtmach@iecc.com
Wed, 30 May 2001 06:23:11 -0600


Mickaël Pointier wrote:
> 
> > > 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.
> 
>     Mike

There are more differences between debug and realease mode than
just tracing. ie: its compiled with different flags (-gstabs/-s etc...)
and electric fence is linked to the vm.

But that tracing idea is something I never thought of...
I think Im going to leave the tracing alone when compiled
in debug mode but allow it to be turned on in release mode...

-- 
"Computer programmers don't byte, they nybble a bit."
Thomas Fjellstrom
tfjellstrom@home.com
http://strangesoft.net/