5.1.6 Exception Handlers

A frame-based handler is established when a procedure whose descriptor specifies an exception handler becomes current. Thus, frame-based handlers are usually associated with a procedure at compile time, and are located at run time via the procedure descriptor. These exception handlers are normally used to implement a particular language's exception-handling semantics.

The frame-based handlers that may be invoked are those established by active procedures, from the most current procedure to the oldest predecessor.

Handling Exceptions

An exception handler that conforms to this standard generally should not handle any exception that its establisher did not cause unless there is a prior agreement between the writers of the exception handler and the writers of the code that raised the exception.

Access to Memory

Exceptions can be raised and unwind operations (which cause exception handlers to be called) can occur when the current value of one or more variables is in registers rather than in memory. Because of this, a handler, and any descendant procedure called directly or indirectly by a handler, must not access any variables except those explicitly passed to the procedure as arguments or those that exist in the normal scope of the procedure.

This rule can be violated for specific memory locations only by agreement between the handler and all procedures that might access those memory locations. The effects of such agreements are not specified by this standard.