Ignore:
Timestamp:
May 25, 2021, 4:15:06 PM (5 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
375fb46, 82f4063
Parents:
b984d54 (diff), 887fc79 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
doc/theses/andrew_beach_MMath
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/cfalab.sty

    rb984d54 rc65b930  
    126126}
    127127
     128% \snake{<identifier>}
     129% Improves writing of snake case (or any convention that uses _) by allowing
     130% line breaks after _. Disables commands inside the block and formats the
     131% identifier to look like code.
     132\newcommand*\snake[1]{\snakefont{\expandafter\snake@next\detokenize{#1}\@nil}}
     133
     134% \snakefont{<text>}
     135% Command used by \snake, you may renew the command to change its formating.
     136\newcommand*\snakefont[1]{\texttt{#1}}
     137
     138% Thanks Manuel of TeX Stack exchange. (I got the base pattern from one of
     139% their answers.) Note: \@nil should never be defined.
     140\newcommand*\snake@next[1]{\ifx\@nil#1\else
     141  \expandafter\ifx\string_#1\string_\allowbreak\else#1\fi
     142  \expandafter\snake@next\fi
     143}
     144
    128145% common.tex Compatablity ===================================================
    129146% Below this line is for compatability with the old common.tex file.
  • doc/theses/andrew_beach_MMath/existing.tex

    rb984d54 rc65b930  
    199199forall(dtype T)
    200200struct node {
    201         node(T) * next;  // generic linked node
     201        node(T) * next;
    202202        T * data;
    203203}
     
    238238\begin{cfa}
    239239coroutine CountUp {
    240         unsigned int next; // communication variable
     240        unsigned int next;
    241241}
    242242CountUp countup;
     
    308308{
    309309        StringWorker stringworker; // fork thread running in "main"
    310 } // implicitly join with thread $\(\Rightarrow\)$ wait for completion
     310} // <- implicitly join with thread / wait for completion
    311311\end{cfa}
    312312The thread main is where a new thread starts execution after a fork operation
  • doc/theses/andrew_beach_MMath/features.tex

    rb984d54 rc65b930  
    115115
    116116\paragraph{Communication}
    117 For effective exception handling, additional information is usually passed
     117For effective exception handling, additional information is often passed
    118118from the raise to the handler.
    119119So far only communication of the exceptions' identity has been covered.
     
    327327\end{cfa}
    328328When viewed on its own, a try statement will simply execute the statements
    329 in @GUARDED_BLOCK@ and when those are finished the try statement finishes.
     329in \snake{GUARDED_BLOCK} and when those are finished the try statement finishes.
    330330
    331331However, while the guarded statements are being executed, including any
     
    343343
    344344If no termination handler is found during the search then the default handler
    345 (@defaultTerminationHandler@) is run.
     345(\defaultTerminationHandler) is run.
    346346Through \CFA's trait system the best match at the throw sight will be used.
    347347This function is run and is passed the copied exception. After the default
     
    421421execution continues after the raise statement.
    422422
    423 There is a global @defaultResumptionHandler@ is polymorphic over all
     423There is a global \defaultResumptionHandler{} is polymorphic over all
    424424termination exceptions and preforms a termination throw on the exception.
    425 The @defaultTerminationHandler@ for that raise is matched at the original
    426 raise statement (the resumption @throwResume@) and it can be customized by
    427 introducing a new or better match as well.
     425The \defaultTerminationHandler{} for that raise is matched at the
     426original raise statement (the resumption @throw@\-@Resume@) and it can be
     427customized by introducing a new or better match as well.
    428428
    429429\subsubsection{Resumption Marking}
     
    681681@CoroutineCancelled@ exception, which contains a references to the cancelled
    682682coroutine and the exception used to cancel it.
    683 The resume function also takes the @defaultResumptionHandler@ from the
     683The resume function also takes the \defaultResumptionHandler{} from the
    684684caller's context and passes it to the internal report.
    685685
  • doc/theses/andrew_beach_MMath/implement.tex

    rb984d54 rc65b930  
    1616Virtual types only have one change to their structure: the addition of a
    1717pointer to the virtual table, which is called the \emph{virtual-table pointer}.
    18 Internally, the field is called @virtual_table@.
     18Internally, the field is called \snake{virtual_table}.
    1919The field is fixed after construction. It is always the first field in the
    2020structure so that its location is always known.
     
    124124
    125125\begin{figure}
    126 \begin{cfa}
    127 type_id
    128 parent_field0
    129 ...
    130 parent_fieldN
    131 child_field0
    132 ...
    133 child_fieldN
    134 \end{cfa}
     126\input{vtable-layout}
    135127\caption{Virtual Table Layout}
    136128\label{f:VirtualTableLayout}
     
    171163coroutine Example {
    172164        // fields
    173 }
     165};
    174166\end{cfa}
    175167
     
    329321To get full unwinding support all of this has to be done directly with
    330322assembly and assembler directives. Partiularly the cfi directives
    331 \texttt{.cfi\_lsda} and \texttt{.cfi\_personality}.
     323\snake{.cfi_lsda} and \snake{.cfi_personality}.
    332324
    333325\subsection{Personality Functions}
     
    337329A personality function can preform different actions depending on how it is
    338330called.
    339 \begin{lstlisting}[language=C,{moredelim=**[is][\color{red}]{@}{@}}]
    340 typedef _Unwind_Reason_Code (*@_Unwind_Personality_Fn@) (
    341         _Unwind_Action @action@,
    342         _Unwind_Exception_Class @exception_class@,
    343         _Unwind_Exception * @exception@,
    344         struct _Unwind_Context * @context@
    345 );
     331\begin{lstlisting}
     332typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) (
     333        _Unwind_Action action,
     334        _Unwind_Exception_Class exception_class,
     335        _Unwind_Exception * exception,
     336        struct _Unwind_Context * context);
    346337\end{lstlisting}
    347338The @action@ argument is a bitmask of possible actions:
     
    427418function and the stop parameter. The stop function has a similar interface as a
    428419personality function, except it is also passed the stop parameter.
    429 \begin{lstlisting}[language=C,{moredelim=**[is][\color{red}]{@}{@}}]
    430 typedef _Unwind_Reason_Code (*@_Unwind_Stop_Fn@)(
    431         _Unwind_Action @action@,
    432         _Unwind_Exception_Class @exception_class@,
    433         _Unwind_Exception * @exception@,
    434         struct _Unwind_Context * @context@,
    435         void * @stop_parameter@);
     420\begin{lstlisting}
     421typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(
     422        _Unwind_Action action,
     423        _Unwind_Exception_Class exception_class,
     424        _Unwind_Exception * exception,
     425        struct _Unwind_Context * context,
     426        void * stop_parameter);
    436427\end{lstlisting}
    437428
     
    446437\begin{sloppypar}
    447438Its arguments are the same as the paired personality function. The actions
    448 @_UA_CLEANUP_PHASE@ and @_UA_FORCE_UNWIND@ are always set when it is
     439\snake{_UA_CLEANUP_PHASE} and \snake{_UA_FORCE_UNWIND} are always set when it is
    449440called. Beyond the libunwind standard, both GCC and Clang add an extra action
    450 on the last call at the end of the stack: @_UA_END_OF_STACK@.
     441on the last call at the end of the stack: \snake{_UA_END_OF_STACK}.
    451442\end{sloppypar}
    452443
     
    465456
    466457The exception context should be retrieved by calling the function
    467 @this_exception_context@. For sequential execution, this function is defined as
     458\snake{this_exception_context}.
     459For sequential execution, this function is defined as
    468460a weak symbol in the \CFA system-library, @libcfa@. When a \CFA program is
    469461concurrent, it links with @libcfathread@, where this function is defined with a
     
    493485
    494486\begin{figure}
    495 \begin{verbatim}
    496 Fixed Header  | _Unwind_Exception   <- pointer target
    497               |
    498               | Cforall storage
    499               |
    500 Variable Body | the exception       <- fixed offset
    501               V ...
    502 \end{verbatim}
     487\input{exception-layout}
    503488\caption{Exception Layout}
    504489\label{f:ExceptionLayout}
     
    525510\begin{figure}
    526511\centering
    527 % Andrew: Figure out what these do and give them better names.
    528 \newsavebox{\myboxA}
    529 \newsavebox{\myboxB}
    530 \begin{lrbox}{\myboxA}
     512\newsavebox{\codeBox}
     513\newsavebox{\stackBox}
     514\begin{lrbox}{\codeBox}
    531515\begin{lstlisting}[language=CFA,{moredelim=**[is][\color{red}]{@}{@}}]
    532516unsigned num_exceptions = 0;
     
    551535\end{lrbox}
    552536
    553 \begin{lrbox}{\myboxB}
     537\begin{lrbox}{\stackBox}
    554538\begin{lstlisting}
     539| try-finally
     540| try-catch (Example)
     541throws()
     542| try-finally
     543| try-catch (Example)
     544throws()
     545| try-finally
     546| try-catch (Example)
     547throws()
     548main()
    555549\end{lstlisting}
    556550\end{lrbox}
    557551
    558 {\usebox\myboxA}
     552{\usebox\codeBox}
    559553\hspace{25pt}
    560 {\usebox\myboxB}
     554{\usebox\stackBox}
    561555
    562556\caption{Multiple Exceptions}
     
    647641        {
    648642                Exception1 * name1;
    649                 if (name1 = (virtual Exception1 *)__exception_inst && check(name1)) {
     643                if (name1 = (virtual Exception1 *)__exception_inst
     644                                && check(name1)) {
    650645                        return 1;
    651646                }
     
    732727        {
    733728                Exception1 * name1;
    734                 if (name1 = (virtual Exception1 *)__exception_inst && check(name1)) {
     729                if (name1 = (virtual Exception1 *)__exception_inst
     730                                && check(name1)) {
    735731                        // CATCH BLOCK 1
    736732                        return 1;
     
    775771
    776772\begin{figure}
    777 \begin{minipage}[l][][b]{0,2\textwidth}
    778 \begin{verbatim}
    779 
    780 
    781   X <-
    782   |
    783   V
    784   X
    785   |
    786   V
    787   X
    788 \end{verbatim}
    789 Initial State
    790 \end{minipage}
    791 \begin{minipage}[l][][b]{0,2\textwidth}
    792 \begin{verbatim}
    793 
    794 
    795   X
    796   |
    797   V
    798   X <-
    799   |
    800   V
    801   X
    802 \end{verbatim}
    803 Handler Found
    804 \end{minipage}
    805 \begin{minipage}[l][][b]{0,2\textwidth}
    806 \begin{verbatim}
    807   X <-
    808  /
    809 / X
    810 | |
    811 \ V
    812   X
    813   |
    814   V
    815   X
    816 \end{verbatim}
    817 Try Block Added
    818 \end{minipage}
    819 \begin{minipage}[l][][b]{0,2\textwidth}
    820 \begin{verbatim}
    821 
    822 
    823   X <-
    824   |
    825   V
    826   X
    827   |
    828   V
    829   X
    830 \end{verbatim}
    831 Handler Done
    832 \end{minipage}
     773\input{resumption-marking}
    833774\caption{Resumption Marking}
    834775\label{f:ResumptionMarking}
  • doc/theses/andrew_beach_MMath/uw-ethesis.tex

    rb984d54 rc65b930  
    202202\makeglossaries
    203203
     204% New commands/options for this document alone:
     205% Code snipits with formating and line-breaks.
     206\newcommand\defaultResumptionHandler{\texttt{default\-Resumption\-Handler}}
     207\newcommand\defaultTerminationHandler{\texttt{default\-Termination\-Handler}}
     208
    204209% listings package configuation:
    205210\lstMakeShortInline@
Note: See TracChangeset for help on using the changeset viewer.