Next: Higher-Order Instructions Up: Control Instructions Previous: Branch Instructions

Non-local Exits

catch label prepares the catch stack at the beginning of an LL (catch tag . body) statement: the actual stack pointer and the address of the instruction following body (= @label) are pushed on the catch stack.

For a detailed definition of the compilation of the (catch tag . body) statement into the catch and remove-tag instructions, please refer to section 6.2.8.

If the end of the body of the (catch tag . body) statement is reached, the top of the catch stack is removed with the remove-tag instruction.

A non-local exit of the body is performed by the throw instruction, corresponding to the LL (throw tag value) builtin: the topmost occurrence of the tag in the catch stack is determined; P and SP are restored with the corresponding values in the catch stack, and the found entry and all entries on the catch stack behind it are discarded. It is an error when the tag is not found in the catch stack.

For LL loops (loop and do), specialized versions of catch and throw are used where the tag is nil. In order to avoid to push the constant nil on the stack, a catch-nil and a throw-nil instruction were introduced.



Next: Higher-Order Instructions Up: Control Instructions Previous: Branch Instructions


Harold Boley & Michael Sintek (sintek@dfki.uni-kl.de)