source: doc/theses/andrew_beach_MMath/intro.tex @ 21f2e92

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 21f2e92 was 21f2e92, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Revert "proofread Andrew's thesis chapters", changes saved locally.

This reverts commit 4ed7946e1c3092b517d444219a8ec8caf85a8b5a.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1\chapter{Introduction}
2
3% Talk about Cforall and exceptions generally.
4This thesis goes over the design and implementation of the exception handling
5mechanism (EHM) of
6\CFA (pernounced sea-for-all and may be written Cforall or CFA).
7Exception handling provides dynamic inter-function control flow.
8There are two forms of exception handling covered in this thesis:
9termination, which acts as a multi-level return,
10and resumption, which is a dynamic function call.
11This seperation is uncommon because termination exception handling is so
12much more common that it is often assumed.
13
14Termination exception handling allows control to return to any previous
15function on the stack directly, skipping any functions between it and the
16current function.
17\begin{center}
18\input{callreturn}
19\end{center}
20
21Resumption exception handling calls a function, but asks the functions on the
22stack what function that is.
23\todo{Add a diagram showing control flow for resumption.}
24
25Although a powerful feature, exception handling tends to be complex to set up
26and expensive to use
27so they are often limited to unusual or ``exceptional" cases.
28The classic example of this is error handling, exceptions can be used to
29remove error handling logic from the main execution path and while paying
30most of the cost only when the error actually occurs.
31
32% Overview of exceptions in Cforall.
33This work describes the design and implementation of the \CFA EHM.
34The \CFA EHM implements all of the common exception features (or an
35equivalent) found in most other EHMs and adds some features of its own.
36The design of all the features had to be adapted to \CFA's feature set as
37some of the underlying tools used to implement and express exception handling
38in other languages are absent in \CFA.
39Still the resulting syntax resembles that of other languages:
40\begin{cfa}
41try {
42        ...
43        T * object = malloc(request_size);
44        if (!object) {
45                throw OutOfMemory{fixed_allocation, request_size};
46        }
47        ...
48} catch (OutOfMemory * error) {
49        ...
50}
51\end{cfa}
52
53% A note that yes, that was a very fast overview.
54All the design and implementation of all of \CFA's EHM's features are
55described in detail throughout this thesis, whether they are a common feature
56or one unique to \CFA.
57
58% The current state of the project and what it contributes.
59All of these features have been added to the \CFA implemenation, along with
60a suite of test cases as part of this project.
61The implementation techniques are generally applicable in other programming
62languages and much of the design is as well.
63Some parts of the EHM use other features unique to \CFA and these would be
64harder to replicate in other programming languages.
65
66% Talk about other programming languages.
67Some existing programming languages that include EHMs/exception handling
68include C++, Java and Python. All three examples focus on termination
69exceptions which unwind the stack as part of the
70Exceptions also can replace return codes and return unions.
71In functional languages will also sometimes fold exceptions into monads.
72
73The contributions of this work are:
74\begin{enumerate}
75\item Designing \CFA's exception handling mechanism, adapting designs from
76other programming languages and the creation of new features.
77\item Implementing stack unwinding and the EHM in \CFA, including updating
78the compiler and the run-time environment.
79\item Designed and implemented a prototype virtual system.
80% I think the virtual system and per-call site default handlers are the only
81% "new" features, everything else is a matter of implementation.
82\end{enumerate}
83
84\todo{I can't figure out a good lead-in to the overview.}
85Covering the existing \CFA features in \autoref{c:existing}.
86Then the new features are introduce in \autoref{c:features}, explaining their
87usage and design.
88That is followed by the implementation of those features in
89\autoref{c:implement}.
90% Future Work \autoref{c:future}
Note: See TracBrowser for help on using the repository browser.