5.1.7 Establishing Handlers

The list of established frame-based handlers for a thread is defined by the procedure invocation chain.

A procedure descriptor for which HANDLER_VALID is 1 must specify in HANDLER_ADDRESS the procedure value of an exception handler. The exception handler specified by a procedure descriptor is established when that descriptor is added to the invocation chain (that is, when the procedure designated by the descriptor becomes current), remains established as long as that procedure invocation is part of the invocation chain, and is revoked when that descriptor is removed from the invocation chain (that is, when the procedure invocation designated by the descriptor terminates, either by returning or being unwound).

Thus, the set of frame-based handlers that is established at any moment is defined by the current procedure call chain.

Dynamic activation and deactivation of exception handlers is not defined by this calling standard (and in fact not permitted within the semantics of many language standards). If this capability is required it must be defined on a language-by-language basis. Compilers that choose to support this functionality may set up language-specific static exception handlers that provide the dynamic exception-handling semantics of that language. These static handlers would be established by means of the procedure descriptor of the establishing procedure. If a language compiler decides to support dynamic activation of exception handlers it must be prepared to recognize code that intends to use this feature. This requirement stems from the need to add appropriate TRAPB instructions and other compile time considerations needed to make dynamic exception handling function correctly.

Note   There may be additional protocols and conventions for dynamic exception handling. These may be needed, for example, to enable a debugger to do a good job within the language exception-handling environment. These conventions are driven by the requirements of the languages and the language support utilities, and are not addressed by this calling standard.