Date of Award
Doctor of Philosophy (PhD)
Computer Engineering and Sciences
This dissertation considers the implementation of exception handling specifically for functional languages. Some implementations incur overhead for using exception handling even when no exceptions are raised. We show the results of some experiments with the SML of New Jersey and OCAML compilers, two well-known compilers for functional languages. Imperative languages avoid this overhead by using tables, but the approach does not easily transfer to compilers using continuation passing style (CPS). This dissertation proposes an approach that works with CPS compilers like SML of New Jersey. We first present an experiment where programs in SML are written with and without exception handlers. From these results, we conclude that programs with exception handling produce overhead even when no exceptions are raised. Then, we analyze the source of the exception handling overhead in the SML of New Jersey compiler. We present a solution to the problem. The new approach uses two continuations instead of the one continuation. One continuation encapsulates the rest of the normal computation as usual. A second continuation is used for passing the abnormal computation. The second continuation is not passed as an extra argument but is passed as a displacement from the first continuation. We have implemented a basic CPS compiler for functional languages with exception handling. With it we were able to implement the new approach to exception handling and compare it side-by-side with the approach taken by the SML of New Jersey compiler. We show that the new approach to exception handing adds no overhead to the normal flow of control. The importance of our new approach to exception handing for CPS compilers proposed in this dissertation is the improved run-time performance in every case in which an exception handler is used.
Cabada, Ramon Zatarain, "Design and Implementation of Exception Handling with Zero Overhead in Functional Languages" (2003). Theses and Dissertations. 720.
Copyright held by author