Changeset bae0d35


Ignore:
Timestamp:
Jun 7, 2021, 2:09:12 PM (7 months ago)
Author:
caparsons <caparson@…>
Branches:
jacob/cs343-translation, master, new-ast-unique-expr
Children:
5a46e09
Parents:
82f4063 (diff), 53692b3 (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

Files:
6 added
1 deleted
70 edited
1 moved

Legend:

Unmodified
Added
Removed
  • INSTALL

    r82f4063 rbae0d35  
    55g++ version >= 4.6, bison and flex.  On systems where GNU Make is the default
    66make, the system is built by entering the commands:
     7
     8For devs using the root git:
     9
     10  ./autogen.sh
     11        ./configure
     12        make
     13        make install
     14
     15For users using the distributed tarball:
    716
    817        ./configure
  • Jenkins/FullBuild

    r82f4063 rbae0d35  
    1818
    1919                                parallel (
    20                                         gcc_8_x86_new: { trigger_build( 'gcc-8',   'x86', true  ) },
    21                                         gcc_7_x86_new: { trigger_build( 'gcc-7',   'x86', true  ) },
    22                                         gcc_6_x86_new: { trigger_build( 'gcc-6',   'x86', true  ) },
    23                                         gcc_9_x64_new: { trigger_build( 'gcc-9',   'x64', true  ) },
    24                                         gcc_8_x64_new: { trigger_build( 'gcc-8',   'x64', true  ) },
    25                                         gcc_7_x64_new: { trigger_build( 'gcc-7',   'x64', true  ) },
    26                                         gcc_6_x64_new: { trigger_build( 'gcc-6',   'x64', true  ) },
    27                                         gcc_5_x64_new: { trigger_build( 'gcc-5',   'x64', true  ) },
    28                                         clang_x64_new: { trigger_build( 'clang',   'x64', true  ) },
    29                                         clang_x64_old: { trigger_build( 'clang',   'x64', false ) },
     20                                        gcc_8_x86_new: { trigger_build( 'gcc-8',   'x86' ) },
     21                                        gcc_7_x86_new: { trigger_build( 'gcc-7',   'x86' ) },
     22                                        gcc_6_x86_new: { trigger_build( 'gcc-6',   'x86' ) },
     23                                        gcc_9_x64_new: { trigger_build( 'gcc-9',   'x64' ) },
     24                                        gcc_8_x64_new: { trigger_build( 'gcc-8',   'x64' ) },
     25                                        gcc_7_x64_new: { trigger_build( 'gcc-7',   'x64' ) },
     26                                        gcc_6_x64_new: { trigger_build( 'gcc-6',   'x64' ) },
     27                                        gcc_5_x64_new: { trigger_build( 'gcc-5',   'x64' ) },
     28                                        clang_x64_new: { trigger_build( 'clang',   'x64' ) },
    3029                                )
    3130                        }
     
    3332                        stage('Package') {
    3433                                trigger_dist( commitId, currentBuild.number.toString() )
     34                        }
     35
     36                        stage('Promote') {
     37                                trigger_prom()
    3538                        }
    3639                }
     
    6568//===========================================================================================================
    6669
    67 def trigger_build(String cc, String arch, boolean new_ast) {
     70def trigger_build(String cc, String arch) {
    6871        // Randomly delay the builds by a random amount to avoid hitting the SC server to hard
    6972        sleep(time: 5 * Math.random(), unit:"MINUTES")
     
    8184                        [$class: 'BooleanParameterValue',               \
    8285                          name: 'NewAST',                               \
    83                           value: new_ast],                              \
     86                          value: true],                                         \
    8487                        [$class: 'BooleanParameterValue',               \
    8588                          name: 'RunAllTests',                          \
     
    124127}
    125128
     129def trigger_prom() {
     130        def result = build job: 'Cforall_Promote_Ref', propagate: false
     131
     132        echo(result.result)
     133
     134        if(result.result != 'SUCCESS') {
     135                sh("wget -q -O - https://cforall.uwaterloo.ca/jenkins/job/Cforall_Promote_Ref/${result.number}/consoleText")
     136                error(result.result)
     137        }
     138}
     139
    126140//===========================================================================================================
    127141//Routine responsible of sending the email notification once the build is completed
  • Jenkinsfile

    r82f4063 rbae0d35  
    2929                                BuildDir  = pwd tmp: true
    3030                                SrcDir    = pwd tmp: false
     31                                currentBuild.description = "${currentBuild.description} on ${env.NODE_NAME}"
    3132
    3233                                Tools.Clean()
     
    171172                echo "Archiving core dumps"
    172173                dir (BuildDir) {
    173                         archiveArtifacts artifacts: "tests/crashes/**/*,lib/**/lib*.so*", fingerprint: true
     174                        def exists = fileExists 'tests/crashes'
     175                        if( exists ) {
     176                                sh """${SrcDir}/tools/jenkins/archive-gen.sh"""
     177                                archiveArtifacts artifacts: "tests/crashes/**/*,lib/**/lib*.so*,setup.sh", fingerprint: true
     178                        }
    174179                }
    175180                throw err
  • doc/LaTeXmacros/common.sty

    r82f4063 rbae0d35  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat May  8 08:48:35 2021
    14 %% Update Count     : 550
     13%% Last Modified On : Mon May 31 09:08:37 2021
     14%% Update Count     : 565
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    3737
    3838\usepackage{xspace}
    39 \newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}} % Cforall icon
     39\newcommand{\CFAIcon}{\textsf{C\raisebox{\depth}{\rotatebox{180}A}}} % Cforall icon
    4040\newcommand{\CFA}{\protect\CFAIcon\xspace}                              % CFA symbolic name
    4141\newcommand{\CFL}{\textrm{Cforall}\xspace}                              % Cforall non-icon name
     
    7272\setlength{\parindentlnth}{\parindent}
    7373
    74 \usepackage{pslatex}                                    % reduce size of san serif font
    75 \usepackage{relsize}                                    % must be after change to small or selects old size
     74\usepackage{pslatex}                                                                    % reduce size of san serif font
     75\usepackage{relsize}                                                                    % must be after change to small or selects old size
    7676\usepackage{rotating}
     77\usepackage{calc}                                                                               % latex arithmetic
    7778
    7879% reduce size of chapter/section titles
     
    157158\newcommand{\CheckPeriod}{\@ifnextchar{.}{}{.\xspace}}
    158159
    159 \@ifundefined{eg}{
    160160\newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
    161161\newcommand{\eg}{\EG\CheckCommaColon}
    162 }{}%
    163 \@ifundefined{ie}{
     162
    164163\newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
    165164\newcommand{\ie}{\IE\CheckCommaColon}
    166 }{}%
    167 \@ifundefined{etc}{
     165
    168166\newcommand{\ETC}{\abbrevFont{etc}}
    169167\newcommand{\etc}{\ETC\CheckPeriod}
    170 }{}%
    171 \@ifundefined{etal}{
     168
    172169\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
    173170\newcommand{\etal}{\ETAL\CheckPeriod}
    174 }{}%
    175 \@ifundefined{viz}{
     171
    176172\newcommand{\VIZ}{\abbrevFont{viz}}
    177173\newcommand{\viz}{\VIZ\CheckPeriod}
    178 }{}%
    179174
    180175\newenvironment{cquote}{%
     
    238233\usepackage{listings}                                                                   % format program code
    239234\usepackage{lstlang}
    240 \usepackage{calc}                                                                               % latex arithmetic
    241235
    242236\newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{#1}}}
     
    277271numberstyle=\footnotesize\sf,                   % numbering style
    278272% replace/adjust listing characters that look bad in sanserif
    279 literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    280         {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    281         {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
     273literate=
     274  {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
     275  {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     276  {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1
     277  {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
     278  {<-}{$\leftarrow$}2
     279  {=>}{$\Rightarrow$}2
     280  {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
     281defaultdialect={CFA},
    282282}% lstset
    283283}% CFAStyle
     
    308308}{}
    309309% inline code @...@ (at symbol)
     310\makeatother
    310311\lstMakeShortInline@                                    % single-character for \lstinline
     312\makeatletter
    311313\fi%
    312314
  • doc/LaTeXmacros/common.tex

    r82f4063 rbae0d35  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat May  8 08:48:37 2021
    14 %% Update Count     : 540
     13%% Last Modified On : Mon May 31 09:10:49 2021
     14%% Update Count     : 546
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    3737
    3838\usepackage{xspace}
    39 \newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}} % Cforall icon
     39\newcommand{\CFAIcon}{\textsf{C\raisebox{\depth}{\rotatebox{180}A}}} % Cforall icon
    4040\newcommand{\CFA}{\protect\CFAIcon\xspace}                              % CFA symbolic name
    4141\newcommand{\CFL}{\textrm{Cforall}\xspace}                              % Cforall non-icon name
     
    7373\setlength{\parindentlnth}{\parindent}
    7474
    75 \usepackage{pslatex}                                    % reduce size of san serif font
    76 \usepackage{relsize}                                    % must be after change to small or selects old size
     75\usepackage{pslatex}                                                                    % reduce size of san serif font
     76\usepackage{relsize}                                                                    % must be after change to small or selects old size
    7777\usepackage{rotating}
     78\usepackage{calc}                                                                               % latex arithmetic
    7879
    7980% reduce size of chapter/section titles
     
    158159\newcommand{\CheckPeriod}{\@ifnextchar{.}{}{.\xspace}}
    159160
    160 \@ifundefined{eg}{
    161161\newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
    162162\newcommand{\eg}{\EG\CheckCommaColon}
    163 }{}%
    164 \@ifundefined{ie}{
     163
    165164\newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
    166165\newcommand{\ie}{\IE\CheckCommaColon}
    167 }{}%
    168 \@ifundefined{etc}{
     166
    169167\newcommand{\ETC}{\abbrevFont{etc}}
    170168\newcommand{\etc}{\ETC\CheckPeriod}
    171 }{}%
    172 \@ifundefined{etal}{
     169
    173170\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
    174171\newcommand{\etal}{\ETAL\CheckPeriod}
    175 }{}%
    176 \@ifundefined{viz}{
     172
    177173\newcommand{\VIZ}{\abbrevFont{viz}}
    178174\newcommand{\viz}{\VIZ\CheckPeriod}
    179 }{}%
     175
    180176\makeatother
    181177
     
    240236\usepackage{listings}                                                                   % format program code
    241237\usepackage{lstlang}
    242 \usepackage{calc}                                                                               % latex arithmetic
    243238
    244239\makeatletter
     
    281276numberstyle=\footnotesize\sf,                   % numbering style
    282277% replace/adjust listing characters that look bad in sanserif
    283 literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    284         {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    285         {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
     278literate=
     279  {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
     280  {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     281  {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1
     282  {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
     283  {<-}{$\leftarrow$}2
     284  {=>}{$\Rightarrow$}2
     285  {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
     286defaultdialect={CFA},
    286287}% lstset
    287288}% CFAStyle
  • doc/LaTeXmacros/lstlang.sty

    r82f4063 rbae0d35  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Wed Feb 17 09:21:15 2021
    11 %% Update Count     : 27
     10%% Last Modified On : Mon May 31 08:20:41 2021
     11%% Update Count     : 28
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    132132\lstdefinelanguage{uC++}[ANSI]{C++}{
    133133        morekeywords={
    134                 _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _CatchResume, _Cormonitor, _Coroutine, _Disable,
    135                 _Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
    136                 _Resume, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
     134                _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _Catch, _CatchResume, _CorActor, _Cormonitor, _Coroutine,
     135                _Disable, _Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
     136                _Resume, _ResumeTop, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
    137137}
    138138
  • doc/theses/andrew_beach_MMath/existing.tex

    r82f4063 rbae0d35  
    11\chapter{\CFA Existing Features}
    2 
    3 \CFA (C-for-all)~\cite{Cforall} is an open-source project extending ISO C with
     2\label{c:existing}
     3
     4\CFA is an open-source project extending ISO C with
    45modern safety and productivity features, while still ensuring backwards
    56compatibility with C and its programmers.  \CFA is designed to have an
     
    89existing C code-base allowing programmers to learn \CFA on an as-needed basis.
    910
    10 Only those \CFA features pertinent to this thesis are discussed.  Many of the
     11Only those \CFA features pertaining to this thesis are discussed.  Many of the
    1112\CFA syntactic and semantic features used in the thesis should be fairly
    1213obvious to the reader.
     
    2829// name mangling on by default
    2930int i; // _X1ii_1
    30 extern "C" {  // disables name mangling
     31@extern "C"@ {  // disables name mangling
    3132        int j; // j
    32         extern "Cforall" {  // enables name mangling
     33        @extern "Cforall"@ {  // enables name mangling
    3334                int k; // _X1ki_1
    3435        }
     
    4243
    4344\section{Reference Type}
    44 \CFA adds a rebindable reference type to C, but more expressive than the \Cpp
    45 reference.  Multi-level references are allowed and act like auto-dereferenced
    46 pointers using the ampersand (@&@) instead of the pointer asterisk (@*@). \CFA
    47 references may also be mutable or non-mutable. If mutable, a reference variable
    48 may be assigned using the address-of operator (@&@), which converts the
    49 reference to a pointer.
     45\CFA adds a reference type to C as an auto-dereferencing pointer.
     46They work very similarly to pointers.
     47Reference-types are written the same way as a pointer-type but each
     48asterisk (@*@) is replaced with a ampersand (@&@);
     49this includes cv-qualifiers and multiple levels of reference, \eg:
     50
     51\begin{minipage}{0,5\textwidth}
     52With references:
    5053\begin{cfa}
    5154int i, j;
    52 int & ri = i, && rri = ri;
    53 rri = 3;  // auto-dereference assign to i
    54 &ri = &j; // rebindable
    55 ri = 5;   // assign to j
    56 \end{cfa}
    57 
    58 \section{Constructors and Destructors}
    59 
    60 Both constructors and destructors are operators, which means they are
    61 functions with special operator names rather than type names in \Cpp. The
    62 special operator names may be used to call the functions explicitly (not
    63 allowed in \Cpp for constructors).
     55int & ri = i;
     56int && rri = ri;
     57rri = 3;
     58&ri = &j; // reference assignment
     59ri = 5;
     60\end{cfa}
     61\end{minipage}
     62\begin{minipage}{0,5\textwidth}
     63With pointers:
     64\begin{cfa}
     65int i, j;
     66int * pi = &i
     67int ** ppi = &pi;
     68**ppi = 3;
     69pi = &j; // pointer assignment
     70*pi = 5;
     71\end{cfa}
     72\end{minipage}
     73
     74References are intended for cases where you would want to use pointers but would
     75be dereferencing them (almost) every usage.
     76In most cases a reference can just be thought of as a pointer that
     77automatically puts a dereference in front of each of its uses (per-level of
     78reference).
     79The address-of operator (@&@) acts as an escape and removes one of the
     80automatic dereference operations.
     81Mutable references may be assigned by converting them to a pointer
     82with a @&@ and then assigning a pointer to them, as in @&ri = &j;@ above.
     83
     84\section{Operators}
    6485
    6586In general, operator names in \CFA are constructed by bracketing an operator
     
    6990(such as @++?@) and post-fix operations (@?++@).
    7091
    71 The special name for a constructor is @?{}@, which comes from the
    72 initialization syntax in C. That initialation syntax is also the operator
    73 form. \CFA will generate a constructor call each time a variable is declared,
    74 passing the initialization arguments to the constructort.
    75 \begin{cfa}
    76 struct Example { ... };
    77 void ?{}(Example & this) { ... }
    78 {
    79         Example a;
    80         Example b = {};
    81 }
    82 void ?{}(Example & this, char first, int num) { ... }
    83 {
    84         Example c = {'a', 2};
    85 }
    86 \end{cfa}
    87 Both @a@ and @b@ will be initalized with the first constructor (there is no
    88 general way to skip initialation) while @c@ will be initalized with the
    89 second.
     92An operator name may describe any function signature (it is just a name) but
     93only certain signatures may be called in operator form.
     94\begin{cfa}
     95int ?+?( int i, int j, int k ) { return i + j + k; }
     96{
     97        sout | ?+?( 3, 4, 5 ); // no infix form
     98}
     99\end{cfa}
     100Some ``near-misses" for unary/binary operator prototypes generate warnings.
     101
     102Both constructors and destructors are operators, which means they are
     103functions with special operator names rather than type names in \Cpp. The
     104special operator names may be used to call the functions explicitly (not
     105allowed in \Cpp for constructors).
     106
     107The special name for a constructor is @?{}@, where the name @{}@ comes from the
     108initialization syntax in C, \eg @Structure s = {...}@.
     109% That initialization syntax is also the operator form.
     110\CFA generates a constructor call each time a variable is declared,
     111passing the initialization arguments to the constructor.
     112\begin{cfa}
     113struct Structure { ... };
     114void ?{}(Structure & this) { ... }
     115{
     116        Structure a;
     117        Structure b = {};
     118}
     119void ?{}(Structure & this, char first, int num) { ... }
     120{
     121        Structure c = {'a', 2};
     122}
     123\end{cfa}
     124Both @a@ and @b@ are initialized with the first constructor,
     125while @c@ is initialized with the second.
     126Currently, there is no general way to skip initialization.
    90127
    91128% I don't like the \^{} symbol but $^\wedge$ isn't better.
    92 Similarly destructors use the special name @^?{}@ (the @^@ has no special
    93 meaning). They can be called explicatly as well but normally they are
    94 implicitly called on a variable when it goes out of scope.
    95 \begin{cfa}
    96 void ^?{}(Example & this) { ... }
    97 {
    98     Example d;
     129Similarly, destructors use the special name @^?{}@ (the @^@ has no special
     130meaning).  Normally, they are implicitly called on a variable when it goes out
     131of scope but they can be called explicitly as well.
     132\begin{cfa}
     133void ^?{}(Structure & this) { ... }
     134{
     135        Structure d;
    99136} // <- implicit destructor call
    100137\end{cfa}
    101 No operator name is restricted in what function signatures they may be bound
    102 to although most of the forms cannot be called in operator form. Some
    103 ``near-misses" will generate warnings.
    104 
    105 Whenever a type is defined, \CFA will create a default zero-argument
     138
     139Whenever a type is defined, \CFA creates a default zero-argument
    106140constructor, a copy constructor, a series of argument-per-field constructors
    107141and a destructor. All user constructors are defined after this.
     
    127161char capital_a = identity( 'A' );
    128162\end{cfa}
    129 Each use of a polymorphic declaration will resolve its polymorphic parameters
     163Each use of a polymorphic declaration resolves its polymorphic parameters
    130164(in this case, just @T@) to concrete types (@int@ in the first use and @char@
    131165in the second).
     
    133167To allow a polymorphic function to be separately compiled, the type @T@ must be
    134168constrained by the operations used on @T@ in the function body. The @forall@
    135 clauses is augmented with a list of polymorphic variables (local type names)
     169clause is augmented with a list of polymorphic variables (local type names)
    136170and assertions (constraints), which represent the required operations on those
    137171types used in a function, \eg:
    138172\begin{cfa}
    139 forall( T | { void do_once(T); })
     173forall( T | { void do_once(T); } )
    140174void do_twice(T value) {
    141175        do_once(value);
     
    164198void do_once(double y) { ... }
    165199int quadruple(int x) {
    166         void do_once(int y) { y = y * 2; }
    167         do_twice(x);
     200        void do_once(int y) { y = y * 2; } // replace global do_once
     201        do_twice(x); // use local do_once
     202        do_twice(x + 1.5); // use global do_once
    168203        return x;
    169204}
    170205\end{cfa}
    171206Specifically, the complier deduces that @do_twice@'s T is an integer from the
    172 argument @x@. It then looks for the most specific definition matching the
     207argument @x@. It then looks for the most \emph{specific} definition matching the
    173208assertion, which is the nested integral @do_once@ defined within the
    174209function. The matched assertion function is then passed as a function pointer
    175 to @do_twice@ and called within it.
    176 The global definition of @do_once@ is ignored.
     210to @do_twice@ and called within it.  The global definition of @do_once@ is used
     211for the second call because the float-point argument is a better match.
    177212
    178213To avoid typing long lists of assertions, constraints can be collect into
     
    244279Each coroutine has a @main@ function, which takes a reference to a coroutine
    245280object and returns @void@.
    246 \begin{cfa}
     281\begin{cfa}[numbers=left]
    247282void main(CountUp & this) {
    248     for (unsigned int next = 0 ; true ; ++next) {
     283        for (unsigned int next = 0 ; true ; ++next) {
    249284                next = up;
    250285                suspend;$\label{suspend}$
  • doc/theses/andrew_beach_MMath/features.tex

    r82f4063 rbae0d35  
    11\chapter{Exception Features}
     2\label{c:features}
    23
    34This chapter covers the design and user interface of the \CFA
    4 exception-handling mechanism (EHM). % or exception system.
    5 
    6 We will begin with an overview of EHMs in general. It is not a strict
    7 definition of all EHMs nor an exaustive list of all possible features.
    8 However it does cover the most common structure and features found in them.
     5EHM, % or exception system.
     6and begins with a general overview of EHMs. It is not a strict
     7definition of all EHMs nor an exhaustive list of all possible features.
     8However it does cover the most common structures and features found in them.
    99
    1010% We should cover what is an exception handling mechanism and what is an
    1111% exception before this. Probably in the introduction. Some of this could
    1212% move there.
    13 \paragraph{Raise / Handle}
     13\section{Raise / Handle}
    1414An exception operation has two main parts: raise and handle.
    1515These terms are sometimes also known as throw and catch but this work uses
    1616throw/catch as a particular kind of raise/handle.
    17 These are the two parts that the user will write themselves and may
     17These are the two parts that the user writes and may
    1818be the only two pieces of the EHM that have any syntax in the language.
    1919
    20 \subparagraph{Raise}
     20\paragraph{Raise}
    2121The raise is the starting point for exception handling. It marks the beginning
    22 of exception handling by raising an excepion, which passes it to
     22of exception handling by raising an exception, which passes it to
    2323the EHM.
    2424
    2525Some well known examples include the @throw@ statements of \Cpp and Java and
    26 the \code{Python}{raise} statement from Python. In real systems a raise may
    27 preform some other work (such as memory management) but for the
     26the \code{Python}{raise} statement from Python. A raise may
     27perform some other work (such as memory management) but for the
    2828purposes of this overview that can be ignored.
    2929
    30 \subparagraph{Handle}
     30\paragraph{Handle}
    3131The purpose of most exception operations is to run some user code to handle
    3232that exception. This code is given, with some other information, in a handler.
    3333
    3434A handler has three common features: the previously mentioned user code, a
    35 region of code they cover and an exception label/condition that matches
     35region of code they guard, and an exception label/condition that matches
    3636certain exceptions.
    37 Only raises inside the covered region and raising exceptions that match the
     37Only raises inside the guarded region and raising exceptions that match the
    3838label can be handled by a given handler.
    39 Different EHMs will have different rules to pick a handler
    40 if multipe handlers could be used such as ``best match" or ``first found".
     39Different EHMs have different rules to pick a handler,
     40if multiple handlers could be used, such as ``best match" or ``first found".
    4141
    4242The @try@ statements of \Cpp, Java and Python are common examples. All three
    43 also show another common feature of handlers, they are grouped by the covered
     43also show another common feature of handlers, they are grouped by the guarded
    4444region.
    4545
    46 \paragraph{Propagation}
     46\section{Propagation}
    4747After an exception is raised comes what is usually the biggest step for the
    48 EHM: finding and setting up the handler. The propogation from raise to
     48EHM: finding and setting up the handler. The propagation from raise to
    4949handler can be broken up into three different tasks: searching for a handler,
    50 matching against the handler and installing the handler.
    51 
    52 \subparagraph{Searching}
     50matching against the handler, and installing the handler.
     51
     52\paragraph{Searching}
    5353The EHM begins by searching for handlers that might be used to handle
    5454the exception. Searching is usually independent of the exception that was
    55 thrown as it looks for handlers that have the raise site in their covered
     55thrown as it looks for handlers that have the raise site in their guarded
    5656region.
    57 This includes handlers in the current function, as well as any in callers
    58 on the stack that have the function call in their covered region.
    59 
    60 \subparagraph{Matching}
     57This search includes handlers in the current function, as well as any in callers
     58on the stack that have the function call in their guarded region.
     59
     60\paragraph{Matching}
    6161Each handler found has to be matched with the raised exception. The exception
    62 label defines a condition that be use used with exception and decides if
     62label defines a condition that is used with the exception to decide if
    6363there is a match or not.
    6464
    65 In languages where the first match is used this step is intertwined with
    66 searching, a match check is preformed immediately after the search finds
     65In languages where the first match is used, this step is intertwined with
     66searching: a match check is performed immediately after the search finds
    6767a possible handler.
    6868
    69 \subparagraph{Installing}
     69\section{Installing}
    7070After a handler is chosen it must be made ready to run.
    7171The implementation can vary widely to fit with the rest of the
     
    7474case when stack unwinding is involved.
    7575
    76 If a matching handler is not guarantied to be found the EHM will need a
    77 different course of action here in the cases where no handler matches.
    78 This is only required with unchecked exceptions as checked exceptions
    79 (such as in Java) can make than guaranty.
    80 This different action can also be installing a handler but it is usually an
    81 implicat and much more general one.
    82 
    83 \subparagraph{Hierarchy}
     76If a matching handler is not guarantied to be found, the EHM needs a
     77different course of action for the case where no handler matches.
     78This situation only occurs with unchecked exceptions as checked exceptions
     79(such as in Java) can make the guarantee.
     80This unhandled action can abort the program or install a very general handler.
     81
     82\paragraph{Hierarchy}
    8483A common way to organize exceptions is in a hierarchical structure.
    85 This is especially true in object-orientated languages where the
     84This organization is often used in object-orientated languages where the
    8685exception hierarchy is a natural extension of the object hierarchy.
    8786
     
    112111
    113112The EHM can return control to many different places,
    114 the most common are after the handler definition and after the raise.
     113the most common are after the handler definition (termination) and after the raise (resumption).
    115114
    116115\paragraph{Communication}
    117116For effective exception handling, additional information is often passed
    118 from the raise to the handler.
     117from the raise to the handler and back again.
    119118So far only communication of the exceptions' identity has been covered.
    120 A common method is putting fields into the exception instance and giving the
    121 handler access to them.
     119A common communication method is putting fields into the exception instance and giving the
     120handler access to them. References in the exception instance can push data back to the raise.
    122121
    123122\section{Virtuals}
    124123Virtual types and casts are not part of \CFA's EHM nor are they required for
    125124any EHM.
    126 However the \CFA uses a hierarchy built with the virtual system as the basis
    127 for exceptions and exception matching.
    128 
    129 The virtual system would have ideally been part of \CFA before the work
     125However, one of the best ways to support an exception hierarchy is via a virtual system
     126among exceptions and used for exception matching.
     127
     128Ideally, the virtual system would have been part of \CFA before the work
    130129on exception handling began, but unfortunately it was not.
    131 Because of this only the features and framework needed for the EHM were
     130Therefore, only the features and framework needed for the EHM were
    132131designed and implemented. Other features were considered to ensure that
    133 the structure could accomidate other desirable features but they were not
     132the structure could accommodate other desirable features in the future but they were not
    134133implemented.
    135 The rest of this section will only discuss the finalized portion of the
    136 virtual system.
     134The rest of this section discusses the implemented subset of the
     135virtual-system design.
    137136
    138137The virtual system supports multiple ``trees" of types. Each tree is
     
    144143% A type's ancestors are its parent and its parent's ancestors.
    145144% The root type has no ancestors.
    146 % A type's decendents are its children and its children's decendents.
     145% A type's decedents are its children and its children's decedents.
    147146
    148147Every virtual type also has a list of virtual members. Children inherit
     
    150149It is important to note that these are virtual members, not virtual methods
    151150of object-orientated programming, and can be of any type.
     151
     152\PAB{I do not understand these sentences. Can you add an example? $\Rightarrow$
    152153\CFA still supports virtual methods as a special case of virtual members.
    153 Function pointers that take a pointer to the virtual type will be modified
     154Function pointers that take a pointer to the virtual type are modified
    154155with each level of inheritance so that refers to the new type.
    155156This means an object can always be passed to a function in its virtual table
    156 as if it were a method.
     157as if it were a method.}
    157158
    158159Each virtual type has a unique id.
    159 This unique id and all the virtual members are combined
     160This id and all the virtual members are combined
    160161into a virtual table type. Each virtual type has a pointer to a virtual table
    161162as a hidden field.
     163
     164\PAB{God forbid, maybe you need a UML diagram to relate these entities.}
    162165
    163166Up until this point the virtual system is similar to ones found in
    164167object-orientated languages but this where \CFA diverges. Objects encapsulate a
    165168single set of behaviours in each type, universally across the entire program,
    166 and indeed all programs that use that type definition. In this sense the
     169and indeed all programs that use that type definition. In this sense, the
    167170types are ``closed" and cannot be altered.
    168171
    169 In \CFA types do not encapsulate any behaviour. Traits are local and
    170 types can begin to statify a trait, stop satifying a trait or satify the same
     172In \CFA, types do not encapsulate any behaviour. Traits are local and
     173types can begin to satisfy a trait, stop satisfying a trait or satisfy the same
    171174trait in a different way at any lexical location in the program.
    172 In this sense they are ``open" as they can change at any time. This means it
    173 is implossible to pick a single set of functions that repersent the type's
     175In this sense, they are ``open" as they can change at any time. This capability means it
     176is impossible to pick a single set of functions that represent the type's
    174177implementation across the program.
    175178
    176179\CFA side-steps this issue by not having a single virtual table for each
    177 type. A user can define virtual tables which are filled in at their
    178 declaration and given a name. Anywhere that name is visible, even if it was
    179 defined locally inside a function (although that means it will not have a
     180type. A user can define virtual tables that are filled in at their
     181declaration and given a name. Anywhere that name is visible, even if
     182defined locally inside a function (although that means it does not have a
    180183static lifetime), it can be used.
    181 Specifically, a virtual type is ``bound" to a virtual table which
     184Specifically, a virtual type is ``bound" to a virtual table that
    182185sets the virtual members for that object. The virtual members can be accessed
    183186through the object.
    184187
     188\PAB{The above explanation is very good!}
     189
    185190While much of the virtual infrastructure is created, it is currently only used
    186191internally for exception handling. The only user-level feature is the virtual
    187 cast, which is the same as the \Cpp \code{C++}{dynamic_cast}.
     192cast
    188193\label{p:VirtualCast}
    189194\begin{cfa}
    190195(virtual TYPE)EXPRESSION
    191196\end{cfa}
     197which is the same as the \Cpp \code{C++}{dynamic_cast}.
    192198Note, the syntax and semantics matches a C-cast, rather than the function-like
    193199\Cpp syntax for special casts. Both the type of @EXPRESSION@ and @TYPE@ must be
     
    211217\end{cfa}
    212218The trait is defined over two types, the exception type and the virtual table
    213 type. Each exception type should have but a single virtual table type.
    214 Now there are no actual assertions in this trait because the trait system
    215 actually can't express them (adding such assertions would be part of
     219type. Each exception type should have a single virtual table type.
     220There are no actual assertions in this trait because currently the trait system
     221cannot express them (adding such assertions would be part of
    216222completing the virtual system). The imaginary assertions would probably come
    217223from a trait defined by the virtual system, and state that the exception type
    218 is a virtual type, is a decendent of @exception_t@ (the base exception type)
     224is a virtual type, is a descendent of @exception_t@ (the base exception type)
    219225and note its virtual table type.
    220226
     
    235241};
    236242\end{cfa}
    237 Both traits ensure a pair of types are an exception type and its virtual table
     243Both traits ensure a pair of types are an exception type and its virtual table,
    238244and defines one of the two default handlers. The default handlers are used
    239245as fallbacks and are discussed in detail in \vref{s:ExceptionHandling}.
     
    263269\section{Exception Handling}
    264270\label{s:ExceptionHandling}
    265 \CFA provides two kinds of exception handling: termination and resumption.
     271As stated, \CFA provides two kinds of exception handling: termination and resumption.
    266272These twin operations are the core of \CFA's exception handling mechanism.
    267 This section will cover the general patterns shared by the two operations and
    268 then go on to cover the details each individual operation.
     273This section covers the general patterns shared by the two operations and
     274then go on to cover the details of each individual operation.
    269275
    270276Both operations follow the same set of steps.
    271 Both start with the user preforming a raise on an exception.
    272 Then the exception propogates up the stack.
     277Both start with the user performing a raise on an exception.
     278Then the exception propagates up the stack.
    273279If a handler is found the exception is caught and the handler is run.
    274 After that control returns to normal execution.
    275 If the search fails a default handler is run and then control
    276 returns to normal execution after the raise.
     280After that control returns to a point specific to the kind of exception.
     281If the search fails a default handler is run, and if it returns, control
     282continues after the raise. Note, the default handler may further change control flow rather than return.
    277283
    278284This general description covers what the two kinds have in common.
    279 Differences include how propogation is preformed, where exception continues
     285Differences include how propagation is performed, where exception continues
    280286after an exception is caught and handled and which default handler is run.
    281287
    282288\subsection{Termination}
    283289\label{s:Termination}
     290
    284291Termination handling is the familiar kind and used in most programming
    285292languages with exception handling.
    286 It is dynamic, non-local goto. If the raised exception is matched and
    287 handled the stack is unwound and control will (usually) continue the function
     293It is a dynamic, non-local goto. If the raised exception is matched and
     294handled, the stack is unwound and control (usually) continues in the function
    288295on the call stack that defined the handler.
    289296Termination is commonly used when an error has occurred and recovery is
     
    300307termination exception is any type that satisfies the trait
    301308@is_termination_exception@ at the call site.
    302 Through \CFA's trait system the trait functions are implicity passed into the
     309Through \CFA's trait system, the trait functions are implicitly passed into the
    303310throw code and the EHM.
    304311A new @defaultTerminationHandler@ can be defined in any scope to
    305 change the throw's behavior (see below).
    306 
    307 The throw will copy the provided exception into managed memory to ensure
    308 the exception is not destroyed if the stack is unwound.
     312change the throw's behaviour (see below).
     313
     314The throw copies the provided exception into managed memory to ensure
     315the exception is not destroyed when the stack is unwound.
    309316It is the user's responsibility to ensure the original exception is cleaned
    310 up wheither the stack is unwound or not. Allocating it on the stack is
     317up whether the stack is unwound or not. Allocating it on the stack is
    311318usually sufficient.
    312319
    313 Then propogation starts with the search. \CFA uses a ``first match" rule so
    314 matching is preformed with the copied exception as the search continues.
    315 It starts from the throwing function and proceeds to the base of the stack,
     320Then propagation starts the search. \CFA uses a ``first match" rule so
     321matching is performed with the copied exception as the search continues.
     322It starts from the throwing function and proceeds towards the base of the stack,
    316323from callee to caller.
    317324At each stack frame, a check is made for resumption handlers defined by the
     
    326333}
    327334\end{cfa}
    328 When viewed on its own, a try statement will simply execute the statements
    329 in \snake{GUARDED_BLOCK} and when those are finished the try statement finishes.
     335When viewed on its own, a try statement simply executes the statements
     336in \snake{GUARDED_BLOCK} and when those are finished, the try statement finishes.
    330337
    331338However, while the guarded statements are being executed, including any
    332 invoked functions, all the handlers in the statement are now on the search
    333 path. If a termination exception is thrown and not handled further up the
    334 stack they will be matched against the exception.
     339invoked functions, all the handlers in these statements are included on the search
     340path. Hence, if a termination exception is raised, the search includes the added handlers associated with the guarded block and those further up the
     341stack from the guarded block.
    335342
    336343Exception matching checks the handler in each catch clause in the order
    337 they appear, top to bottom. If the representation of the thrown exception type
     344they appear, top to bottom. If the representation of the raised exception type
    338345is the same or a descendant of @EXCEPTION_TYPE@$_i$ then @NAME@$_i$
    339 (if provided) is
    340 bound to a pointer to the exception and the statements in @HANDLER_BLOCK@$_i$
    341 are executed. If control reaches the end of the handler, the exception is
     346(if provided) is bound to a pointer to the exception and the statements in
     347@HANDLER_BLOCK@$_i$ are executed.
     348If control reaches the end of the handler, the exception is
    342349freed and control continues after the try statement.
    343350
    344 If no termination handler is found during the search then the default handler
    345 (\defaultTerminationHandler) is run.
    346 Through \CFA's trait system the best match at the throw sight will be used.
    347 This function is run and is passed the copied exception. After the default
    348 handler is run control continues after the throw statement.
     351If no termination handler is found during the search, the default handler
     352(\defaultTerminationHandler) visible at the raise statement is called.
     353Through \CFA's trait system, the best match at the raise sight is used.
     354This function is run and is passed the copied exception. If the default
     355handler returns, control continues after the throw statement.
    349356
    350357There is a global @defaultTerminationHandler@ that is polymorphic over all
    351 exception types. Since it is so general a more specific handler can be
    352 defined and will be used for those types, effectively overriding the handler
    353 for particular exception type.
     358termination exception types. Since it is so general, a more specific handler can be
     359defined and is used for those types, effectively overriding the handler
     360for a particular exception type.
    354361The global default termination handler performs a cancellation
    355362(see \vref{s:Cancellation}) on the current stack with the copied exception.
     
    361368just as old~\cite{Goodenough75} and is simpler in many ways.
    362369It is a dynamic, non-local function call. If the raised exception is
    363 matched a closure will be taken from up the stack and executed,
    364 after which the raising function will continue executing.
    365 These are most often used when an error occurred and if the error is repaired
    366 then the function can continue.
     370matched a closure is taken from up the stack and executed,
     371after which the raising function continues executing.
     372These are most often used when a potentially repairable error occurs, some handler is found on the stack to fix it, and
     373the raising function can continue with the correction.
     374Another common usage is dynamic event analysis, \eg logging, without disrupting control flow.
     375Note, if an event is raised and there is no interest, control continues normally.
     376
     377\PAB{We also have \lstinline{report} instead of \lstinline{throwResume}, \lstinline{recover} instead of \lstinline{catch}, and \lstinline{fixup} instead of \lstinline{catchResume}.
     378You may or may not want to mention it. You can still stick with \lstinline{catch} and \lstinline{throw/catchResume} in the thesis.}
    367379
    368380A resumption raise is started with the @throwResume@ statement:
     
    375387@is_resumption_exception@ at the call site.
    376388The assertions from this trait are available to
    377 the exception system while handling the exception.
    378 
    379 At run-time, no exception copy is made.
    380 As the stack is not unwound the exception and
    381 any values on the stack will remain in scope while the resumption is handled.
     389the exception system, while handling the exception.
     390
     391Resumption does not need to copy the raised exception, as the stack is not unwound.
     392The exception and
     393any values on the stack remain in scope, while the resumption is handled.
    382394
    383395The EHM then begins propogation. The search starts from the raise in the
    384 resuming function and proceeds to the base of the stack, from callee to caller.
     396resuming function and proceeds towards the base of the stack, from callee to caller.
    385397At each stack frame, a check is made for resumption handlers defined by the
    386398@catchResume@ clauses of a @try@ statement.
     
    397409Note that termination handlers and resumption handlers may be used together
    398410in a single try statement, intermixing @catch@ and @catchResume@ freely.
    399 Each type of handler will only interact with exceptions from the matching
    400 type of raise.
    401 When a try statement is executed it simply executes the statements in the
    402 @GUARDED_BLOCK@ and then finishes.
     411Each type of handler only interacts with exceptions from the matching
     412kind of raise.
     413When a try statement is executed, it simply executes the statements in the
     414@GUARDED_BLOCK@ and then returns.
    403415
    404416However, while the guarded statements are being executed, including any
    405 invoked functions, all the handlers in the statement are now on the search
    406 path. If a resumption exception is reported and not handled further up the
    407 stack they will be matched against the exception.
     417invoked functions, all the handlers in these statements are included on the search
     418path. Hence, if a resumption exception is raised the search includes the added handlers associated with the guarded block and those further up the
     419stack from the guarded block.
    408420
    409421Exception matching checks the handler in each catch clause in the order
    410 they appear, top to bottom. If the representation of the thrown exception type
     422they appear, top to bottom. If the representation of the raised exception type
    411423is the same or a descendant of @EXCEPTION_TYPE@$_i$ then @NAME@$_i$
    412424(if provided) is bound to a pointer to the exception and the statements in
     
    415427the raise statement that raised the handled exception.
    416428
    417 Like termination, if no resumption handler is found, the default handler
    418 visible at the throw statement is called. It will use the best match at the
    419 call sight according to \CFA's overloading rules. The default handler is
     429Like termination, if no resumption handler is found during the search, the default handler
     430(\defaultResumptionHandler) visible at the raise statement is called.
     431It uses the best match at the
     432raise sight according to \CFA's overloading rules. The default handler is
    420433passed the exception given to the throw. When the default handler finishes
    421434execution continues after the raise statement.
    422435
    423 There is a global \defaultResumptionHandler{} is polymorphic over all
    424 termination exceptions and preforms a termination throw on the exception.
    425 The \defaultTerminationHandler{} for that raise is matched at the
    426 original raise statement (the resumption @throw@\-@Resume@) and it can be
     436There is a global \defaultResumptionHandler{} that is polymorphic over all
     437resumption exception types and preforms a termination throw on the exception.
     438The \defaultTerminationHandler{} can be
    427439customized by introducing a new or better match as well.
    428440
    429441\subsubsection{Resumption Marking}
    430442\label{s:ResumptionMarking}
     443
    431444A key difference between resumption and termination is that resumption does
    432445not unwind the stack. A side effect that is that when a handler is matched
    433 and run it's try block (the guarded statements) and every try statement
    434 searched before it are still on the stack. This can lead to the recursive
     446and run, its try block (the guarded statements) and every try statement
     447searched before it are still on the stack. Their existence can lead to the recursive
    435448resumption problem.
    436449
     
    445458}
    446459\end{cfa}
    447 When this code is executed the guarded @throwResume@ will throw, start a
    448 search and match the handler in the @catchResume@ clause. This will be
    449 call and placed on the stack on top of the try-block. The second throw then
    450 throws and will search the same try block and put call another instance of the
    451 same handler leading to an infinite loop.
    452 
    453 This situation is trivial and easy to avoid, but much more complex cycles
     460When this code is executed, the guarded @throwResume@ starts a
     461search and matchs the handler in the @catchResume@ clause. This
     462call is placed on the top of stack above the try-block. The second throw
     463searchs the same try block and puts call another instance of the
     464same handler on the stack leading to an infinite recursion.
     465
     466While this situation is trivial and easy to avoid, much more complex cycles
    454467can form with multiple handlers and different exception types.
    455468
    456 To prevent all of these cases we mark try statements on the stack.
     469To prevent all of these cases, the exception search marks the try statements it visits.
    457470A try statement is marked when a match check is preformed with it and an
    458 exception. The statement will be unmarked when the handling of that exception
     471exception. The statement is unmarked when the handling of that exception
    459472is completed or the search completes without finding a handler.
    460 While a try statement is marked its handlers are never matched, effectify
    461 skipping over it to the next try statement.
     473While a try statement is marked, its handlers are never matched, effectify
     474skipping over them to the next try statement.
    462475
    463476\begin{center}
     
    466479
    467480These rules mirror what happens with termination.
    468 When a termination throw happens in a handler the search will not look at
     481When a termination throw happens in a handler, the search does not look at
    469482any handlers from the original throw to the original catch because that
    470 part of the stack has been unwound.
     483part of the stack is unwound.
    471484A resumption raise in the same situation wants to search the entire stack,
    472 but it will not try to match the exception with try statements in the section
    473 that would have been unwound as they are marked.
    474 
    475 The symmetry between resumption termination is why this pattern was picked.
    476 Other patterns, such as marking just the handlers that caught, also work but
    477 lack the symmetry means there are more rules to remember.
     485but with marking, the search does match exceptions for try statements at equivalent sections
     486that would have been unwound by termination.
     487
     488The symmetry between resumption termination is why this pattern is picked.
     489Other patterns, such as marking just the handlers that caught the exception, also work but
     490lack the symmetry, meaning there are more rules to remember.
    478491
    479492\section{Conditional Catch}
     493
    480494Both termination and resumption handler clauses can be given an additional
    481495condition to further control which exceptions they handle:
     
    490504did not match.
    491505
    492 The condition matching allows finer matching by allowing the match to check
     506The condition matching allows finer matching to check
    493507more kinds of information than just the exception type.
    494508\begin{cfa}
     
    505519// Can't handle a failure relating to f2 here.
    506520\end{cfa}
    507 In this example the file that experianced the IO error is used to decide
     521In this example, the file that experianced the IO error is used to decide
    508522which handler should be run, if any at all.
    509523
     
    534548
    535549\subsection{Comparison with Reraising}
     550
    536551A more popular way to allow handlers to match in more detail is to reraise
    537 the exception after it has been caught if it could not be handled here.
     552the exception after it has been caught, if it could not be handled here.
    538553On the surface these two features seem interchangable.
    539554
    540 If we used @throw;@ to start a termination reraise then these two statements
    541 would have the same behaviour:
     555If @throw@ is used to start a termination reraise then these two statements
     556have the same behaviour:
    542557\begin{cfa}
    543558try {
     
    559574}
    560575\end{cfa}
    561 If there are further handlers after this handler only the first version will
    562 check them. If multiple handlers on a single try block that could handle the
    563 same exception the translations get more complex but they are equivilantly
    564 powerful.
    565 
    566 Until stack unwinding comes into the picture. In termination handling, a
     576However, if there are further handlers after this handler only the first is
     577check. For multiple handlers on a single try block that could handle the
     578same exception, the equivalent translations to conditional catch becomes more complex, resulting is multiple nested try blocks for all possible reraises.
     579So while catch-with-reraise is logically equivilant to conditional catch, there is a lexical explosion for the former.
     580
     581\PAB{I think the following discussion makes an incorrect assumption.
     582A conditional catch CAN happen with the stack unwound.
     583Roy talked about this issue in Section 2.3.3 here: \newline
     584\url{http://plg.uwaterloo.ca/theses/KrischerThesis.pdf}}
     585
     586Specifically for termination handling, a
    567587conditional catch happens before the stack is unwound, but a reraise happens
    568588afterwards. Normally this might only cause you to loose some debug
    569589information you could get from a stack trace (and that can be side stepped
    570590entirely by collecting information during the unwind). But for \CFA there is
    571 another issue, if the exception isn't handled the default handler should be
     591another issue, if the exception is not handled the default handler should be
    572592run at the site of the original raise.
    573593
    574 There are two problems with this: the site of the original raise doesn't
    575 exist anymore and the default handler might not exist anymore. The site will
    576 always be removed as part of the unwinding, often with the entirety of the
     594There are two problems with this: the site of the original raise does not
     595exist anymore and the default handler might not exist anymore. The site is
     596always removed as part of the unwinding, often with the entirety of the
    577597function it was in. The default handler could be a stack allocated nested
    578598function removed during the unwind.
     
    585605\section{Finally Clauses}
    586606\label{s:FinallyClauses}
     607
    587608Finally clauses are used to preform unconditional clean-up when leaving a
    588609scope and are placed at the end of a try statement after any handler clauses:
     
    597618The @FINALLY_BLOCK@ is executed when the try statement is removed from the
    598619stack, including when the @GUARDED_BLOCK@ finishes, any termination handler
    599 finishes or during an unwind.
     620finishes, or during an unwind.
    600621The only time the block is not executed is if the program is exited before
    601622the stack is unwound.
     
    613634
    614635Not all languages with unwinding have finally clauses. Notably \Cpp does
    615 without it as descructors serve a similar role. Although destructors and
    616 finally clauses can be used in many of the same areas they have their own
    617 use cases like top-level functions and lambda functions with closures.
    618 Destructors take a bit more work to set up but are much easier to reuse while
    619 finally clauses are good for one-off uses and
    620 can easily include local information.
     636without it as destructors with RAII serve a similar role. Although destructors and
     637finally clauses have overlapping usage cases, they have their own
     638specializations, like top-level functions and lambda functions with closures.
     639Destructors take more work if a number of unrelated, local variables without destructors or dynamically allocated variables must be passed for de-intialization.
     640Maintaining this destructor during local-block modification is a source of errors.
     641A finally clause places local de-intialization inline with direct access to all local variables.
    621642
    622643\section{Cancellation}
     
    631652raise, this exception is not used in matching only to pass information about
    632653the cause of the cancellation.
    633 (This also means matching cannot fail so there is no default handler.)
     654(This restriction also means matching cannot fail so there is no default handler.)
    634655
    635656After @cancel_stack@ is called the exception is copied into the EHM's memory
    636657and the current stack is
    637 unwound. After that it depends one which stack is being cancelled.
     658unwound.
     659The result of a cancellation depends on the kind of stack that is being unwound.
    638660
    639661\paragraph{Main Stack}
     
    642664After the main stack is unwound there is a program-level abort.
    643665
    644 There are two reasons for this. The first is that it obviously had to do this
     666There are two reasons for this semantics. The first is that it obviously had to do the abort
    645667in a sequential program as there is nothing else to notify and the simplicity
    646668of keeping the same behaviour in sequential and concurrent programs is good.
    647 Also, even in concurrent programs there is no stack that an innate connection
    648 to, so it would have be explicitly managed.
     669\PAB{I do not understand this sentence. $\Rightarrow$ Also, even in concurrent programs, there is no stack that an innate connection
     670to, so it would have be explicitly managed.}
    649671
    650672\paragraph{Thread Stack}
    651673A thread stack is created for a \CFA @thread@ object or object that satisfies
    652674the @is_thread@ trait.
    653 After a thread stack is unwound there exception is stored until another
     675After a thread stack is unwound, the exception is stored until another
    654676thread attempts to join with it. Then the exception @ThreadCancelled@,
    655677which stores a reference to the thread and to the exception passed to the
    656 cancellation, is reported from the join.
     678cancellation, is reported from the join to the joining thread.
    657679There is one difference between an explicit join (with the @join@ function)
    658680and an implicit join (from a destructor call). The explicit join takes the
    659681default handler (@defaultResumptionHandler@) from its calling context while
    660 the implicit join provides its own which does a program abort if the
     682the implicit join provides its own, which does a program abort if the
    661683@ThreadCancelled@ exception cannot be handled.
    662684
    663 Communication is done at join because a thread only has to have to points of
    664 communication with other threads: start and join.
     685\PAB{Communication can occur during the lifetime of a thread using shared variable and \lstinline{waitfor} statements.
     686Are you sure you mean communication here? Maybe you mean synchronization (rendezvous) point. $\Rightarrow$ Communication is done at join because a thread only has two points of
     687communication with other threads: start and join.}
    665688Since a thread must be running to perform a cancellation (and cannot be
    666689cancelled from another stack), the cancellation must be after start and
    667 before the join. So join is the one that we will use.
     690before the join, so join is use.
    668691
    669692% TODO: Find somewhere to discuss unwind collisions.
     
    677700A coroutine stack is created for a @coroutine@ object or object that
    678701satisfies the @is_coroutine@ trait.
    679 After a coroutine stack is unwound control returns to the resume function
    680 that most recently resumed it. The resume statement reports a
    681 @CoroutineCancelled@ exception, which contains a references to the cancelled
     702After a coroutine stack is unwound, control returns to the @resume@ function
     703that most recently resumed it. The resume reports a
     704@CoroutineCancelled@ exception, which contains references to the cancelled
    682705coroutine and the exception used to cancel it.
    683 The resume function also takes the \defaultResumptionHandler{} from the
    684 caller's context and passes it to the internal report.
     706The @resume@ function also takes the \defaultResumptionHandler{} from the
     707caller's context and passes it to the internal cancellation.
    685708
    686709A coroutine knows of two other coroutines, its starter and its last resumer.
    687 The starter has a much more distant connection while the last resumer just
     710The starter has a much more distant connection, while the last resumer just
    688711(in terms of coroutine state) called resume on this coroutine, so the message
    689712is passed to the latter.
  • doc/theses/andrew_beach_MMath/future.tex

    r82f4063 rbae0d35  
    11\chapter{Future Work}
     2\label{c:future}
    23
    34\section{Language Improvements}
  • doc/theses/andrew_beach_MMath/implement.tex

    r82f4063 rbae0d35  
    11\chapter{Implementation}
    2 % Goes over how all the features are implemented.
     2\label{c:implement}
    33
    44The implementation work for this thesis covers two components: the virtual
  • doc/theses/andrew_beach_MMath/intro.tex

    r82f4063 rbae0d35  
    11\chapter{Introduction}
    22
     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
    38% Talk about Cforall and exceptions generally.
     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).
     12Exception handling provides alternative dynamic inter-function control flow.
     13There are two forms of exception handling covered in this thesis:
     14termination, which acts as a multi-level return,
     15and resumption, which is a dynamic function call.
     16Note, termination exception handling is so common it is often assumed to be the only form.
     17Lesser know derivations of inter-function control flow are continuation passing in Lisp~\cite{CommonLisp}.
     18
     19Termination exception handling allows control to return to any previous
     20function on the stack directly, skipping any functions between it and the
     21current function.
     22\begin{center}
     23\input{callreturn}
     24\end{center}
     25
     26Resumption exception handling calls a function, but asks the functions on the
     27stack what function that is.
     28\todo{Add a diagram showing control flow for resumption.}
     29
     30Although a powerful feature, exception handling tends to be complex to set up
     31and expensive to use
     32so they are often limited to unusual or ``exceptional" cases.
     33The classic example of this is error handling, exceptions can be used to
     34remove error handling logic from the main execution path and while paying
     35most of the cost only when the error actually occurs.
     36
     37% Overview of exceptions in Cforall.
     38
     39\PAB{You need section titles here. Don't take them out.}
     40
     41\section{Thesis Overview}
     42
    443This thesis goes over the design and implementation of the exception handling
    544mechanism (EHM) of
    6 \CFA (pernounced sea-for-all, can also be written Cforall or CFA).
    7 Exception handling provides dynamic inter-function control flow. Although
    8 a powerful feature they tend to be expensive to use so they are often limited
    9 to unusual or ``exceptional" cases.
    10 The classic example of this is error handling, exceptions can be used to
    11 remove error handling logic from the main execution path and paying most of
    12 the cost only when the error actually occurs.
    13 
    14 % Overview of exceptions in Cforall.
     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.
    1547The \CFA EHM implements all of the common exception features (or an
    1648equivalent) found in most other EHMs and adds some features of its own.
     
    3365
    3466% A note that yes, that was a very fast overview.
    35 All the design and implementation of all of \CFA's EHM's features are
    36 described in detail later in this thesis, whether they are a common feature
     67The design and implementation of all of \CFA's EHM's features are
     68described in detail throughout this thesis, whether they are a common feature
    3769or one unique to \CFA.
    3870
    3971% The current state of the project and what it contributes.
    40 All of these features have been added to the \CFA implemenation, along with
    41 a suite of test cases.
     72All of these features have been implemented in \CFA, along with
     73a suite of test cases as part of this project.
    4274The implementation techniques are generally applicable in other programming
    43 languages and much of the design is as well, although occationally
    44 replacements for some of \CFA's more unusual feature would have to be found.
     75languages and much of the design is as well.
     76Some parts of the EHM use other features unique to \CFA and these would be
     77harder to replicate in other programming languages.
     78
     79\section{Background}
     80
     81% Talk about other programming languages.
     82Some existing programming languages that include EHMs/exception handling
     83include C++, Java and Python. All three examples focus on termination
     84exceptions which unwind the stack as part of the
     85Exceptions also can replace return codes and return unions.
     86In functional languages will also sometimes fold exceptions into monads.
     87
     88\PAB{You must demonstrate knowledge of background material here.
     89It should be at least a full page.}
     90
     91\section{Contributions}
     92
     93The contributions of this work are:
     94\begin{enumerate}
     95\item Designing \CFA's exception handling mechanism, adapting designs from
     96other programming languages and the creation of new features.
     97\item Implementing stack unwinding and the EHM in \CFA, including updating
     98the 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.
     102\end{enumerate}
     103
     104\todo{I can't figure out a good lead-in to the overview.}
     105Covering the existing \CFA features in \autoref{c:existing}.
     106Then the new features are introduce in \autoref{c:features}, explaining their
     107usage and design.
     108That is followed by the implementation of those features in
     109\autoref{c:implement}.
     110% Future Work \autoref{c:future}
  • doc/theses/thierry_delisle_PhD/thesis/thesis.tex

    r82f4063 rbae0d35  
    193193
    194194% cfa macros used in the document
    195 \usepackage{common}
     195\input{common}
    196196\CFAStyle                                               % CFA code-style for all languages
    197197\lstset{language=CFA,basicstyle=\linespread{0.9}\tt}    % CFA default language
  • doc/user/user.tex

    r82f4063 rbae0d35  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat May  8 08:51:33 2021
    14 %% Update Count     : 5062
     13%% Last Modified On : Mon May 31 09:03:34 2021
     14%% Update Count     : 5071
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    2929\usepackage{epic,eepic}
    3030\usepackage{upquote}                                                                    % switch curled `'" to straight
    31 \usepackage{calc}
    32 \usepackage{varioref}                                                                   % extended references
    3331\usepackage[labelformat=simple,aboveskip=0pt,farskip=0pt]{subfig}
    3432\renewcommand{\thesubfigure}{\alph{subfigure})}
     
    3735\usepackage{mathptmx}                                   % better math font with "times"
    3836\usepackage[usenames]{color}
    39 \usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
    40 \usepackage{breakurl}
    41 
    42 \renewcommand\footnoterule{\kern -3pt\rule{0.3\linewidth}{0.15pt}\kern 2pt}
    43 
    44 \usepackage[pagewise]{lineno}
    45 \renewcommand{\linenumberfont}{\scriptsize\sffamily}
    46 \usepackage[firstpage]{draftwatermark}
    47 \SetWatermarkLightness{0.9}
    48 
    49 % Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
    50 % removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR
    51 % AFTER HYPERREF.
    52 \renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
    53 
    54 \setlength{\topmargin}{-0.45in}                                                 % move running title into header
    55 \setlength{\headsep}{0.25in}
    56 
    57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    58 
    5937\newcommand{\CFALatin}{}
    6038% inline code ©...© (copyright symbol) emacs: C-q M-)
     
    6745\usepackage{common}                                                                             % common CFA document macros
    6846%\input{common}                                                                                 % common CFA document macros
     47\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
     48\usepackage{breakurl}
     49
     50\renewcommand\footnoterule{\kern -3pt\rule{0.3\linewidth}{0.15pt}\kern 2pt}
     51
     52\usepackage[pagewise]{lineno}
     53\renewcommand{\linenumberfont}{\scriptsize\sffamily}
     54\usepackage[firstpage]{draftwatermark}
     55\SetWatermarkLightness{0.9}
     56
     57% Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
     58% removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR
     59% AFTER HYPERREF.
     60\renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
     61
     62\setlength{\topmargin}{-0.45in}                                                 % move running title into header
     63\setlength{\headsep}{0.25in}
     64
     65%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     66
    6967\setlength{\gcolumnposn}{3in}
    7068\CFAStyle                                                                                               % use default CFA format-style
    71 \lstset{language=CFA}                                                                   % CFA default lnaguage
     69%\lstset{language=CFA}                                                                  % CFA default lnaguage
    7270\lstnewenvironment{C++}[1][]                            % use C++ style
    7371{\lstset{language=C++,moredelim=**[is][\protect\color{red}]{®}{®},#1}}
     
    168166In contrast, \CFA has 30 years of hindsight and a clean starting point.
    169167
    170 Like \Index*[C++]{\CC{}}, there may be both an old and new ways to achieve the same effect.
     168Like \Index*[C++]{\CC{}}, there may be both old and new ways to achieve the same effect.
    171169For example, the following programs compare the C, \CFA, and \CC I/O mechanisms, where the programs output the same result.
    172170\begin{center}
     
    260258The signature feature of \CFA is \emph{\Index{overload}able} \Index{parametric-polymorphic} functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name):
    261259\begin{cfa}
    262 ®forall( otype T )® T identity( T val ) { return val; }
     260®forall( T )® T identity( T val ) { return val; }
    263261int forty_two = identity( 42 ); $\C{// T is bound to int, forty\_two == 42}$
    264262\end{cfa}
     
    293291which can be augmented simply with a polymorphic, type-safe, \CFA-overloaded wrappers:
    294292\begin{cfa}
    295 forall( otype T | { int ?<?( T, T ); } ) T * bsearch( T key, const T * arr, size_t size ) {
     293forall( T | { int ?<?( T, T ); } ) T * bsearch( T key, const T * arr, size_t size ) {
    296294        int comp( const void * t1, const void * t2 ) { /* as above with double changed to T */ }
    297295        return (T *)bsearch( &key, arr, size, sizeof(T), comp ); }
    298296
    299 forall( otype T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) {
     297forall( T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) {
    300298        T * result = bsearch( key, arr, size ); $\C{// call first version}$
    301299        return result ? result - arr : size; } $\C{// pointer subtraction includes sizeof(T)}$
     
    532530Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism:
    533531\begin{cfa}
    534 int ®``®otype = 3; $\C{// make keyword an identifier}$
     532int ®``®coroutine = 3; $\C{// make keyword an identifier}$
    535533double ®``®forall = 3.5;
    536534\end{cfa}
     
    613611The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation version is available.
    614612\begin{cfa}
    615 forall( otype T | { void ?{}( T & this, one_t ); T ?*?( T, T ); } )
     613forall( T | { void ?{}( T & this, one_t ); T ?*?( T, T ); } )
    616614T ?®\®?( T ep, unsigned int y );
    617 forall( otype T | { void ?{}( T & this, one_t ); T ?*?( T, T ); } )
     615forall( T | { void ?{}( T & this, one_t ); T ?*?( T, T ); } )
    618616T ?®\®?( T ep, unsigned long int y );
    619617\end{cfa}
     
    865863  case 1:  case 2:  case 3:
    866864        ...
    867         ®// implicit end of switch (break)
    868   ®case 5:
     865        $\R{\LstCommentStyle{// implicit end of switch (break)}}$
     866  case 5:
    869867        ...
    870868        ®fallthru®; $\C{// explicit fall through}$
     
    27782776For example, the C quick-sort is wrapped into the following polymorphic \CFA routine:
    27792777\begin{cfa}
    2780 forall( otype T | { int ?<?( T, T ); } )
     2778forall( T | { int ?<?( T, T ); } )
    27812779void qsort( const T * arr, size_t dimension );
    27822780\end{cfa}
     
    32393237The integration of polymorphism, type assertions, and monomorphic specialization of tuple-assertions are a primary contribution of this thesis to the design of tuples.
    32403238\begin{cfa}
    3241 forall(otype T, dtype U)
     3239forall(T, dtype U)
    32423240void f(T x, U * y);
    32433241
     
    32473245The argument matching algorithm binds ©T© to ©int© and ©U© to ©const char©, and calls the function as normal.
    32483246
    3249 Tuples can contain otype and dtype components.
     3247Tuples can contain polymorphic types.
    32503248For example, a plus operator can be written to add two triples of a type together.
    32513249\begin{cfa}
    3252 forall(otype T | { T ?+?(T, T); })
     3250forall(T | { T ?+?(T, T); })
    32533251[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
    32543252        return [x.0+y.0, x.1+y.1, x.2+y.2];
     
    32683266Furthermore, these calls can be made ambiguous by introducing seemingly different functions.
    32693267\begin{cfa}
    3270 forall(otype T | { T ?+?(T, T); })
     3268forall(T | { T ?+?(T, T); })
    32713269[T, T, T] ?+?([T, T] x, [T, T, T, T]);
    3272 forall(otype T | { T ?+?(T, T); })
     3270forall(T | { T ?+?(T, T); })
    32733271[T, T, T] ?+?(T x, [T, T, T, T, T]);
    32743272\end{cfa}
     
    32943292\begin{cfa}
    32953293int f([int, double], double);
    3296 forall(otype T, otype U | { T f(T, U, U); })
     3294forall(T, U | { T f(T, U, U); })
    32973295void g(T, U);
    32983296g(5, 10.21);
     
    73817379\leavevmode
    73827380\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    7383 forall( otype T | { int ?<?( T, T ); } ) $\C{// location}$
     7381forall( T | { int ?<?( T, T ); } ) $\C{// location}$
    73847382T * bsearch( T key, const T * arr, size_t dim );$\indexc{bsearch}$
    73857383
    7386 forall( otype T | { int ?<?( T, T ); } ) $\C{// position}$
     7384forall( T | { int ?<?( T, T ); } ) $\C{// position}$
    73877385unsigned int bsearch( T key, const T * arr, size_t dim );
    73887386
    7389 forall( otype T | { int ?<?( T, T ); } )
     7387forall( T | { int ?<?( T, T ); } )
    73907388void qsort( const T * arr, size_t dim );$\indexc{qsort}$
    73917389
    7392 forall( otype E | { int ?<?( E, E ); } ) {
     7390forall( E | { int ?<?( E, E ); } ) {
    73937391        E * bsearch( E key, const E * vals, size_t dim );$\indexc{bsearch}$ $\C{// location}$
    73947392        size_t bsearch( E key, const E * vals, size_t dim );$\C{// position}$
     
    73997397}
    74007398
    7401 forall( otype K, otype E | { int ?<?( K, K ); K getKey( const E & ); } ) {
     7399forall( K, E | { int ?<?( K, K ); K getKey( const E & ); } ) {
    74027400        E * bsearch( K key, const E * vals, size_t dim );
    74037401        size_t bsearch( K key, const E * vals, size_t dim );
     
    74087406}
    74097407
    7410 forall( otype E | { int ?<?( E, E ); } ) {
     7408forall( E | { int ?<?( E, E ); } ) {
    74117409        void qsort( E * vals, size_t dim );$\indexc{qsort}$
    74127410}
     
    74287426double abs( double _Complex );
    74297427long double abs( long double _Complex );
    7430 forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
     7428forall( T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
    74317429T abs( T );
    74327430\end{cfa}
     
    74657463\leavevmode
    74667464\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    7467 forall( otype T | { int ?<?( T, T ); } ) T min( T t1, T t2 );$\indexc{min}$
    7468 forall( otype T | { int ?>?( T, T ); } ) T max( T t1, T t2 );$\indexc{max}$
    7469 forall( otype T | { T min( T, T ); T max( T, T ); } ) T clamp( T value, T min_val, T max_val );$\indexc{clamp}$
    7470 forall( otype T ) void swap( T * t1, T * t2 );$\indexc{swap}$
     7465forall( T | { int ?<?( T, T ); } ) T min( T t1, T t2 );$\indexc{min}$
     7466forall( T | { int ?>?( T, T ); } ) T max( T t1, T t2 );$\indexc{max}$
     7467forall( T | { T min( T, T ); T max( T, T ); } ) T clamp( T value, T min_val, T max_val );$\indexc{clamp}$
     7468forall( T ) void swap( T * t1, T * t2 );$\indexc{swap}$
    74717469\end{cfa}
    74727470
  • driver/cc1.cc

    r82f4063 rbae0d35  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov 17 14:27:08 2020
    13 // Update Count     : 414
     12// Last Modified On : Tue Jun  1 23:07:21 2021
     13// Update Count     : 415
    1414//
    1515
     
    199199                                if ( arg == "-D" || arg == "-U" || arg == "-I" || arg == "-MF" || arg == "-MT" || arg == "-MQ" ||
    200200                                         arg == "-include" || arg == "-imacros" || arg == "-idirafter" || arg == "-iprefix" ||
    201                                          arg == "-iwithprefix" || arg == "-iwithprefixbefore" || arg == "-isystem" || arg == "-isysroot" ) {
     201                                         arg == "-iwithprefix" || arg == "-iwithprefixbefore" || arg == "-isystem" || arg == "-isysroot" ||
     202                                         arg == "-dumpbase-ext" || arg == "-dumpbase"
     203                                        ) {
    202204                                        i += 1;
    203205                                        args[nargs++] = argv[i];                        // pass argument along
     
    383385                                // strip inappropriate flags with an argument
    384386
    385                         } else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" ) {
     387                        } else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" || arg == "-dumpdir" ) {
    386388                                i += 1;
    387389                                #ifdef __DEBUG_H__
  • libcfa/src/Makefile.am

    r82f4063 rbae0d35  
    106106
    107107inst_thread_headers_src = \
     108        concurrency/alarm.hfa \
    108109        concurrency/coroutine.hfa \
    109110        concurrency/exception.hfa \
     
    116117thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \
    117118        bits/signal.hfa \
    118         concurrency/alarm.cfa \
    119         concurrency/alarm.hfa \
    120119        concurrency/clib/cfathread.cfa \
    121120        concurrency/CtxSwitch-@ARCHITECTURE@.S \
  • libcfa/src/concurrency/coroutine.cfa

    r82f4063 rbae0d35  
    267267                struct $coroutine * cor = active_coroutine();
    268268
     269                // get the active thread once
     270                $thread * athrd = active_thread();
     271
     272                /* paranoid */ verify( athrd->corctx_flag );
     273                athrd->corctx_flag = false;
     274
    269275                if(cor->state == Primed) {
    270276                        __cfactx_suspend();
  • libcfa/src/concurrency/coroutine.hfa

    r82f4063 rbae0d35  
    8686        src->state = src->state == Halted ? Halted : Blocked;
    8787
     88        // get the active thread once
     89        $thread * athrd = active_thread();
     90
     91        // Mark the coroutine
     92        /* paranoid */ verify( !athrd->corctx_flag );
     93        athrd->corctx_flag = true;
     94
    8895        // set new coroutine that task is executing
    89         active_thread()->curr_cor = dst;
     96        athrd->curr_cor = dst;
    9097
    9198        // context switch to specified coroutine
    92         verify( dst->context.SP );
     99        /* paranoid */ verify( dst->context.SP );
    93100        __cfactx_switch( &src->context, &dst->context );
    94101        // when __cfactx_switch returns we are back in the src coroutine
     102
     103        /* paranoid */ verify( athrd->corctx_flag );
     104        athrd->corctx_flag = false;
    95105
    96106        // set state of new coroutine to active
  • libcfa/src/concurrency/invoke.h

    r82f4063 rbae0d35  
    168168                enum __Preemption_Reason preempted:8;
    169169
     170                bool corctx_flag;
     171
    170172                //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it
    171173
  • libcfa/src/concurrency/kernel.cfa

    r82f4063 rbae0d35  
    413413                /* paranoid */ verify( thrd_dst->context.SP );
    414414                /* paranoid */ verify( thrd_dst->state != Halted );
    415                 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor
    416                 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor
     415                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor
     416                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor
    417417                /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary );
    418418
     
    424424
    425425                /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary );
    426                 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst );
    427                 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst );
     426                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst );
     427                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst );
    428428                /* paranoid */ verify( thrd_dst->context.SP );
    429429                /* paranoid */ verify( thrd_dst->curr_cluster == this->cltr );
  • libcfa/src/concurrency/kernel/startup.cfa

    r82f4063 rbae0d35  
    397397        // make sure the current state is still correct
    398398        /* paranoid */ verify(src->state == Ready);
     399        src->corctx_flag = true;
    399400
    400401        // context switch to specified coroutine
  • libcfa/src/concurrency/thread.cfa

    r82f4063 rbae0d35  
    3232        state = Start;
    3333        preempted = __NO_PREEMPTION;
     34        corctx_flag = false;
    3435        curr_cor = &self_cor;
    3536        self_mon.owner = &this;
  • src/AST/Pass.proto.hpp

    r82f4063 rbae0d35  
    119119        template<typename core_t, typename node_t>
    120120        struct is_valid_previsit {
    121                 using ret_t = decltype( ((core_t*)nullptr)->previsit( (const node_t *)nullptr ) );
     121                using ret_t = decltype( std::declval<core_t*>()->previsit( std::declval<const node_t *>() ) );
    122122
    123123                static constexpr bool value = std::is_void< ret_t >::value ||
  • src/AST/Type.hpp

    r82f4063 rbae0d35  
    402402
    403403        // compact representation used for map lookups.
    404         struct TypeEnvKey { 
    405                 const TypeDecl * base;
    406                 int formal_usage;
    407                 int expr_id;
     404        struct TypeEnvKey {
     405                const TypeDecl * base = nullptr;
     406                int formal_usage = 0;
     407                int expr_id = 0;
    408408
    409409                TypeEnvKey() = default;
     
    440440        const Type * accept( Visitor & v ) const override { return v.visit( this ); }
    441441
    442         std::string typeString() const { 
    443                 if (formal_usage > 0) return std::string("_") + std::to_string(formal_usage) + "_" + std::to_string(expr_id) + "_" + name; 
     442        std::string typeString() const {
     443                if (formal_usage > 0) return std::string("_") + std::to_string(formal_usage) + "_" + std::to_string(expr_id) + "_" + name;
    444444                else return name;
    445445        }
     
    548548                        res = p * res + x.expr_id;
    549549                        return res;
    550                 } 
     550                }
    551551        };
    552552}
  • src/AST/TypeEnvironment.cpp

    r82f4063 rbae0d35  
    115115
    116116void TypeEnvironment::add( const TypeSubstitution & sub ) {
    117         for ( const auto p : sub ) {
     117        for ( const auto & p : sub ) {
    118118                add( EqvClass{ p.first, p.second } );
    119119        }
  • src/CodeTools/ResolvProtoDump.cc

    r82f4063 rbae0d35  
    746746                        // print child scopes
    747747                        ++indent;
    748                         for ( const PassVisitor<ProtoDump>& s : subs ) {
     748                        for ( const ProtoDump & s : subs ) {
    749749                                std::cout << tab << '{' << std::endl;
    750                                 s.pass.print( indent );
     750                                s.print( indent );
    751751                                std::cout << tab << '}' << std::endl;
    752752                        }
  • src/main.cc

    r82f4063 rbae0d35  
    160160#define SIGPARMS int sig __attribute__(( unused )), siginfo_t * sfp __attribute__(( unused )), ucontext_t * cxt __attribute__(( unused ))
    161161
    162 static void Signal( int sig, void (* handler)(SIGPARMS), int flags ) {
    163         struct sigaction act;
    164 
    165         act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
     162static void _Signal(struct sigaction & act, int sig, int flags ) {
    166163        act.sa_flags = flags;
    167164
     
    170167            _exit( EXIT_FAILURE );
    171168        } // if
     169}
     170
     171static void Signal( int sig, void (* handler)(SIGPARMS), int flags ) {
     172        struct sigaction act;
     173        act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
     174        _Signal(act, sig, flags);
     175} // Signal
     176
     177static void Signal( int sig, void (* handler)(int), int flags ) {
     178        struct sigaction act;
     179        act.sa_handler = handler;
     180        _Signal(act, sig, flags);
    172181} // Signal
    173182
     
    202211static void sigAbortHandler( SIGPARMS ) {
    203212        backtrace( 6 );                                                                         // skip first 6 stack frames
    204         Signal( SIGABRT, (void (*)(SIGPARMS))SIG_DFL, SA_SIGINFO );     // reset default signal handler
     213        Signal( SIGABRT, SIG_DFL, SA_SIGINFO ); // reset default signal handler
    205214        raise( SIGABRT );                                                                       // reraise SIGABRT
    206215} // sigAbortHandler
  • tests/.expect/array.txt

    r82f4063 rbae0d35  
    1 array.cfa: In function '_X4mainFi___1':
    2 array.cfa:55:9: note: #pragma message: Compiled
     1array.cfa:52:25: warning: Compiled
  • tests/.expect/cast.txt

    r82f4063 rbae0d35  
    1 cast.cfa: In function '_X4mainFi_iPPKc__1':
    2 cast.cfa:18:9: note: #pragma message: Compiled
     1cast.cfa:16:25: warning: Compiled
  • tests/.expect/expression.txt

    r82f4063 rbae0d35  
    1 expression.cfa: In function '_X4mainFi___1':
    2 expression.cfa:89:9: note: #pragma message: Compiled
     1expression.cfa:86:25: warning: Compiled
  • tests/.expect/forall.txt

    r82f4063 rbae0d35  
    1 forall.cfa: In function '_X4mainFi___1':
    2 forall.cfa:218:9: note: #pragma message: Compiled
     1forall.cfa:216:25: warning: Compiled
  • tests/.expect/identFuncDeclarator.txt

    r82f4063 rbae0d35  
    1 identFuncDeclarator.cfa: In function '_X4mainFi___1':
    2 identFuncDeclarator.cfa:116:9: note: #pragma message: Compiled
     1identFuncDeclarator.cfa:114:25: warning: Compiled
  • tests/.expect/init1-ERROR.nast.txt

    r82f4063 rbae0d35  
     1init1.cfa:134:25: warning: Compiled
    12init1.cfa:56:1 error: Invalid application of existing declaration(s) in expression Untyped Init Expression
    23  Name: rx  InitAlternative: reference to signed int
  • tests/.expect/init1.txt

    r82f4063 rbae0d35  
    1 init1.cfa: In function '_X4mainFi___1':
    2 init1.cfa:136:9: note: #pragma message: Compiled
     1init1.cfa:134:25: warning: Compiled
  • tests/.expect/labelledExit.txt

    r82f4063 rbae0d35  
    1 labelledExit.cfa: In function '_X4mainFi_iPPKc__1':
    2 labelledExit.cfa:183:9: note: #pragma message: Compiled
     1labelledExit.cfa:181:25: warning: Compiled
  • tests/.expect/limits.txt

    r82f4063 rbae0d35  
    1 limits.cfa: In function '_X4mainFi_iPPKc__1':
    2 limits.cfa:154:9: note: #pragma message: Compiled
     1limits.cfa:152:25: warning: Compiled
  • tests/.expect/nested-types-ERR1.txt

    r82f4063 rbae0d35  
     1nested-types.cfa:100:25: warning: Compiled
    12nested-types.cfa:83:1 error: Use of undefined type T
  • tests/.expect/nested-types-ERR2.txt

    r82f4063 rbae0d35  
     1nested-types.cfa:100:25: warning: Compiled
    12nested-types.cfa:86:1 error: Use of undefined global type Z
    23nested-types.cfa:87:1 error: Qualified type requires an aggregate on the left, but has: signed int
  • tests/.expect/nested-types.txt

    r82f4063 rbae0d35  
    1 nested-types.cfa: In function '_X4mainFi___1':
    2 nested-types.cfa:102:9: note: #pragma message: Compiled
     1nested-types.cfa:100:25: warning: Compiled
  • tests/.expect/numericConstants.txt

    r82f4063 rbae0d35  
    1 numericConstants.cfa: In function '_X4mainFi___1':
    2 numericConstants.cfa:68:9: note: #pragma message: Compiled
     1numericConstants.cfa:66:25: warning: Compiled
  • tests/.expect/quasiKeyword.txt

    r82f4063 rbae0d35  
    1 quasiKeyword.cfa: In function '_X4mainFi_iPPKc__1':
    2 quasiKeyword.cfa:56:9: note: #pragma message: Compiled
     1quasiKeyword.cfa:54:25: warning: Compiled
  • tests/.expect/switch.txt

    r82f4063 rbae0d35  
    1 switch.cfa: In function '_X4mainFi___1':
    2 switch.cfa:105:9: note: #pragma message: Compiled
     1switch.cfa:103:25: warning: Compiled
  • tests/.expect/typedefRedef-ERR1.txt

    r82f4063 rbae0d35  
     1typedefRedef.cfa:69:25: warning: Compiled
    12typedefRedef.cfa:4:1 error: Cannot redefine typedef: Foo
    23typedefRedef.cfa:59:1 error: Cannot redefine typedef: ARR
  • tests/.expect/typedefRedef.txt

    r82f4063 rbae0d35  
    1 typedefRedef.cfa: In function '_X4mainFi___1':
    2 typedefRedef.cfa:71:9: note: #pragma message: Compiled
     1typedefRedef.cfa:69:25: warning: Compiled
  • tests/.expect/variableDeclarator.txt

    r82f4063 rbae0d35  
    1 variableDeclarator.cfa: In function '_X4mainFi_iPPKc__1':
    2 variableDeclarator.cfa:182:9: note: #pragma message: Compiled
     1variableDeclarator.cfa:180:25: warning: Compiled
  • tests/Makefile.am

    r82f4063 rbae0d35  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Tue Mar  2 21:39:01 2021
    14 ## Update Count     : 90
     13## Last Modified On : Sat Jun  5 14:49:25 2021
     14## Update Count     : 92
    1515###############################################################################
    1616
     
    173173
    174174SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall \
    175         init1 limits nested-types stdincludes cast labelledExit array quasiKeyword include/includes builtins/sync warnings/self-assignment
     175        init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment
    176176$(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
    177177        $(CFACOMPILE_SYNTAX)
  • tests/array.cfa

    r82f4063 rbae0d35  
    1111// Created On       : Tue Feb 19 21:18:06 2019
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Sun Sep 27 09:05:40 2020
    14 // Update Count     : 4
     13// Last Modified On : Sat Jun  5 10:05:51 2021
     14// Update Count     : 5
    1515//
    1616
     
    5050
    5151int main() {
    52         #if !defined(NO_COMPILED_PRAGMA)
    53                 #pragma message( "Compiled" )   // force non-empty .expect file
    54         #endif
     52    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    5553}
    5654
  • tests/builtins/.expect/sync.txt

    r82f4063 rbae0d35  
    1 builtins/sync.cfa: In function '_X4mainFi___1':
    2 builtins/sync.cfa:358:9: note: #pragma message: Compiled
     1builtins/sync.cfa:356:25: warning: Compiled
  • tests/builtins/sync.cfa

    r82f4063 rbae0d35  
    354354
    355355int main() {
    356         #pragma message( "Compiled" )                   // force non-empty .expect file
     356    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    357357}
  • tests/cast.cfa

    r82f4063 rbae0d35  
    1414//Dummy main
    1515int main( int argc, char const * argv[] ) {
    16         #pragma message( "Compiled" )                   // force non-empty .expect file
     16    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    1717}
  • tests/concurrent/.expect/sleep.txt

    r82f4063 rbae0d35  
    11start
    2 fast loop 0.047
    3 fast loop 0.094
    4 fast loop 0.141
    5 fast loop 0.188
    6 fast loop 0.235
    7 slow loop 0.277
    8 fast loop 0.282
    9 fast loop 0.329
    10 fast loop 0.376
    11 fast loop 0.423
    12 fast loop 0.47
    13 fast loop 0.517
    14 slow loop 0.554
    15 fast loop 0.564
    16 fast loop 0.611
    17 fast loop 0.658
    18 fast loop 0.705
    19 fast loop 0.752
    20 fast loop 0.799
    21 slow loop 0.831
    22 fast loop 0.846
    23 fast loop 0.893
    24 fast loop 0.94
    25 slow loop 1.108
    262done
  • tests/concurrent/sleep.cfa

    r82f4063 rbae0d35  
    77}
    88
     9volatile int counter = 0;
     10
    911thread fast_sleeper {};
    1012void main(fast_sleeper &) {
     
    1214        for(i; 20) {
    1315                sleep(wait);
    14                 sout | acquire | "fast loop" | ((1 + i) * wait);
     16                __atomic_fetch_add( &counter, 1, __ATOMIC_RELAXED );
    1517        }
    1618}
     
    2022        Duration wait = 277`ms;
    2123        for(i; 4) {
    22 
    2324                sleep(wait);
    24                 sout | acquire | "slow loop" | ((1 + i) * wait);
     25                int val = __atomic_add_fetch( &counter, -5, __ATOMIC_RELAXED );
     26                if(val < -9) abort | "Value reached negative value:" | val;
    2527        }
    2628}
  • tests/expression.cfa

    r82f4063 rbae0d35  
    8484        (S)@{2}`mary;
    8585
    86         #if !defined(NO_COMPILED_PRAGMA)
    87                 #pragma message( "Compiled" )   // force non-empty .expect file
    88         #endif
     86    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    8987} // main
  • tests/forall.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Wed May  9 08:48:15 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 08:43:20 2020
    13 // Update Count     : 35
     12// Last Modified On : Sat Jun  5 10:06:08 2021
     13// Update Count     : 36
    1414//
    1515
     
    214214
    215215int main( void ) {
    216         #pragma message( "Compiled" )                   // force non-empty .expect file
     216    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    217217}
    218218
  • tests/identFuncDeclarator.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Wed Aug 17 08:36:34 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 08:20:46 2020
    13 // Update Count     : 5
     12// Last Modified On : Sat Jun  5 10:06:25 2021
     13// Update Count     : 6
    1414//
    1515
     
    112112        int (* const(* const f81)(int))();
    113113
    114         #pragma message( "Compiled" )                   // force non-empty .expect file
     114    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    115115}
    116116
  • tests/include/.expect/includes.nast.txt

    r82f4063 rbae0d35  
    1 include/includes.cfa: In function '_X4mainFi_iPPKc__1':
    2 include/includes.cfa:156:9: note: #pragma message: Compiled
     1include/includes.cfa:154:25: warning: Compiled
  • tests/include/includes.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 25 09:08:26 2021
    13 // Update Count     : 750
     12// Last Modified On : Sat Jun  5 10:06:46 2021
     13// Update Count     : 751
    1414//
    1515
     
    152152
    153153int main( int argc, char const *argv[] ) {
    154         #pragma message( "Compiled" )                                           // force non-empty .expect file
     154    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    155155}
    156156
  • tests/include/stdincludes.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Tue Aug 29 08:26:14 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 08:51:38 2020
    13 // Update Count     : 8
     12// Last Modified On : Sat Jun  5 10:08:11 2021
     13// Update Count     : 9
    1414//
    1515
     
    4848
    4949int main() {
    50         #pragma message( "Compiled" )                   // force non-empty .expect file
     50    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    5151}
    5252
  • tests/init1.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Thu Jul 16 22:00:00 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Oct 11 10:26:50 2020
    13 // Update Count     : 8
     12// Last Modified On : Sat Jun  5 10:06:57 2021
     13// Update Count     : 9
    1414//
    1515
     
    132132
    133133int main() {
    134     #pragma message( "Compiled" )                       // force non-empty .expect file
     134    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    135135}
  • tests/labelledExit.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Wed Aug 10 07:29:39 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 09:01:34 2020
    13 // Update Count     : 12
     12// Last Modified On : Sat Jun  5 10:07:34 2021
     13// Update Count     : 13
    1414//
    1515
     
    179179
    180180int main( int argc, char const *argv[] ) {
    181         #pragma message( "Compiled" )                                           // force non-empty .expect file
     181    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    182182}
    183183
  • tests/limits.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Tue May 10 20:44:20 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 08:45:43 2020
    13 // Update Count     : 10
     12// Last Modified On : Sat Jun  5 10:07:32 2021
     13// Update Count     : 11
    1414//
    1515
     
    150150
    151151int main(int argc, char const *argv[]) {
    152         #pragma message( "Compiled" )                                           // force non-empty .expect file
     152    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    153153}
    154154
  • tests/nested-types.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Mon Jul 9 10:20:03 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 08:48:59 2020
    13 // Update Count     : 6
     12// Last Modified On : Sat Jun  5 10:07:42 2021
     13// Update Count     : 7
    1414//
    1515
     
    9898        // A.N(int) x;  // xxx - should not be an error, but currently is.
    9999
    100         #pragma message( "Compiled" )                   // force non-empty .expect file
     100    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    101101}
    102102
  • tests/numericConstants.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Wed May 24 22:10:36 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 07:55:22 2020
    13 // Update Count     : 7
     12// Last Modified On : Sat Jun  5 10:07:52 2021
     13// Update Count     : 8
    1414//
    1515
     
    6464        0x_1.ffff_ffff_p_128_l;
    6565
    66         #pragma message( "Compiled" )   // force non-empty .expect file
     66    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    6767} // main
    6868
  • tests/pybin/tools.py

    r82f4063 rbae0d35  
    387387        # make a directory for this test
    388388        # mkdir makes the parent directory only so add a dummy
    389         mkdir(os.path.join(dst, name ))
     389        mkdir( os.path.join(dst, "core") )
    390390
    391391        # moves the files
    392392        mv( core, os.path.join(dst, "core" ) )
    393         mv( exe , os.path.join(dst, name   ) )
     393        mv( exe , os.path.join(dst, "exe"  ) )
    394394
    395395        # return explanatory test
  • tests/quasiKeyword.cfa

    r82f4063 rbae0d35  
    88// Created On       : Wed Feb 17 10:33:49 2021
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Sun Feb 21 15:52:04 2021
    11 // Update Count     : 7
     10// Last Modified On : Sat Jun  5 10:07:59 2021
     11// Update Count     : 8
    1212//
    1313
     
    5252        else catch = 3;
    5353
    54         #pragma message( "Compiled" )                                           // force non-empty .expect file
     54    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    5555}
  • tests/switch.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Tue Jul 12 06:50:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 08:35:02 2020
    13 // Update Count     : 43
     12// Last Modified On : Sat Jun  5 10:08:20 2021
     13// Update Count     : 44
    1414//
    1515
     
    101101        } // choose
    102102
    103         #pragma message( "Compiled" )                                           // force non-empty .expect file
     103    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    104104} // main
    105105
  • tests/typedefRedef.cfa

    r82f4063 rbae0d35  
    6767        typedef int *** pt;
    6868
    69         #pragma message( "Compiled" )                   // force non-empty .expect file
     69    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    7070}
  • tests/unified_locking/fast.cfa

    r82f4063 rbae0d35  
    88        fast_lock l;
    99        $thread * id;
    10         size_t sum;
     10        uint32_t sum;
    1111};
    1212
     
    2020}
    2121
    22 unsigned cs() {
     22uint32_t cs() {
    2323        $thread * me = active_thread();
    24         unsigned value = (unsigned)me;
     24        uint32_t value = (uint32_t)me;
    2525        lock(mo.l);
    2626        {
    27                 size_t tsum = mo.sum;
     27                uint32_t tsum = mo.sum;
    2828                mo.id = me;
    2929                yield(random(5));
     
    3636
    3737thread LockCheck {
    38         size_t sum;
     38        uint32_t sum;
    3939};
    4040
     
    5050
    5151int main() {
    52         size_t sum = -32;
     52        uint32_t sum = -32;
    5353        mo.sum = -32;
    5454        processor p[2];
  • tests/unified_locking/timeout_lock.cfa

    r82f4063 rbae0d35  
    11#include <stdio.h>
    2 #include "locks.hfa"
    3 #include "alarm.hfa"
     2#include <locks.hfa>
     3#include <alarm.hfa>
    44#include <stdlib.hfa>
    55#include <thread.hfa>
    6 #include "kernel.cfa"
     6#include <kernel.hfa>
    77
    88multiple_acquisition_lock m, n;
     
    3333
    3434        for ( unsigned int i = 0; i < NoOfTimes + 3; i += 1 ) {
    35             if ( wait( c_m, m, 1000000`ns ) ) { 
     35            if ( wait( c_m, m, 1000000`ns ) ) {
    3636                        // printf("Thread: %p signalled\n", active_thread()); // removed since can't expect non deterministic output
    3737            } else {
     
    7373        processor p[2];
    7474        printf("Start Test 1: surface testing condition variable timeout routines\n");
    75         wait( c_m, 1`ns );                                                                                                              // bool wait( condition_variable(L) & this, Duration duration );       
     75        wait( c_m, 1`ns );                                                                                                              // bool wait( condition_variable(L) & this, Duration duration );
    7676        wait( c_m, 10, 1`ns );                                                                                                  // bool wait( condition_variable(L) & this, uintptr_t info, Duration duration );
    7777        lock(m); wait( c_m, m, 1`ns ); unlock(m);                                                               // bool wait( condition_variable(L) & this, L & l, Duration duration );
  • tests/variableDeclarator.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Wed Aug 17 08:41:42 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 07:46:17 2020
    13 // Update Count     : 13
     12// Last Modified On : Sat Jun  5 10:08:47 2021
     13// Update Count     : 14
    1414//
    1515
     
    178178//Dummy main
    179179int main( int argc, char const * argv[] ) {
    180         #pragma message( "Compiled" )                                           // force non-empty .expect file
     180    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    181181}
    182182
  • tests/warnings/.expect/self-assignment.nast.txt

    r82f4063 rbae0d35  
     1warnings/self-assignment.cfa:34:25: warning: Compiled
    12warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Generated Cast of:
    23  Variable Expression: j: signed int
     
    4647... with resolved type:
    4748  reference to signed int
    48 warnings/self-assignment.cfa: In function '_X4mainFi___1':
    49 warnings/self-assignment.cfa:36:9: note: #pragma message: Compiled
  • tests/warnings/self-assignment.cfa

    r82f4063 rbae0d35  
    1010// Created On       : Thu Mar 1 13:53:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep 27 09:24:34 2020
    13 // Update Count     : 6
     12// Last Modified On : Sat Jun  5 10:08:56 2021
     13// Update Count     : 7
    1414//
    1515
     
    3232        t.s.i = t.s.i;
    3333
    34         #pragma message( "Compiled" )                   // force non-empty .expect file
     34    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
    3535}
    3636
Note: See TracChangeset for help on using the changeset viewer.