Simon --

> >   * runops() itself is changed to have a while() loop in it so that
> >     any time we drop out of the core, we'll resume if we have an
> >     interpreter->resume_addr set (after reselecting the core, though).
> > 
> >   * process_opfunc.pl has a new "macro": RESUME(), that sets up
> >     interpreter->resume_addr. This is used by the new ops. The new
> >     ops still return the new PC as the next op (which MUST be an
> >     'end' op to force the core loop to terminate -- *pc being false
> >     is the only termination condition we can count on for all cores).
> 
> I don't understand this. Can you explain more succinctly what
> resume_addr is about?

I'll explain it, but I can't promise it will be succinct (that isn't
my strong area :)...

Normally, whenever we hit the case where *pc is false, our inner
while loop that does DO_OP finishes, and we then return up through
the call to the interpreter's top-level runops, which returns control
to the interpreter driver (such as test_prog).

The only difference here is that any time this happens (i.e., when we
run into an 'end' op), before we return all the way out we examine
interpreter->resume_addr. If this is not NULL, we are supposed to
re-enter *a* core loop at that address instead of returning back to
the caller. 

We use this to allow the interpreter to re-select from among the
available runops core functions based on interpreter->flags (which
presumably has changed).

This allows us to have as many options as we like (such as tracing
and bounds checking, perhaps even profiling or event monitoring),
but to avoid adding a bunch of tests inside the core loop. And, we
can have flags that are allowed to change *during the execution of
the program*, again at no cost *in* the core loop (you only pay
to drop out, reselect, and drop back in again when you change the
flags, which should be radition, since you probably don't need to
twiddle them too often.


Regards,
 
-- Gregor
 _____________________________________________________________________ 
/     perl -e 'srand(-2091643526); print chr rand 90 for (0..4)'      \

   Gregor N. Purdy                          [EMAIL PROTECTED]
   Focus Research, Inc.                http://www.focusresearch.com/
   8080 Beckett Center Drive #203                   513-860-3570 vox
   West Chester, OH 45069                           513-860-3579 fax
\_____________________________________________________________________/

Reply via email to