[e8a7ca2] | 1 | \chapter{Introduction} |
---|
| 2 | |
---|
[4ed7946e] | 3 | \PAB{Stay in the present tense. \newline |
---|
| 4 | \url{https://plg.uwaterloo.ca/~pabuhr/technicalWriting.shtml}} |
---|
| 5 | \newline |
---|
| 6 | \PAB{Note, \lstinline{lstlisting} normally bolds keywords. None of the keywords in your thesis are bolded.} |
---|
| 7 | |
---|
[e8a7ca2] | 8 | % Talk about Cforall and exceptions generally. |
---|
[4ed7946e] | 9 | %This thesis goes over the design and implementation of the exception handling |
---|
| 10 | %mechanism (EHM) of |
---|
| 11 | %\CFA (pernounced sea-for-all and may be written Cforall or CFA). |
---|
| 12 | Exception handling provides alternative dynamic inter-function control flow. |
---|
[553f8abe] | 13 | There are two forms of exception handling covered in this thesis: |
---|
| 14 | termination, which acts as a multi-level return, |
---|
| 15 | and resumption, which is a dynamic function call. |
---|
[4ed7946e] | 16 | Note, termination exception handling is so common it is often assumed to be the only form. |
---|
| 17 | Lesser know derivations of inter-function control flow are continuation passing in Lisp~\cite{CommonLisp}. |
---|
[553f8abe] | 18 | |
---|
| 19 | Termination exception handling allows control to return to any previous |
---|
| 20 | function on the stack directly, skipping any functions between it and the |
---|
| 21 | current function. |
---|
[e46ea00] | 22 | \begin{center} |
---|
| 23 | \input{callreturn} |
---|
| 24 | \end{center} |
---|
| 25 | |
---|
[553f8abe] | 26 | Resumption exception handling calls a function, but asks the functions on the |
---|
| 27 | stack what function that is. |
---|
| 28 | \todo{Add a diagram showing control flow for resumption.} |
---|
[e46ea00] | 29 | |
---|
[553f8abe] | 30 | Although a powerful feature, exception handling tends to be complex to set up |
---|
| 31 | and expensive to use |
---|
| 32 | so they are often limited to unusual or ``exceptional" cases. |
---|
| 33 | The classic example of this is error handling, exceptions can be used to |
---|
| 34 | remove error handling logic from the main execution path and while paying |
---|
| 35 | most of the cost only when the error actually occurs. |
---|
[e8a7ca2] | 36 | |
---|
| 37 | % Overview of exceptions in Cforall. |
---|
[4ed7946e] | 38 | |
---|
| 39 | \PAB{You need section titles here. Don't take them out.} |
---|
| 40 | |
---|
| 41 | \section{Thesis Overview} |
---|
| 42 | |
---|
| 43 | This thesis goes over the design and implementation of the exception handling |
---|
| 44 | mechanism (EHM) of |
---|
| 45 | \CFA (pernounced sea-for-all and may be written Cforall or CFA). |
---|
| 46 | %This thesis describes the design and implementation of the \CFA EHM. |
---|
[553f8abe] | 47 | The \CFA EHM implements all of the common exception features (or an |
---|
[e8a7ca2] | 48 | equivalent) found in most other EHMs and adds some features of its own. |
---|
| 49 | The design of all the features had to be adapted to \CFA's feature set as |
---|
| 50 | some of the underlying tools used to implement and express exception handling |
---|
| 51 | in other languages are absent in \CFA. |
---|
| 52 | Still the resulting syntax resembles that of other languages: |
---|
| 53 | \begin{cfa} |
---|
| 54 | try { |
---|
| 55 | ... |
---|
| 56 | T * object = malloc(request_size); |
---|
| 57 | if (!object) { |
---|
| 58 | throw OutOfMemory{fixed_allocation, request_size}; |
---|
| 59 | } |
---|
| 60 | ... |
---|
| 61 | } catch (OutOfMemory * error) { |
---|
| 62 | ... |
---|
| 63 | } |
---|
| 64 | \end{cfa} |
---|
| 65 | |
---|
| 66 | % A note that yes, that was a very fast overview. |
---|
[4ed7946e] | 67 | The design and implementation of all of \CFA's EHM's features are |
---|
[553f8abe] | 68 | described in detail throughout this thesis, whether they are a common feature |
---|
[e8a7ca2] | 69 | or one unique to \CFA. |
---|
| 70 | |
---|
| 71 | % The current state of the project and what it contributes. |
---|
[4ed7946e] | 72 | All of these features have been implemented in \CFA, along with |
---|
[553f8abe] | 73 | a suite of test cases as part of this project. |
---|
[e8a7ca2] | 74 | The implementation techniques are generally applicable in other programming |
---|
[553f8abe] | 75 | languages and much of the design is as well. |
---|
| 76 | Some parts of the EHM use other features unique to \CFA and these would be |
---|
| 77 | harder to replicate in other programming languages. |
---|
[e46ea00] | 78 | |
---|
[4ed7946e] | 79 | \section{Background} |
---|
| 80 | |
---|
[553f8abe] | 81 | % Talk about other programming languages. |
---|
| 82 | Some existing programming languages that include EHMs/exception handling |
---|
| 83 | include C++, Java and Python. All three examples focus on termination |
---|
| 84 | exceptions which unwind the stack as part of the |
---|
| 85 | Exceptions also can replace return codes and return unions. |
---|
| 86 | In functional languages will also sometimes fold exceptions into monads. |
---|
[e46ea00] | 87 | |
---|
[4ed7946e] | 88 | \PAB{You must demonstrate knowledge of background material here. |
---|
| 89 | It should be at least a full page.} |
---|
| 90 | |
---|
| 91 | \section{Contributions} |
---|
| 92 | |
---|
[e46ea00] | 93 | The contributions of this work are: |
---|
| 94 | \begin{enumerate} |
---|
[553f8abe] | 95 | \item Designing \CFA's exception handling mechanism, adapting designs from |
---|
| 96 | other programming languages and the creation of new features. |
---|
| 97 | \item Implementing stack unwinding and the EHM in \CFA, including updating |
---|
| 98 | the compiler and the run-time environment. |
---|
| 99 | \item Designed and implemented a prototype virtual system. |
---|
| 100 | % I think the virtual system and per-call site default handlers are the only |
---|
| 101 | % "new" features, everything else is a matter of implementation. |
---|
[e46ea00] | 102 | \end{enumerate} |
---|
| 103 | |
---|
[553f8abe] | 104 | \todo{I can't figure out a good lead-in to the overview.} |
---|
| 105 | Covering the existing \CFA features in \autoref{c:existing}. |
---|
| 106 | Then the new features are introduce in \autoref{c:features}, explaining their |
---|
| 107 | usage and design. |
---|
| 108 | That is followed by the implementation of those features in |
---|
| 109 | \autoref{c:implement}. |
---|
| 110 | % Future Work \autoref{c:future} |
---|