Sat Apr 4 13:37:57 CEST 2009

values vs CPS

For "functional update" of a state machine, it is simplest to use
Scheme's built-in tail recursion.  The idea is that heap data is not
allocated for building argument lists - instead this is implemented
using a stack with reclaimable memory.

For mzscheme the place to look seems to be scheme_values() defined in

  if (p->values_buffer && (p->values_buffer_size >= argc))

then values get copied to the current thread's values buffer,
otherwise the "slow" procedure is used, which allocates a new values

Then there's stuff in the JIT.  Apparently the nb of function
arguments is limited to 3.

Anyways: implementation is for later.

The important question is: do we model individual transition functions
(machine state update using external sequencing) or do we include the
machine's continuation model in the transition model.  I.e.

          (define (instr R1 R2) (values (+ 1 R1) R2))


          (define (instr R1 R2 k) (k (+ 1 R1) (R2)))

It's probably best to use the latter since it is more general.