Re: Implementation of Exceptions

Norman Ramsey <>
6 Nov 1998 16:02:07 -0500

          From comp.compilers

Related articles
Implementation of Exceptions (Michael Schoettner) (1998-10-21)
Re: Implementation of Exceptions (Ehud Lamm) (1998-10-22)
Re: Implementation of Exceptions (1998-10-22)
Re: Implementation of Exceptions (Norman Ramsey) (1998-11-06)
| List of all articles for this month |

From: Norman Ramsey <>
Newsgroups: comp.compilers
Date: 6 Nov 1998 16:02:07 -0500
Organization: University of Virginia Computer Science
References: 98-10-121
Keywords: Java, errors

Michael Schoettner <> wrote:
>I'm searching for papers about implementation of
>exceptions. Can anybody help me?

Simon Peyton Jones and I recently put together an explanation of how
to use the `portable assembly language' C-- to express several
well-known techniques for implementing exceptions. I append the
abstract; the full paper may be found at We have
submitted this paper to PLDI.


Exceptions Need Not Be Exceptional

Norman Ramsey and Simon Peyton Jones

      It is well known how to analyze and optimize programs written in a
      language of basic blocks and control-flow graphs, but it is not
      obvious how to extend the standard techniques to accommodate
      exceptions, especially because different source languages have
      different semantics for exceptions. We present mechanisms that enable
      a simple compiler-target language, C--, to express the exception
      semantics of multiple source languages. These mechanisms include the
      _C-- continuation_, which is used to model exception handlers, and
      _source annotations_, which tell the optimizer how control and data
      flow through calls to procedures that might raise exceptions. We give
      examples to show that these mechanisms, together with modest run-time
      support, can implement exceptions in the style of Modula-3, Eiffel,
      and ML.

      To make the meanings of the mechanisms precise, we show how a C--
      program can be expressed as a set of control-flow graphs, and we use
      formal operational semantics to show precisely how to interpret such
      graphs. Finally, we give precise rules for adding dataflow information
      to C-- control-flow graphs. Given this information, the compiler
      writer need not reason directly about the semantics of source-language
      exceptions or about the operational semantics of C--. Instead, the
      standard optimizations preserve the correct semantics, with no further

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.