A single intermediate language that supports multiple implementations of exceptions

We present mechanisms that enable our compiler-target language, C--, to express four of the best known techniques for implementing exceptions, all within a single, uniform framework. We define the mechanisms precisely, using a formal operational semantics. We also show that exceptions need not require special treatment in the optimizer; by introducing extra dataflow edges, we make standard optimization techniques work even on programs that use exceptions. Our approach clarifies the design space of exception-handling techniques, and it allows a single optimizer to handle a variety of implementation techniques. Our ultimate goal is to allow a source-language compiler the freedom to choose its exception-handling policy, while encapsulating the architecture-dependent mechanisms and their optimization in an implementation of C--that can be used by compilers for many source languages.

[1]  David Grove,et al.  Vortex: an optimizing compiler for object-oriented languages , 1996, OOPSLA '96.

[2]  John C. Gyllenhaal,et al.  Java bytecode to native code translation: the Caffeine prototype and preliminary results , 1996, Proceedings of the 29th Annual IEEE/ACM International Symposium on Microarchitecture. MICRO 29.

[3]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.

[4]  Alan Snyder,et al.  Exception Handling in CLU , 1979, IEEE Transactions on Software Engineering.

[5]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

[6]  Simon L. Peyton Jones,et al.  C-: A Portable Assembly Language , 1997, Implementation of Functional Languages.

[7]  Simon L. Peyton Jones,et al.  C--: A Portable Assembly Language that Supports Garbage Collection , 1999, PPDP.

[8]  Bowen Alpern,et al.  Detecting equality of variables in programs , 1988, POPL '88.

[9]  R. Kent Dybvig,et al.  Representing control in the presence of one-shot continuations , 1996, PLDI '96.

[10]  K. John Gough,et al.  Exception Handling: Expecting the Unexptected , 1994, Comput. Lang..

[11]  Melvin E. Conway,et al.  Proposal for an UNCOL , 1958, CACM.

[12]  Barbara Liskov,et al.  Aspects Of Implementing CLU , 1978, ACM Annual Conference.

[13]  John L. Hennessy,et al.  Program optimization and exception handling , 1981, POPL '81.

[14]  Liwu Li,et al.  Java Virtual Machine , 1998 .

[15]  Steven J. Drew,et al.  Implementing Zero Overhead Exception Handling , 1995 .

[16]  Simon Peyton Jones,et al.  Machine-independent support for garbage collection, debugging, exception handling, and concurrency (draft) , 1998 .

[17]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[18]  Andrew W. Appel,et al.  SSA is functional programming , 1998, SIGP.