Next: machinery continuations immut, Previous: machinery continuations general, Up: machinery continuations [Index]
We assume the validity of machinery simplifications to focus on some aspect of the runtime behaviour, Simplification assumptions. Let’s look at this simple program that does not create explicit continuations:
(import (rnrs)) (define (alpha) (beta)) (define (beta) (delta)) (define (delta) 123) (alpha)
Vicare allocates a memory segment to be used as stack, then
executes the call to alpha
pushing its stack frame on the stack;
as subordinate function calls are performed: new stack frames are pushed
on the stack, machinery
continuations without.
-- growing direction --> |----------|---------------------------------------| locals of toplevel |----------|----------|----------------------------| frame of locals of toplevel alpha |----------|----------|----------|-----------------| frame of frame of locals of toplevel alpha beta |----------|----------|----------|-----------|-----| frame of frame of frame of locals of toplevel alpha beta delta
When the functions return the stack rewinds; when there are no more stack frames: there is nowhere to return to, so the program terminates, machinery continuations without.