>, "Steven D. Majewski" <sdm7g@elvis.med.virginia.edu> writes:> The exception processing model I'm most familiar with ( from long> years on a VAX, and from similar implementations for various> languages ) is the stack based one, where every procedure or> protected block of code has some stack based structure that indicates> how ( and maybe what ) exceptions are handled.

If I recall how the VAX did it, these routines had to be dynamically
registered each time a procedure was entered. It's also possible to
build a table associating exception handlers and unwinders with
specific PC ranges. Last year I wrote an article about doing this
for JCLT (a journal edited by the comp.compilers moderator) but this
is pretty old technology. In current, widely available compilers, I
know the Sun C++ compiler uses this technique (I worked there at the
time, and helped design it).

> A continuation model - whether visible in the language (as in> Scheme) or hidden in the implementation is the other common model I> know of. ( Any others? )

> Do any language implementations do static analysis and optimization> of exceptions within a procedure - in effect, translating them into> goto's and avoiding the overhead of handlers ?

They might. We certainly talked about it while implementing Modula-3
years ago, and I got the impression that some other compiler
(for Modula-2+?) did this. One could also claim that this is a
"simple result" of sufficient constant propagation and other
optimization in a continuation passing model.