Guile’s virtual machine has low-level support for
dynamic binding, and composable prompts and aborts.
Abort to a prompt handler. The tag is expected in slot 1, and the rest of the values in the frame are returned to the prompt handler. This corresponds to a tail application of abort-to-prompt.
If no prompt can be found in the dynamic environment with the given tag, an error is signalled. Otherwise all arguments are passed to the prompt’s handler, along with the captured continuation, if necessary.
If the prompt’s handler can be proven to not reference the captured
continuation, no continuation is allocated. This decision happens
dynamically, at run-time; the general case is that the continuation may
be captured, and thus resumed. A reinstated continuation will have its
arguments pushed on the stack from slot 1, as if from a multiple-value
return, and control resumes in the caller. Thus to the calling
function, a call to
abort-to-prompt looks like any other function
Push a new prompt on the dynamic stack, with a tag from tag and a handler at handler-offset words from the current ip.
If an abort is made to this prompt, control will jump to the handler.
The handler will expect a multiple-value return as if from a call with
the procedure at proc-slot, with the reified partial continuation
as the first argument, followed by the values returned to the handler.
If control returns to the handler, the prompt is already popped off by
the abort mechanism. (Guile’s
prompt implements Felleisen’s
If escape-only? is nonzero, the prompt will be marked as escape-only, which allows an abort to this prompt to avoid reifying the continuation.
See Prompts, for more information on prompts.
Push wind and unwind procedures onto the dynamic stack. Note that neither are actually called; the compiler should emit calls to wind and unwind for the normal dynamic-wind control flow. Also note that the compiler should have inserted checks that they wind and unwind procs are thunks, if it could not prove that to be the case. See Dynamic Wind.
a normal exit from the dynamic extent of an expression. Pop the top entry off of the dynamic stack.
Dynamically bind value to fluid by creating a with-fluids object and pushing that object on the dynamic stack. See Fluids and Dynamic States.
Leave the dynamic extent of a
with-fluid* expression, restoring
the fluid to its previous value.
push-fluid should always be
Reference the fluid in src, and place the value in dst.
Set the value of the fluid in dst to the value in src.