Non-Local Control Flow Instructions

Instruction: capture-continuation s24:dst

Capture the current continuation, and write it to dst. Part of the implementation of call/cc.

Instruction: continuation-call c24:contregs

Return to a continuation, nonlocally. The arguments to the continuation are taken from the stack. contregs is a free variable containing the reified continuation.

Instruction: abort x24:_

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 0, 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 call.

Instruction: compose-continuation c24:cont

Compose a partial continuation with the current continuation. The arguments to the continuation are taken from the stack. cont is a free variable containing the reified continuation.

Instruction: prompt s24:tag b1:escape-only? x7:_ f24:proc-slot x8:_ l24:handler-offset

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 –F– operator.)

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.

Instruction: throw s12:key s12:args

Raise an error by throwing to key and args. args should be a list.

Instruction: throw/value s24:value n32:key-subr-and-message
Instruction: throw/value+data s24:value n32:key-subr-and-message

Raise an error, indicating val as the bad value. key-subr-and-message should be a vector, where the first element is the symbol to which to throw, the second is the procedure in which to signal the error (a string) or #f, and the third is a format string for the message, with one template. These instructions do not fall through.

Both of these instructions throw to a key with four arguments: the procedure that indicates the error (or #f, the format string, a list with value, and either #f or the list with value as the last argument respectively.