[e8a7ca2] | 1 | \chapter{Introduction} |
---|
| 2 | |
---|
| 3 | % Talk about Cforall and exceptions generally. |
---|
| 4 | This thesis goes over the design and implementation of the exception handling |
---|
| 5 | mechanism (EHM) of |
---|
[e46ea00] | 6 | \CFA (pronounced see-for-all and also written Cforall or CFA). |
---|
| 7 | Exception handling provides more complex dynamic inter-function control flow. |
---|
| 8 | For example, normally function call is a strict linear form: function @h@ calls @g@, |
---|
| 9 | @g@ calls @f@, @f@ returns to @g@ and @g@ to @h@. |
---|
| 10 | \begin{center} |
---|
| 11 | \input{callreturn} |
---|
| 12 | \end{center} |
---|
| 13 | Exception handling allows deviations, |
---|
| 14 | such as @f@ returning directly to @h@ and the intervening call to @g@ is unwound. |
---|
| 15 | Other derivations include dynamic function call (old Lisp~\cite{CommonLisp} call) versus static or continuation passing. |
---|
| 16 | Basically, any non-linear form of call-return can be part of an EHM. |
---|
| 17 | |
---|
| 18 | Although |
---|
| 19 | powerful, an EHM tends to be conceptually more complex and expensive to use, and hence often limited |
---|
[e8a7ca2] | 20 | to unusual or ``exceptional" cases. |
---|
| 21 | The classic example of this is error handling, exceptions can be used to |
---|
[e46ea00] | 22 | remove error-handling logic from the main execution path and paying a higher |
---|
| 23 | performance cost only when the error actually occurs. |
---|
| 24 | |
---|
| 25 | \section{Background} |
---|
| 26 | |
---|
| 27 | Programming languages that provide different forms of EHM are: ... |
---|
| 28 | |
---|
| 29 | Mention the popular ``return union'' approach, which does not change the call/return control-flow. |
---|
| 30 | |
---|
| 31 | \section{New Work} |
---|
[e8a7ca2] | 32 | |
---|
| 33 | % Overview of exceptions in Cforall. |
---|
[e46ea00] | 34 | This thesis describes the design and implementation of the \CFA EHM. |
---|
| 35 | The work implements all of the common exception features (or an |
---|
[e8a7ca2] | 36 | equivalent) found in most other EHMs and adds some features of its own. |
---|
| 37 | The design of all the features had to be adapted to \CFA's feature set as |
---|
| 38 | some of the underlying tools used to implement and express exception handling |
---|
| 39 | in other languages are absent in \CFA. |
---|
| 40 | Still the resulting syntax resembles that of other languages: |
---|
| 41 | \begin{cfa} |
---|
| 42 | try { |
---|
| 43 | ... |
---|
| 44 | T * object = malloc(request_size); |
---|
| 45 | if (!object) { |
---|
| 46 | throw OutOfMemory{fixed_allocation, request_size}; |
---|
| 47 | } |
---|
| 48 | ... |
---|
| 49 | } catch (OutOfMemory * error) { |
---|
| 50 | ... |
---|
| 51 | } |
---|
| 52 | \end{cfa} |
---|
| 53 | |
---|
| 54 | % A note that yes, that was a very fast overview. |
---|
[e46ea00] | 55 | The design and implementation of all of \CFA's EHM's features are |
---|
| 56 | described in detail throughout in this thesis, whether they are a common feature |
---|
[e8a7ca2] | 57 | or one unique to \CFA. |
---|
| 58 | |
---|
| 59 | % The current state of the project and what it contributes. |
---|
[e46ea00] | 60 | All of these features have been implemented in \CFA, along with |
---|
| 61 | a suite of test cases, as part of this thesis. |
---|
[e8a7ca2] | 62 | The implementation techniques are generally applicable in other programming |
---|
[e46ea00] | 63 | languages and much of the design as well. Although some of \CFA's more unusual EHM feature |
---|
| 64 | would not be found in other programming languages. |
---|
| 65 | |
---|
| 66 | \section{Contributions} |
---|
| 67 | |
---|
| 68 | The contributions of this work are: |
---|
| 69 | \begin{enumerate} |
---|
| 70 | \item |
---|
| 71 | \item |
---|
| 72 | \item |
---|
| 73 | \item |
---|
| 74 | \end{enumerate} |
---|
| 75 | |
---|
| 76 | \section{Road Map} |
---|