[reply redirected to hugs-bugs]

> I want to be able to reduce an expression one reduction at a time, rather 
> than merely reducing it to whnf in one go.

As you said, the way you'd do this is very dependent on the abstract machine
and its implementation.

With the existing implementation, you probably want to modify
any piece of code containing: 

  numReductions++;

But what change do you make?
Evaluation involves recursive calls between eval, run and the primops
(ie the functions defined in builtin.c) so you'll probably have to use
longjmp/setjmp to jump out to your control function after the update.


With the new implementation, it's not so clear what counts as a reduction.
You could choose to do something magical when updates happen or when
the evaluator finishes evaluating a bytecode sequence.  The new evaluator
is going to have concurrency built in so hopefully all you need to do is
set the preemption flag to true and the normal concurrency mechanisms
will trigger a return to the scheduler pretty soon.

No promises but the new implementation might even have something like this
built in for debugging purposes.  When you're trying to debug concurrent
code and GC-related code, it can be really good to force a context
switch at every possible moment and force a garbage collection on every
heap check and leave it running for a week (on someone elses machine :-)

-- 
Alastair Reid              Yale Haskell Project Hacker
[EMAIL PROTECTED]  http://WWW.CS.Yale.EDU/homes/reid-alastair/



Reply via email to