On Sat, Nov 3, 2018 at 4:30 PM Hugo Hörnquist <hugo@lysator.liu.se> wrote:
The section, as far as I can see, just describes a machine
which pushes continuation instead of the PC counter to the
stack.

Also, while in theory quite nice it has the problem that
Guile is really slow in restoring continuations, due to the
fact that we have complete C interoperability.

There's some misunderstanding here. The SICP register machine model is not very different from common register machine models. There's just a difference in how to handle subroutine calls. A short example:

Let's first write out all operations involved in a call in a conventional register machine:

        [...]
        ; The following three micro operations consitute "call foo ()"
        (sp) <- pc + offset(L1) ; NOTE the external memory access
        sp <- sp - 1
        pc <- pc + offset(foo)
L1:    [...]
       
foo:   [...]
        ; the following two micro operations constitute "ret"
        sp <- sp + 1
        pc <- (sp) ; NOTE the external memory access

Now look at the call in the SICP register machine:

        [...]
        continue <- pc + offset(L1)
        pc <- pc + offset(foo)
L1:   [...]

foo:  [...]
        pc <- continue

It is fewer operations and every operation is immediate with no memory access. I *have* cheated since I omit a need to push the continue register onto the stack, but while this is needed at *every* call for the conventional machine, this is only required once at the beginning of a function in the SICP machine *unless* the function has a tail call, in which case we don't need to push anything. So, while one can say that we only "push around the pushes", we make gains for every tal call.