Changeset bae0d35
- Timestamp:
- Jun 7, 2021, 2:09:12 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- 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. - Files:
-
- 6 added
- 1 deleted
- 70 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
INSTALL
r82f4063 rbae0d35 5 5 g++ version >= 4.6, bison and flex. On systems where GNU Make is the default 6 6 make, the system is built by entering the commands: 7 8 For devs using the root git: 9 10 ./autogen.sh 11 ./configure 12 make 13 make install 14 15 For users using the distributed tarball: 7 16 8 17 ./configure -
Jenkins/FullBuild
r82f4063 rbae0d35 18 18 19 19 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' ) }, 30 29 ) 31 30 } … … 33 32 stage('Package') { 34 33 trigger_dist( commitId, currentBuild.number.toString() ) 34 } 35 36 stage('Promote') { 37 trigger_prom() 35 38 } 36 39 } … … 65 68 //=========================================================================================================== 66 69 67 def trigger_build(String cc, String arch , boolean new_ast) {70 def trigger_build(String cc, String arch) { 68 71 // Randomly delay the builds by a random amount to avoid hitting the SC server to hard 69 72 sleep(time: 5 * Math.random(), unit:"MINUTES") … … 81 84 [$class: 'BooleanParameterValue', \ 82 85 name: 'NewAST', \ 83 value: new_ast],\86 value: true], \ 84 87 [$class: 'BooleanParameterValue', \ 85 88 name: 'RunAllTests', \ … … 124 127 } 125 128 129 def 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 126 140 //=========================================================================================================== 127 141 //Routine responsible of sending the email notification once the build is completed -
Jenkinsfile
r82f4063 rbae0d35 29 29 BuildDir = pwd tmp: true 30 30 SrcDir = pwd tmp: false 31 currentBuild.description = "${currentBuild.description} on ${env.NODE_NAME}" 31 32 32 33 Tools.Clean() … … 171 172 echo "Archiving core dumps" 172 173 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 } 174 179 } 175 180 throw err -
doc/LaTeXmacros/common.sty
r82f4063 rbae0d35 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sat May 8 08:48:35202114 %% Update Count : 5 5013 %% Last Modified On : Mon May 31 09:08:37 2021 14 %% Update Count : 565 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 37 37 38 38 \usepackage{xspace} 39 \newcommand{\CFAIcon}{\textsf{C }\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}} % Cforall icon39 \newcommand{\CFAIcon}{\textsf{C\raisebox{\depth}{\rotatebox{180}A}}} % Cforall icon 40 40 \newcommand{\CFA}{\protect\CFAIcon\xspace} % CFA symbolic name 41 41 \newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall non-icon name … … 72 72 \setlength{\parindentlnth}{\parindent} 73 73 74 \usepackage{pslatex} % reduce size of san serif font75 \usepackage{relsize} % must be after change to small or selects old size74 \usepackage{pslatex} % reduce size of san serif font 75 \usepackage{relsize} % must be after change to small or selects old size 76 76 \usepackage{rotating} 77 \usepackage{calc} % latex arithmetic 77 78 78 79 % reduce size of chapter/section titles … … 157 158 \newcommand{\CheckPeriod}{\@ifnextchar{.}{}{.\xspace}} 158 159 159 \@ifundefined{eg}{160 160 \newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.} 161 161 \newcommand{\eg}{\EG\CheckCommaColon} 162 }{}% 163 \@ifundefined{ie}{ 162 164 163 \newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.} 165 164 \newcommand{\ie}{\IE\CheckCommaColon} 166 }{}% 167 \@ifundefined{etc}{ 165 168 166 \newcommand{\ETC}{\abbrevFont{etc}} 169 167 \newcommand{\etc}{\ETC\CheckPeriod} 170 }{}% 171 \@ifundefined{etal}{ 168 172 169 \newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}} 173 170 \newcommand{\etal}{\ETAL\CheckPeriod} 174 }{}% 175 \@ifundefined{viz}{ 171 176 172 \newcommand{\VIZ}{\abbrevFont{viz}} 177 173 \newcommand{\viz}{\VIZ\CheckPeriod} 178 }{}%179 174 180 175 \newenvironment{cquote}{% … … 238 233 \usepackage{listings} % format program code 239 234 \usepackage{lstlang} 240 \usepackage{calc} % latex arithmetic241 235 242 236 \newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{#1}}} … … 277 271 numberstyle=\footnotesize\sf, % numbering style 278 272 % 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, 273 literate= 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, 281 defaultdialect={CFA}, 282 282 }% lstset 283 283 }% CFAStyle … … 308 308 }{} 309 309 % inline code @...@ (at symbol) 310 \makeatother 310 311 \lstMakeShortInline@ % single-character for \lstinline 312 \makeatletter 311 313 \fi% 312 314 -
doc/LaTeXmacros/common.tex
r82f4063 rbae0d35 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sat May 8 08:48:37202114 %% Update Count : 54 013 %% Last Modified On : Mon May 31 09:10:49 2021 14 %% Update Count : 546 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 37 37 38 38 \usepackage{xspace} 39 \newcommand{\CFAIcon}{\textsf{C }\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}} % Cforall icon39 \newcommand{\CFAIcon}{\textsf{C\raisebox{\depth}{\rotatebox{180}A}}} % Cforall icon 40 40 \newcommand{\CFA}{\protect\CFAIcon\xspace} % CFA symbolic name 41 41 \newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall non-icon name … … 73 73 \setlength{\parindentlnth}{\parindent} 74 74 75 \usepackage{pslatex} % reduce size of san serif font76 \usepackage{relsize} % must be after change to small or selects old size75 \usepackage{pslatex} % reduce size of san serif font 76 \usepackage{relsize} % must be after change to small or selects old size 77 77 \usepackage{rotating} 78 \usepackage{calc} % latex arithmetic 78 79 79 80 % reduce size of chapter/section titles … … 158 159 \newcommand{\CheckPeriod}{\@ifnextchar{.}{}{.\xspace}} 159 160 160 \@ifundefined{eg}{161 161 \newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.} 162 162 \newcommand{\eg}{\EG\CheckCommaColon} 163 }{}% 164 \@ifundefined{ie}{ 163 165 164 \newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.} 166 165 \newcommand{\ie}{\IE\CheckCommaColon} 167 }{}% 168 \@ifundefined{etc}{ 166 169 167 \newcommand{\ETC}{\abbrevFont{etc}} 170 168 \newcommand{\etc}{\ETC\CheckPeriod} 171 }{}% 172 \@ifundefined{etal}{ 169 173 170 \newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}} 174 171 \newcommand{\etal}{\ETAL\CheckPeriod} 175 }{}% 176 \@ifundefined{viz}{ 172 177 173 \newcommand{\VIZ}{\abbrevFont{viz}} 178 174 \newcommand{\viz}{\VIZ\CheckPeriod} 179 }{}% 175 180 176 \makeatother 181 177 … … 240 236 \usepackage{listings} % format program code 241 237 \usepackage{lstlang} 242 \usepackage{calc} % latex arithmetic243 238 244 239 \makeatletter … … 281 276 numberstyle=\footnotesize\sf, % numbering style 282 277 % 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, 278 literate= 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, 286 defaultdialect={CFA}, 286 287 }% lstset 287 288 }% CFAStyle -
doc/LaTeXmacros/lstlang.sty
r82f4063 rbae0d35 8 8 %% Created On : Sat May 13 16:34:42 2017 9 9 %% Last Modified By : Peter A. Buhr 10 %% Last Modified On : Wed Feb 17 09:21:15202111 %% Update Count : 2 710 %% Last Modified On : Mon May 31 08:20:41 2021 11 %% Update Count : 28 12 12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 13 … … 132 132 \lstdefinelanguage{uC++}[ANSI]{C++}{ 133 133 morekeywords={ 134 _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _Catch Resume, _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}, 137 137 } 138 138 -
doc/theses/andrew_beach_MMath/existing.tex
r82f4063 rbae0d35 1 1 \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 4 5 modern safety and productivity features, while still ensuring backwards 5 6 compatibility with C and its programmers. \CFA is designed to have an … … 8 9 existing C code-base allowing programmers to learn \CFA on an as-needed basis. 9 10 10 Only those \CFA features pert inentto this thesis are discussed. Many of the11 Only those \CFA features pertaining to this thesis are discussed. Many of the 11 12 \CFA syntactic and semantic features used in the thesis should be fairly 12 13 obvious to the reader. … … 28 29 // name mangling on by default 29 30 int i; // _X1ii_1 30 extern "C"{ // disables name mangling31 @extern "C"@ { // disables name mangling 31 32 int j; // j 32 extern "Cforall"{ // enables name mangling33 @extern "Cforall"@ { // enables name mangling 33 34 int k; // _X1ki_1 34 35 } … … 42 43 43 44 \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. 46 They work very similarly to pointers. 47 Reference-types are written the same way as a pointer-type but each 48 asterisk (@*@) is replaced with a ampersand (@&@); 49 this includes cv-qualifiers and multiple levels of reference, \eg: 50 51 \begin{minipage}{0,5\textwidth} 52 With references: 50 53 \begin{cfa} 51 54 int 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). 55 int & ri = i; 56 int && rri = ri; 57 rri = 3; 58 &ri = &j; // reference assignment 59 ri = 5; 60 \end{cfa} 61 \end{minipage} 62 \begin{minipage}{0,5\textwidth} 63 With pointers: 64 \begin{cfa} 65 int i, j; 66 int * pi = &i 67 int ** ppi = π 68 **ppi = 3; 69 pi = &j; // pointer assignment 70 *pi = 5; 71 \end{cfa} 72 \end{minipage} 73 74 References are intended for cases where you would want to use pointers but would 75 be dereferencing them (almost) every usage. 76 In most cases a reference can just be thought of as a pointer that 77 automatically puts a dereference in front of each of its uses (per-level of 78 reference). 79 The address-of operator (@&@) acts as an escape and removes one of the 80 automatic dereference operations. 81 Mutable references may be assigned by converting them to a pointer 82 with a @&@ and then assigning a pointer to them, as in @&ri = &j;@ above. 83 84 \section{Operators} 64 85 65 86 In general, operator names in \CFA are constructed by bracketing an operator … … 69 90 (such as @++?@) and post-fix operations (@?++@). 70 91 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. 92 An operator name may describe any function signature (it is just a name) but 93 only certain signatures may be called in operator form. 94 \begin{cfa} 95 int ?+?( int i, int j, int k ) { return i + j + k; } 96 { 97 sout | ?+?( 3, 4, 5 ); // no infix form 98 } 99 \end{cfa} 100 Some ``near-misses" for unary/binary operator prototypes generate warnings. 101 102 Both constructors and destructors are operators, which means they are 103 functions with special operator names rather than type names in \Cpp. The 104 special operator names may be used to call the functions explicitly (not 105 allowed in \Cpp for constructors). 106 107 The special name for a constructor is @?{}@, where the name @{}@ comes from the 108 initialization 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, 111 passing the initialization arguments to the constructor. 112 \begin{cfa} 113 struct Structure { ... }; 114 void ?{}(Structure & this) { ... } 115 { 116 Structure a; 117 Structure b = {}; 118 } 119 void ?{}(Structure & this, char first, int num) { ... } 120 { 121 Structure c = {'a', 2}; 122 } 123 \end{cfa} 124 Both @a@ and @b@ are initialized with the first constructor, 125 while @c@ is initialized with the second. 126 Currently, there is no general way to skip initialization. 90 127 91 128 % I don't like the \^{} symbol but $^\wedge$ isn't better. 92 Similarly destructors use the special name @^?{}@ (the @^@ has no special93 meaning). They can be called explicatly as well but normally they are94 implicitly called on a variable when it goes out of scope.95 \begin{cfa} 96 void ^?{}( Example & this) { ... }97 { 98 Example d;129 Similarly, destructors use the special name @^?{}@ (the @^@ has no special 130 meaning). Normally, they are implicitly called on a variable when it goes out 131 of scope but they can be called explicitly as well. 132 \begin{cfa} 133 void ^?{}(Structure & this) { ... } 134 { 135 Structure d; 99 136 } // <- implicit destructor call 100 137 \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 139 Whenever a type is defined, \CFA creates a default zero-argument 106 140 constructor, a copy constructor, a series of argument-per-field constructors 107 141 and a destructor. All user constructors are defined after this. … … 127 161 char capital_a = identity( 'A' ); 128 162 \end{cfa} 129 Each use of a polymorphic declaration will resolveits polymorphic parameters163 Each use of a polymorphic declaration resolves its polymorphic parameters 130 164 (in this case, just @T@) to concrete types (@int@ in the first use and @char@ 131 165 in the second). … … 133 167 To allow a polymorphic function to be separately compiled, the type @T@ must be 134 168 constrained by the operations used on @T@ in the function body. The @forall@ 135 clause sis augmented with a list of polymorphic variables (local type names)169 clause is augmented with a list of polymorphic variables (local type names) 136 170 and assertions (constraints), which represent the required operations on those 137 171 types used in a function, \eg: 138 172 \begin{cfa} 139 forall( T | { void do_once(T); } )173 forall( T | { void do_once(T); } ) 140 174 void do_twice(T value) { 141 175 do_once(value); … … 164 198 void do_once(double y) { ... } 165 199 int 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 168 203 return x; 169 204 } 170 205 \end{cfa} 171 206 Specifically, the complier deduces that @do_twice@'s T is an integer from the 172 argument @x@. It then looks for the most specificdefinition matching the207 argument @x@. It then looks for the most \emph{specific} definition matching the 173 208 assertion, which is the nested integral @do_once@ defined within the 174 209 function. 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.210 to @do_twice@ and called within it. The global definition of @do_once@ is used 211 for the second call because the float-point argument is a better match. 177 212 178 213 To avoid typing long lists of assertions, constraints can be collect into … … 244 279 Each coroutine has a @main@ function, which takes a reference to a coroutine 245 280 object and returns @void@. 246 \begin{cfa} 281 \begin{cfa}[numbers=left] 247 282 void main(CountUp & this) { 248 283 for (unsigned int next = 0 ; true ; ++next) { 249 284 next = up; 250 285 suspend;$\label{suspend}$ -
doc/theses/andrew_beach_MMath/features.tex
r82f4063 rbae0d35 1 1 \chapter{Exception Features} 2 \label{c:features} 2 3 3 4 This 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. 5 EHM, % or exception system. 6 and begins with a general overview of EHMs. It is not a strict 7 definition of all EHMs nor an exhaustive list of all possible features. 8 However it does cover the most common structures and features found in them. 9 9 10 10 % We should cover what is an exception handling mechanism and what is an 11 11 % exception before this. Probably in the introduction. Some of this could 12 12 % move there. 13 \ paragraph{Raise / Handle}13 \section{Raise / Handle} 14 14 An exception operation has two main parts: raise and handle. 15 15 These terms are sometimes also known as throw and catch but this work uses 16 16 throw/catch as a particular kind of raise/handle. 17 These are the two parts that the user w ill write themselves and may17 These are the two parts that the user writes and may 18 18 be the only two pieces of the EHM that have any syntax in the language. 19 19 20 \ subparagraph{Raise}20 \paragraph{Raise} 21 21 The raise is the starting point for exception handling. It marks the beginning 22 of exception handling by raising an excep ion, which passes it to22 of exception handling by raising an exception, which passes it to 23 23 the EHM. 24 24 25 25 Some well known examples include the @throw@ statements of \Cpp and Java and 26 the \code{Python}{raise} statement from Python. In real systems araise may27 p reform some other work (such as memory management) but for the26 the \code{Python}{raise} statement from Python. A raise may 27 perform some other work (such as memory management) but for the 28 28 purposes of this overview that can be ignored. 29 29 30 \ subparagraph{Handle}30 \paragraph{Handle} 31 31 The purpose of most exception operations is to run some user code to handle 32 32 that exception. This code is given, with some other information, in a handler. 33 33 34 34 A handler has three common features: the previously mentioned user code, a 35 region of code they coverand an exception label/condition that matches35 region of code they guard, and an exception label/condition that matches 36 36 certain exceptions. 37 Only raises inside the covered region and raising exceptions that match the37 Only raises inside the guarded region and raising exceptions that match the 38 38 label can be handled by a given handler. 39 Different EHMs will have different rules to pick a handler40 if multip e handlers could be usedsuch as ``best match" or ``first found".39 Different EHMs have different rules to pick a handler, 40 if multiple handlers could be used, such as ``best match" or ``first found". 41 41 42 42 The @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 covered43 also show another common feature of handlers, they are grouped by the guarded 44 44 region. 45 45 46 \ paragraph{Propagation}46 \section{Propagation} 47 47 After an exception is raised comes what is usually the biggest step for the 48 EHM: finding and setting up the handler. The prop ogation from raise to48 EHM: finding and setting up the handler. The propagation from raise to 49 49 handler 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}50 matching against the handler, and installing the handler. 51 52 \paragraph{Searching} 53 53 The EHM begins by searching for handlers that might be used to handle 54 54 the exception. Searching is usually independent of the exception that was 55 thrown as it looks for handlers that have the raise site in their covered55 thrown as it looks for handlers that have the raise site in their guarded 56 56 region. 57 This includes handlers in the current function, as well as any in callers58 on the stack that have the function call in their covered region.59 60 \ subparagraph{Matching}57 This search includes handlers in the current function, as well as any in callers 58 on the stack that have the function call in their guarded region. 59 60 \paragraph{Matching} 61 61 Each handler found has to be matched with the raised exception. The exception 62 label defines a condition that be use used with exception and decidesif62 label defines a condition that is used with the exception to decide if 63 63 there is a match or not. 64 64 65 In languages where the first match is used this step is intertwined with66 searching , a match check is preformed immediately after the search finds65 In languages where the first match is used, this step is intertwined with 66 searching: a match check is performed immediately after the search finds 67 67 a possible handler. 68 68 69 \s ubparagraph{Installing}69 \section{Installing} 70 70 After a handler is chosen it must be made ready to run. 71 71 The implementation can vary widely to fit with the rest of the … … 74 74 case when stack unwinding is involved. 75 75 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} 76 If a matching handler is not guarantied to be found, the EHM needs a 77 different course of action for the case where no handler matches. 78 This situation only occurs with unchecked exceptions as checked exceptions 79 (such as in Java) can make the guarantee. 80 This unhandled action can abort the program or install a very general handler. 81 82 \paragraph{Hierarchy} 84 83 A common way to organize exceptions is in a hierarchical structure. 85 This is especially truein object-orientated languages where the84 This organization is often used in object-orientated languages where the 86 85 exception hierarchy is a natural extension of the object hierarchy. 87 86 … … 112 111 113 112 The EHM can return control to many different places, 114 the most common are after the handler definition and after the raise.113 the most common are after the handler definition (termination) and after the raise (resumption). 115 114 116 115 \paragraph{Communication} 117 116 For effective exception handling, additional information is often passed 118 from the raise to the handler .117 from the raise to the handler and back again. 119 118 So far only communication of the exceptions' identity has been covered. 120 A common method is putting fields into the exception instance and giving the121 handler access to them. 119 A common communication method is putting fields into the exception instance and giving the 120 handler access to them. References in the exception instance can push data back to the raise. 122 121 123 122 \section{Virtuals} 124 123 Virtual types and casts are not part of \CFA's EHM nor are they required for 125 124 any EHM. 126 However the \CFA uses a hierarchy built with the virtual system as the basis127 for exceptions andexception matching.128 129 The virtual system would have ideallybeen part of \CFA before the work125 However, one of the best ways to support an exception hierarchy is via a virtual system 126 among exceptions and used for exception matching. 127 128 Ideally, the virtual system would have been part of \CFA before the work 130 129 on exception handling began, but unfortunately it was not. 131 Because of thisonly the features and framework needed for the EHM were130 Therefore, only the features and framework needed for the EHM were 132 131 designed and implemented. Other features were considered to ensure that 133 the structure could accom idate other desirable featuresbut they were not132 the structure could accommodate other desirable features in the future but they were not 134 133 implemented. 135 The rest of this section will only discuss the finalized portionof the136 virtual system.134 The rest of this section discusses the implemented subset of the 135 virtual-system design. 137 136 138 137 The virtual system supports multiple ``trees" of types. Each tree is … … 144 143 % A type's ancestors are its parent and its parent's ancestors. 145 144 % The root type has no ancestors. 146 % A type's dece ndents are its children and its children's decendents.145 % A type's decedents are its children and its children's decedents. 147 146 148 147 Every virtual type also has a list of virtual members. Children inherit … … 150 149 It is important to note that these are virtual members, not virtual methods 151 150 of object-orientated programming, and can be of any type. 151 152 \PAB{I do not understand these sentences. Can you add an example? $\Rightarrow$ 152 153 \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 modified154 Function pointers that take a pointer to the virtual type are modified 154 155 with each level of inheritance so that refers to the new type. 155 156 This means an object can always be passed to a function in its virtual table 156 as if it were a method. 157 as if it were a method.} 157 158 158 159 Each virtual type has a unique id. 159 This uniqueid and all the virtual members are combined160 This id and all the virtual members are combined 160 161 into a virtual table type. Each virtual type has a pointer to a virtual table 161 162 as a hidden field. 163 164 \PAB{God forbid, maybe you need a UML diagram to relate these entities.} 162 165 163 166 Up until this point the virtual system is similar to ones found in 164 167 object-orientated languages but this where \CFA diverges. Objects encapsulate a 165 168 single set of behaviours in each type, universally across the entire program, 166 and indeed all programs that use that type definition. In this sense the169 and indeed all programs that use that type definition. In this sense, the 167 170 types are ``closed" and cannot be altered. 168 171 169 In \CFA types do not encapsulate any behaviour. Traits are local and170 types can begin to s tatify a trait, stop satifying a trait or satify the same172 In \CFA, types do not encapsulate any behaviour. Traits are local and 173 types can begin to satisfy a trait, stop satisfying a trait or satisfy the same 171 174 trait 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. Thismeans it173 is imp lossible to pick a single set of functions that repersent the type's175 In this sense, they are ``open" as they can change at any time. This capability means it 176 is impossible to pick a single set of functions that represent the type's 174 177 implementation across the program. 175 178 176 179 \CFA side-steps this issue by not having a single virtual table for each 177 type. A user can define virtual tables whichare filled in at their178 declaration and given a name. Anywhere that name is visible, even if it was179 defined locally inside a function (although that means it willnot have a180 type. A user can define virtual tables that are filled in at their 181 declaration and given a name. Anywhere that name is visible, even if 182 defined locally inside a function (although that means it does not have a 180 183 static lifetime), it can be used. 181 Specifically, a virtual type is ``bound" to a virtual table which184 Specifically, a virtual type is ``bound" to a virtual table that 182 185 sets the virtual members for that object. The virtual members can be accessed 183 186 through the object. 184 187 188 \PAB{The above explanation is very good!} 189 185 190 While much of the virtual infrastructure is created, it is currently only used 186 191 internally for exception handling. The only user-level feature is the virtual 187 cast , which is the same as the \Cpp \code{C++}{dynamic_cast}.192 cast 188 193 \label{p:VirtualCast} 189 194 \begin{cfa} 190 195 (virtual TYPE)EXPRESSION 191 196 \end{cfa} 197 which is the same as the \Cpp \code{C++}{dynamic_cast}. 192 198 Note, the syntax and semantics matches a C-cast, rather than the function-like 193 199 \Cpp syntax for special casts. Both the type of @EXPRESSION@ and @TYPE@ must be … … 211 217 \end{cfa} 212 218 The trait is defined over two types, the exception type and the virtual table 213 type. Each exception type should have buta single virtual table type.214 Now there are no actual assertions in this trait becausethe trait system215 actually can't express them (adding such assertions would be part of219 type. Each exception type should have a single virtual table type. 220 There are no actual assertions in this trait because currently the trait system 221 cannot express them (adding such assertions would be part of 216 222 completing the virtual system). The imaginary assertions would probably come 217 223 from a trait defined by the virtual system, and state that the exception type 218 is a virtual type, is a de cendent of @exception_t@ (the base exception type)224 is a virtual type, is a descendent of @exception_t@ (the base exception type) 219 225 and note its virtual table type. 220 226 … … 235 241 }; 236 242 \end{cfa} 237 Both traits ensure a pair of types are an exception type and its virtual table 243 Both traits ensure a pair of types are an exception type and its virtual table, 238 244 and defines one of the two default handlers. The default handlers are used 239 245 as fallbacks and are discussed in detail in \vref{s:ExceptionHandling}. … … 263 269 \section{Exception Handling} 264 270 \label{s:ExceptionHandling} 265 \CFA provides two kinds of exception handling: termination and resumption.271 As stated, \CFA provides two kinds of exception handling: termination and resumption. 266 272 These twin operations are the core of \CFA's exception handling mechanism. 267 This section will coverthe general patterns shared by the two operations and268 then go on to cover the details each individual operation.273 This section covers the general patterns shared by the two operations and 274 then go on to cover the details of each individual operation. 269 275 270 276 Both operations follow the same set of steps. 271 Both start with the user p reforming a raise on an exception.272 Then the exception prop ogates up the stack.277 Both start with the user performing a raise on an exception. 278 Then the exception propagates up the stack. 273 279 If 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 thencontrol276 returns to normal execution after the raise.280 After that control returns to a point specific to the kind of exception. 281 If the search fails a default handler is run, and if it returns, control 282 continues after the raise. Note, the default handler may further change control flow rather than return. 277 283 278 284 This general description covers what the two kinds have in common. 279 Differences include how prop ogation is preformed, where exception continues285 Differences include how propagation is performed, where exception continues 280 286 after an exception is caught and handled and which default handler is run. 281 287 282 288 \subsection{Termination} 283 289 \label{s:Termination} 290 284 291 Termination handling is the familiar kind and used in most programming 285 292 languages with exception handling. 286 It is dynamic, non-local goto. If the raised exception is matched and287 handled the stack is unwound and control will (usually) continuethe function293 It is a dynamic, non-local goto. If the raised exception is matched and 294 handled, the stack is unwound and control (usually) continues in the function 288 295 on the call stack that defined the handler. 289 296 Termination is commonly used when an error has occurred and recovery is … … 300 307 termination exception is any type that satisfies the trait 301 308 @is_termination_exception@ at the call site. 302 Through \CFA's trait system the trait functions are implicity passed into the309 Through \CFA's trait system, the trait functions are implicitly passed into the 303 310 throw code and the EHM. 304 311 A new @defaultTerminationHandler@ can be defined in any scope to 305 change the throw's behavio r (see below).306 307 The throw will copythe provided exception into managed memory to ensure308 the exception is not destroyed ifthe stack is unwound.312 change the throw's behaviour (see below). 313 314 The throw copies the provided exception into managed memory to ensure 315 the exception is not destroyed when the stack is unwound. 309 316 It is the user's responsibility to ensure the original exception is cleaned 310 up whe ither the stack is unwound or not. Allocating it on the stack is317 up whether the stack is unwound or not. Allocating it on the stack is 311 318 usually sufficient. 312 319 313 Then prop ogation starts withthe search. \CFA uses a ``first match" rule so314 matching is p reformed with the copied exception as the search continues.315 It starts from the throwing function and proceeds to the base of the stack,320 Then propagation starts the search. \CFA uses a ``first match" rule so 321 matching is performed with the copied exception as the search continues. 322 It starts from the throwing function and proceeds towards the base of the stack, 316 323 from callee to caller. 317 324 At each stack frame, a check is made for resumption handlers defined by the … … 326 333 } 327 334 \end{cfa} 328 When viewed on its own, a try statement will simply executethe statements329 in \snake{GUARDED_BLOCK} and when those are finished the try statement finishes.335 When viewed on its own, a try statement simply executes the statements 336 in \snake{GUARDED_BLOCK} and when those are finished, the try statement finishes. 330 337 331 338 However, while the guarded statements are being executed, including any 332 invoked functions, all the handlers in the statement are nowon the search333 path. If a termination exception is thrown and not handledfurther up the334 stack they will be matched against the exception.339 invoked functions, all the handlers in these statements are included on the search 340 path. Hence, if a termination exception is raised, the search includes the added handlers associated with the guarded block and those further up the 341 stack from the guarded block. 335 342 336 343 Exception matching checks the handler in each catch clause in the order 337 they appear, top to bottom. If the representation of the thrownexception type344 they appear, top to bottom. If the representation of the raised exception type 338 345 is 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 is346 (if provided) is bound to a pointer to the exception and the statements in 347 @HANDLER_BLOCK@$_i$ are executed. 348 If control reaches the end of the handler, the exception is 342 349 freed and control continues after the try statement. 343 350 344 If no termination handler is found during the search thenthe default handler345 (\defaultTerminationHandler) is run.346 Through \CFA's trait system the best match at the throw sight will beused.347 This function is run and is passed the copied exception. Afterthe default348 handler is runcontrol continues after the throw statement.351 If no termination handler is found during the search, the default handler 352 (\defaultTerminationHandler) visible at the raise statement is called. 353 Through \CFA's trait system, the best match at the raise sight is used. 354 This function is run and is passed the copied exception. If the default 355 handler returns, control continues after the throw statement. 349 356 350 357 There is a global @defaultTerminationHandler@ that is polymorphic over all 351 exception types. Since it is so generala more specific handler can be352 defined and will beused for those types, effectively overriding the handler353 for particular exception type.358 termination exception types. Since it is so general, a more specific handler can be 359 defined and is used for those types, effectively overriding the handler 360 for a particular exception type. 354 361 The global default termination handler performs a cancellation 355 362 (see \vref{s:Cancellation}) on the current stack with the copied exception. … … 361 368 just as old~\cite{Goodenough75} and is simpler in many ways. 362 369 It 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. 370 matched a closure is taken from up the stack and executed, 371 after which the raising function continues executing. 372 These are most often used when a potentially repairable error occurs, some handler is found on the stack to fix it, and 373 the raising function can continue with the correction. 374 Another common usage is dynamic event analysis, \eg logging, without disrupting control flow. 375 Note, 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}. 378 You may or may not want to mention it. You can still stick with \lstinline{catch} and \lstinline{throw/catchResume} in the thesis.} 367 379 368 380 A resumption raise is started with the @throwResume@ statement: … … 375 387 @is_resumption_exception@ at the call site. 376 388 The 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 and381 any values on the stack will remain in scopewhile the resumption is handled.389 the exception system, while handling the exception. 390 391 Resumption does not need to copy the raised exception, as the stack is not unwound. 392 The exception and 393 any values on the stack remain in scope, while the resumption is handled. 382 394 383 395 The 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.396 resuming function and proceeds towards the base of the stack, from callee to caller. 385 397 At each stack frame, a check is made for resumption handlers defined by the 386 398 @catchResume@ clauses of a @try@ statement. … … 397 409 Note that termination handlers and resumption handlers may be used together 398 410 in a single try statement, intermixing @catch@ and @catchResume@ freely. 399 Each type of handler will only interactwith exceptions from the matching400 typeof raise.401 When a try statement is executed it simply executes the statements in the402 @GUARDED_BLOCK@ and then finishes.411 Each type of handler only interacts with exceptions from the matching 412 kind of raise. 413 When a try statement is executed, it simply executes the statements in the 414 @GUARDED_BLOCK@ and then returns. 403 415 404 416 However, while the guarded statements are being executed, including any 405 invoked functions, all the handlers in the statement are nowon the search406 path. If a resumption exception is reported and not handledfurther up the407 stack they will be matched against the exception.417 invoked functions, all the handlers in these statements are included on the search 418 path. Hence, if a resumption exception is raised the search includes the added handlers associated with the guarded block and those further up the 419 stack from the guarded block. 408 420 409 421 Exception matching checks the handler in each catch clause in the order 410 they appear, top to bottom. If the representation of the thrownexception type422 they appear, top to bottom. If the representation of the raised exception type 411 423 is the same or a descendant of @EXCEPTION_TYPE@$_i$ then @NAME@$_i$ 412 424 (if provided) is bound to a pointer to the exception and the statements in … … 415 427 the raise statement that raised the handled exception. 416 428 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 429 Like termination, if no resumption handler is found during the search, the default handler 430 (\defaultResumptionHandler) visible at the raise statement is called. 431 It uses the best match at the 432 raise sight according to \CFA's overloading rules. The default handler is 420 433 passed the exception given to the throw. When the default handler finishes 421 434 execution continues after the raise statement. 422 435 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 436 There is a global \defaultResumptionHandler{} that is polymorphic over all 437 resumption exception types and preforms a termination throw on the exception. 438 The \defaultTerminationHandler{} can be 427 439 customized by introducing a new or better match as well. 428 440 429 441 \subsubsection{Resumption Marking} 430 442 \label{s:ResumptionMarking} 443 431 444 A key difference between resumption and termination is that resumption does 432 445 not 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 statement434 searched before it are still on the stack. Th iscan lead to the recursive446 and run, its try block (the guarded statements) and every try statement 447 searched before it are still on the stack. Their existence can lead to the recursive 435 448 resumption problem. 436 449 … … 445 458 } 446 459 \end{cfa} 447 When this code is executed the guarded @throwResume@ will throw, starta448 search and match the handler in the @catchResume@ clause. This will be449 call and placed on the stack on top of the try-block. The second throw then450 throws and will search the same try block and putcall another instance of the451 same handler leading to an infinite loop.452 453 This situation is trivial and easy to avoid, butmuch more complex cycles460 When this code is executed, the guarded @throwResume@ starts a 461 search and matchs the handler in the @catchResume@ clause. This 462 call is placed on the top of stack above the try-block. The second throw 463 searchs the same try block and puts call another instance of the 464 same handler on the stack leading to an infinite recursion. 465 466 While this situation is trivial and easy to avoid, much more complex cycles 454 467 can form with multiple handlers and different exception types. 455 468 456 To prevent all of these cases we mark try statements on the stack.469 To prevent all of these cases, the exception search marks the try statements it visits. 457 470 A try statement is marked when a match check is preformed with it and an 458 exception. The statement will beunmarked when the handling of that exception471 exception. The statement is unmarked when the handling of that exception 459 472 is completed or the search completes without finding a handler. 460 While a try statement is marked its handlers are never matched, effectify461 skipping over itto the next try statement.473 While a try statement is marked, its handlers are never matched, effectify 474 skipping over them to the next try statement. 462 475 463 476 \begin{center} … … 466 479 467 480 These rules mirror what happens with termination. 468 When a termination throw happens in a handler the search willnot look at481 When a termination throw happens in a handler, the search does not look at 469 482 any handlers from the original throw to the original catch because that 470 part of the stack has beenunwound.483 part of the stack is unwound. 471 484 A 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 section473 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 but477 lack the symmetry meansthere are more rules to remember.485 but with marking, the search does match exceptions for try statements at equivalent sections 486 that would have been unwound by termination. 487 488 The symmetry between resumption termination is why this pattern is picked. 489 Other patterns, such as marking just the handlers that caught the exception, also work but 490 lack the symmetry, meaning there are more rules to remember. 478 491 479 492 \section{Conditional Catch} 493 480 494 Both termination and resumption handler clauses can be given an additional 481 495 condition to further control which exceptions they handle: … … 490 504 did not match. 491 505 492 The condition matching allows finer matching by allowing the matchto check506 The condition matching allows finer matching to check 493 507 more kinds of information than just the exception type. 494 508 \begin{cfa} … … 505 519 // Can't handle a failure relating to f2 here. 506 520 \end{cfa} 507 In this example the file that experianced the IO error is used to decide521 In this example, the file that experianced the IO error is used to decide 508 522 which handler should be run, if any at all. 509 523 … … 534 548 535 549 \subsection{Comparison with Reraising} 550 536 551 A 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.552 the exception after it has been caught, if it could not be handled here. 538 553 On the surface these two features seem interchangable. 539 554 540 If we used @throw;@to start a termination reraise then these two statements541 wouldhave the same behaviour:555 If @throw@ is used to start a termination reraise then these two statements 556 have the same behaviour: 542 557 \begin{cfa} 543 558 try { … … 559 574 } 560 575 \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 576 However, if there are further handlers after this handler only the first is 577 check. For multiple handlers on a single try block that could handle the 578 same exception, the equivalent translations to conditional catch becomes more complex, resulting is multiple nested try blocks for all possible reraises. 579 So 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. 582 A conditional catch CAN happen with the stack unwound. 583 Roy talked about this issue in Section 2.3.3 here: \newline 584 \url{http://plg.uwaterloo.ca/theses/KrischerThesis.pdf}} 585 586 Specifically for termination handling, a 567 587 conditional catch happens before the stack is unwound, but a reraise happens 568 588 afterwards. Normally this might only cause you to loose some debug 569 589 information you could get from a stack trace (and that can be side stepped 570 590 entirely by collecting information during the unwind). But for \CFA there is 571 another issue, if the exception is n't handled the default handler should be591 another issue, if the exception is not handled the default handler should be 572 592 run at the site of the original raise. 573 593 574 There are two problems with this: the site of the original raise does n't575 exist anymore and the default handler might not exist anymore. The site will576 always beremoved as part of the unwinding, often with the entirety of the594 There are two problems with this: the site of the original raise does not 595 exist anymore and the default handler might not exist anymore. The site is 596 always removed as part of the unwinding, often with the entirety of the 577 597 function it was in. The default handler could be a stack allocated nested 578 598 function removed during the unwind. … … 585 605 \section{Finally Clauses} 586 606 \label{s:FinallyClauses} 607 587 608 Finally clauses are used to preform unconditional clean-up when leaving a 588 609 scope and are placed at the end of a try statement after any handler clauses: … … 597 618 The @FINALLY_BLOCK@ is executed when the try statement is removed from the 598 619 stack, including when the @GUARDED_BLOCK@ finishes, any termination handler 599 finishes or during an unwind.620 finishes, or during an unwind. 600 621 The only time the block is not executed is if the program is exited before 601 622 the stack is unwound. … … 613 634 614 635 Not all languages with unwinding have finally clauses. Notably \Cpp does 615 without it as des cructorsserve a similar role. Although destructors and616 finally clauses can be used in many of the same areasthey have their own617 use caseslike top-level functions and lambda functions with closures.618 Destructors take a bit more work to set up but are much easier to reuse while619 finally clauses are good for one-off uses and 620 can easily include local information.636 without it as destructors with RAII serve a similar role. Although destructors and 637 finally clauses have overlapping usage cases, they have their own 638 specializations, like top-level functions and lambda functions with closures. 639 Destructors take more work if a number of unrelated, local variables without destructors or dynamically allocated variables must be passed for de-intialization. 640 Maintaining this destructor during local-block modification is a source of errors. 641 A finally clause places local de-intialization inline with direct access to all local variables. 621 642 622 643 \section{Cancellation} … … 631 652 raise, this exception is not used in matching only to pass information about 632 653 the 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.) 634 655 635 656 After @cancel_stack@ is called the exception is copied into the EHM's memory 636 657 and the current stack is 637 unwound. After that it depends one which stack is being cancelled. 658 unwound. 659 The result of a cancellation depends on the kind of stack that is being unwound. 638 660 639 661 \paragraph{Main Stack} … … 642 664 After the main stack is unwound there is a program-level abort. 643 665 644 There are two reasons for this . The first is that it obviously had to do this666 There are two reasons for this semantics. The first is that it obviously had to do the abort 645 667 in a sequential program as there is nothing else to notify and the simplicity 646 668 of keeping the same behaviour in sequential and concurrent programs is good. 647 Also, even in concurrent programsthere is no stack that an innate connection648 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 670 to, so it would have be explicitly managed.} 649 671 650 672 \paragraph{Thread Stack} 651 673 A thread stack is created for a \CFA @thread@ object or object that satisfies 652 674 the @is_thread@ trait. 653 After a thread stack is unwound there exception is stored until another675 After a thread stack is unwound, the exception is stored until another 654 676 thread attempts to join with it. Then the exception @ThreadCancelled@, 655 677 which stores a reference to the thread and to the exception passed to the 656 cancellation, is reported from the join .678 cancellation, is reported from the join to the joining thread. 657 679 There is one difference between an explicit join (with the @join@ function) 658 680 and an implicit join (from a destructor call). The explicit join takes the 659 681 default handler (@defaultResumptionHandler@) from its calling context while 660 the implicit join provides its own which does a program abort if the682 the implicit join provides its own, which does a program abort if the 661 683 @ThreadCancelled@ exception cannot be handled. 662 684 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. 686 Are 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 687 communication with other threads: start and join.} 665 688 Since a thread must be running to perform a cancellation (and cannot be 666 689 cancelled from another stack), the cancellation must be after start and 667 before the join . So join is the one that we willuse.690 before the join, so join is use. 668 691 669 692 % TODO: Find somewhere to discuss unwind collisions. … … 677 700 A coroutine stack is created for a @coroutine@ object or object that 678 701 satisfies the @is_coroutine@ trait. 679 After a coroutine stack is unwound control returns to the resumefunction680 that most recently resumed it. The resume statementreports a681 @CoroutineCancelled@ exception, which contains areferences to the cancelled702 After a coroutine stack is unwound, control returns to the @resume@ function 703 that most recently resumed it. The resume reports a 704 @CoroutineCancelled@ exception, which contains references to the cancelled 682 705 coroutine and the exception used to cancel it. 683 The resumefunction also takes the \defaultResumptionHandler{} from the684 caller's context and passes it to the internal report.706 The @resume@ function also takes the \defaultResumptionHandler{} from the 707 caller's context and passes it to the internal cancellation. 685 708 686 709 A 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 just710 The starter has a much more distant connection, while the last resumer just 688 711 (in terms of coroutine state) called resume on this coroutine, so the message 689 712 is passed to the latter. -
doc/theses/andrew_beach_MMath/future.tex
r82f4063 rbae0d35 1 1 \chapter{Future Work} 2 \label{c:future} 2 3 3 4 \section{Language Improvements} -
doc/theses/andrew_beach_MMath/implement.tex
r82f4063 rbae0d35 1 1 \chapter{Implementation} 2 % Goes over how all the features are implemented. 2 \label{c:implement} 3 3 4 4 The implementation work for this thesis covers two components: the virtual -
doc/theses/andrew_beach_MMath/intro.tex
r82f4063 rbae0d35 1 1 \chapter{Introduction} 2 2 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 3 8 % 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). 12 Exception handling provides alternative dynamic inter-function control flow. 13 There are two forms of exception handling covered in this thesis: 14 termination, which acts as a multi-level return, 15 and resumption, which is a dynamic function call. 16 Note, termination exception handling is so common it is often assumed to be the only form. 17 Lesser know derivations of inter-function control flow are continuation passing in Lisp~\cite{CommonLisp}. 18 19 Termination exception handling allows control to return to any previous 20 function on the stack directly, skipping any functions between it and the 21 current function. 22 \begin{center} 23 \input{callreturn} 24 \end{center} 25 26 Resumption exception handling calls a function, but asks the functions on the 27 stack what function that is. 28 \todo{Add a diagram showing control flow for resumption.} 29 30 Although a powerful feature, exception handling tends to be complex to set up 31 and expensive to use 32 so they are often limited to unusual or ``exceptional" cases. 33 The classic example of this is error handling, exceptions can be used to 34 remove error handling logic from the main execution path and while paying 35 most of the cost only when the error actually occurs. 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 4 43 This thesis goes over the design and implementation of the exception handling 5 44 mechanism (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. 15 47 The \CFA EHM implements all of the common exception features (or an 16 48 equivalent) found in most other EHMs and adds some features of its own. … … 33 65 34 66 % A note that yes, that was a very fast overview. 35 All the design and implementation of all of \CFA's EHM's features are36 described in detail later inthis thesis, whether they are a common feature67 The design and implementation of all of \CFA's EHM's features are 68 described in detail throughout this thesis, whether they are a common feature 37 69 or one unique to \CFA. 38 70 39 71 % The current state of the project and what it contributes. 40 All of these features have been added to the \CFA implemenation, along with41 a suite of test cases .72 All of these features have been implemented in \CFA, along with 73 a suite of test cases as part of this project. 42 74 The 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. 75 languages and much of the design is as well. 76 Some parts of the EHM use other features unique to \CFA and these would be 77 harder to replicate in other programming languages. 78 79 \section{Background} 80 81 % Talk about other programming languages. 82 Some existing programming languages that include EHMs/exception handling 83 include C++, Java and Python. All three examples focus on termination 84 exceptions which unwind the stack as part of the 85 Exceptions also can replace return codes and return unions. 86 In functional languages will also sometimes fold exceptions into monads. 87 88 \PAB{You must demonstrate knowledge of background material here. 89 It should be at least a full page.} 90 91 \section{Contributions} 92 93 The contributions of this work are: 94 \begin{enumerate} 95 \item Designing \CFA's exception handling mechanism, adapting designs from 96 other programming languages and the creation of new features. 97 \item Implementing stack unwinding and the EHM in \CFA, including updating 98 the compiler and the run-time environment. 99 \item Designed and implemented a prototype virtual system. 100 % I think the virtual system and per-call site default handlers are the only 101 % "new" features, everything else is a matter of implementation. 102 \end{enumerate} 103 104 \todo{I can't figure out a good lead-in to the overview.} 105 Covering the existing \CFA features in \autoref{c:existing}. 106 Then the new features are introduce in \autoref{c:features}, explaining their 107 usage and design. 108 That is followed by the implementation of those features in 109 \autoref{c:implement}. 110 % Future Work \autoref{c:future} -
doc/theses/thierry_delisle_PhD/thesis/thesis.tex
r82f4063 rbae0d35 193 193 194 194 % cfa macros used in the document 195 \ usepackage{common}195 \input{common} 196 196 \CFAStyle % CFA code-style for all languages 197 197 \lstset{language=CFA,basicstyle=\linespread{0.9}\tt} % CFA default language -
doc/user/user.tex
r82f4063 rbae0d35 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sat May 8 08:51:33202114 %% Update Count : 50 6213 %% Last Modified On : Mon May 31 09:03:34 2021 14 %% Update Count : 5071 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 29 29 \usepackage{epic,eepic} 30 30 \usepackage{upquote} % switch curled `'" to straight 31 \usepackage{calc}32 \usepackage{varioref} % extended references33 31 \usepackage[labelformat=simple,aboveskip=0pt,farskip=0pt]{subfig} 34 32 \renewcommand{\thesubfigure}{\alph{subfigure})} … … 37 35 \usepackage{mathptmx} % better math font with "times" 38 36 \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 underscore50 % removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR51 % AFTER HYPERREF.52 \renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}53 54 \setlength{\topmargin}{-0.45in} % move running title into header55 \setlength{\headsep}{0.25in}56 57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%58 59 37 \newcommand{\CFALatin}{} 60 38 % inline code ©...© (copyright symbol) emacs: C-q M-) … … 67 45 \usepackage{common} % common CFA document macros 68 46 %\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 69 67 \setlength{\gcolumnposn}{3in} 70 68 \CFAStyle % use default CFA format-style 71 \lstset{language=CFA} % CFA default lnaguage69 %\lstset{language=CFA} % CFA default lnaguage 72 70 \lstnewenvironment{C++}[1][] % use C++ style 73 71 {\lstset{language=C++,moredelim=**[is][\protect\color{red}]{®}{®},#1}} … … 168 166 In contrast, \CFA has 30 years of hindsight and a clean starting point. 169 167 170 Like \Index*[C++]{\CC{}}, there may be both anold and new ways to achieve the same effect.168 Like \Index*[C++]{\CC{}}, there may be both old and new ways to achieve the same effect. 171 169 For example, the following programs compare the C, \CFA, and \CC I/O mechanisms, where the programs output the same result. 172 170 \begin{center} … … 260 258 The 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): 261 259 \begin{cfa} 262 ®forall( otypeT )® T identity( T val ) { return val; }260 ®forall( T )® T identity( T val ) { return val; } 263 261 int forty_two = identity( 42 ); $\C{// T is bound to int, forty\_two == 42}$ 264 262 \end{cfa} … … 293 291 which can be augmented simply with a polymorphic, type-safe, \CFA-overloaded wrappers: 294 292 \begin{cfa} 295 forall( otypeT | { int ?<?( T, T ); } ) T * bsearch( T key, const T * arr, size_t size ) {293 forall( T | { int ?<?( T, T ); } ) T * bsearch( T key, const T * arr, size_t size ) { 296 294 int comp( const void * t1, const void * t2 ) { /* as above with double changed to T */ } 297 295 return (T *)bsearch( &key, arr, size, sizeof(T), comp ); } 298 296 299 forall( otypeT | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) {297 forall( T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) { 300 298 T * result = bsearch( key, arr, size ); $\C{// call first version}$ 301 299 return result ? result - arr : size; } $\C{// pointer subtraction includes sizeof(T)}$ … … 532 530 Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism: 533 531 \begin{cfa} 534 int ®``® otype = 3; $\C{// make keyword an identifier}$532 int ®``®coroutine = 3; $\C{// make keyword an identifier}$ 535 533 double ®``®forall = 3.5; 536 534 \end{cfa} … … 613 611 The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation version is available. 614 612 \begin{cfa} 615 forall( otypeT | { void ?{}( T & this, one_t ); T ?*?( T, T ); } )613 forall( T | { void ?{}( T & this, one_t ); T ?*?( T, T ); } ) 616 614 T ?®\®?( T ep, unsigned int y ); 617 forall( otypeT | { void ?{}( T & this, one_t ); T ?*?( T, T ); } )615 forall( T | { void ?{}( T & this, one_t ); T ?*?( T, T ); } ) 618 616 T ?®\®?( T ep, unsigned long int y ); 619 617 \end{cfa} … … 865 863 case 1: case 2: case 3: 866 864 ... 867 ®// implicit end of switch (break)868 ®case 5:865 $\R{\LstCommentStyle{// implicit end of switch (break)}}$ 866 case 5: 869 867 ... 870 868 ®fallthru®; $\C{// explicit fall through}$ … … 2778 2776 For example, the C quick-sort is wrapped into the following polymorphic \CFA routine: 2779 2777 \begin{cfa} 2780 forall( otypeT | { int ?<?( T, T ); } )2778 forall( T | { int ?<?( T, T ); } ) 2781 2779 void qsort( const T * arr, size_t dimension ); 2782 2780 \end{cfa} … … 3239 3237 The integration of polymorphism, type assertions, and monomorphic specialization of tuple-assertions are a primary contribution of this thesis to the design of tuples. 3240 3238 \begin{cfa} 3241 forall( otypeT, dtype U)3239 forall(T, dtype U) 3242 3240 void f(T x, U * y); 3243 3241 … … 3247 3245 The argument matching algorithm binds ©T© to ©int© and ©U© to ©const char©, and calls the function as normal. 3248 3246 3249 Tuples can contain otype and dtype components.3247 Tuples can contain polymorphic types. 3250 3248 For example, a plus operator can be written to add two triples of a type together. 3251 3249 \begin{cfa} 3252 forall( otypeT | { T ?+?(T, T); })3250 forall(T | { T ?+?(T, T); }) 3253 3251 [T, T, T] ?+?([T, T, T] x, [T, T, T] y) { 3254 3252 return [x.0+y.0, x.1+y.1, x.2+y.2]; … … 3268 3266 Furthermore, these calls can be made ambiguous by introducing seemingly different functions. 3269 3267 \begin{cfa} 3270 forall( otypeT | { T ?+?(T, T); })3268 forall(T | { T ?+?(T, T); }) 3271 3269 [T, T, T] ?+?([T, T] x, [T, T, T, T]); 3272 forall( otypeT | { T ?+?(T, T); })3270 forall(T | { T ?+?(T, T); }) 3273 3271 [T, T, T] ?+?(T x, [T, T, T, T, T]); 3274 3272 \end{cfa} … … 3294 3292 \begin{cfa} 3295 3293 int f([int, double], double); 3296 forall( otype T, otypeU | { T f(T, U, U); })3294 forall(T, U | { T f(T, U, U); }) 3297 3295 void g(T, U); 3298 3296 g(5, 10.21); … … 7381 7379 \leavevmode 7382 7380 \begin{cfa}[aboveskip=0pt,belowskip=0pt] 7383 forall( otypeT | { int ?<?( T, T ); } ) $\C{// location}$7381 forall( T | { int ?<?( T, T ); } ) $\C{// location}$ 7384 7382 T * bsearch( T key, const T * arr, size_t dim );$\indexc{bsearch}$ 7385 7383 7386 forall( otypeT | { int ?<?( T, T ); } ) $\C{// position}$7384 forall( T | { int ?<?( T, T ); } ) $\C{// position}$ 7387 7385 unsigned int bsearch( T key, const T * arr, size_t dim ); 7388 7386 7389 forall( otypeT | { int ?<?( T, T ); } )7387 forall( T | { int ?<?( T, T ); } ) 7390 7388 void qsort( const T * arr, size_t dim );$\indexc{qsort}$ 7391 7389 7392 forall( otypeE | { int ?<?( E, E ); } ) {7390 forall( E | { int ?<?( E, E ); } ) { 7393 7391 E * bsearch( E key, const E * vals, size_t dim );$\indexc{bsearch}$ $\C{// location}$ 7394 7392 size_t bsearch( E key, const E * vals, size_t dim );$\C{// position}$ … … 7399 7397 } 7400 7398 7401 forall( otype K, otypeE | { int ?<?( K, K ); K getKey( const E & ); } ) {7399 forall( K, E | { int ?<?( K, K ); K getKey( const E & ); } ) { 7402 7400 E * bsearch( K key, const E * vals, size_t dim ); 7403 7401 size_t bsearch( K key, const E * vals, size_t dim ); … … 7408 7406 } 7409 7407 7410 forall( otypeE | { int ?<?( E, E ); } ) {7408 forall( E | { int ?<?( E, E ); } ) { 7411 7409 void qsort( E * vals, size_t dim );$\indexc{qsort}$ 7412 7410 } … … 7428 7426 double abs( double _Complex ); 7429 7427 long double abs( long double _Complex ); 7430 forall( otypeT | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )7428 forall( T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } ) 7431 7429 T abs( T ); 7432 7430 \end{cfa} … … 7465 7463 \leavevmode 7466 7464 \begin{cfa}[aboveskip=0pt,belowskip=0pt] 7467 forall( otypeT | { int ?<?( T, T ); } ) T min( T t1, T t2 );$\indexc{min}$7468 forall( otypeT | { int ?>?( T, T ); } ) T max( T t1, T t2 );$\indexc{max}$7469 forall( otypeT | { T min( T, T ); T max( T, T ); } ) T clamp( T value, T min_val, T max_val );$\indexc{clamp}$7470 forall( otypeT ) void swap( T * t1, T * t2 );$\indexc{swap}$7465 forall( T | { int ?<?( T, T ); } ) T min( T t1, T t2 );$\indexc{min}$ 7466 forall( T | { int ?>?( T, T ); } ) T max( T t1, T t2 );$\indexc{max}$ 7467 forall( T | { T min( T, T ); T max( T, T ); } ) T clamp( T value, T min_val, T max_val );$\indexc{clamp}$ 7468 forall( T ) void swap( T * t1, T * t2 );$\indexc{swap}$ 7471 7469 \end{cfa} 7472 7470 -
driver/cc1.cc
r82f4063 rbae0d35 10 10 // Created On : Fri Aug 26 14:23:51 2005 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 17 14:27:08 202013 // Update Count : 41 412 // Last Modified On : Tue Jun 1 23:07:21 2021 13 // Update Count : 415 14 14 // 15 15 … … 199 199 if ( arg == "-D" || arg == "-U" || arg == "-I" || arg == "-MF" || arg == "-MT" || arg == "-MQ" || 200 200 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 ) { 202 204 i += 1; 203 205 args[nargs++] = argv[i]; // pass argument along … … 383 385 // strip inappropriate flags with an argument 384 386 385 } else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" ) {387 } else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" || arg == "-dumpdir" ) { 386 388 i += 1; 387 389 #ifdef __DEBUG_H__ -
libcfa/src/Makefile.am
r82f4063 rbae0d35 106 106 107 107 inst_thread_headers_src = \ 108 concurrency/alarm.hfa \ 108 109 concurrency/coroutine.hfa \ 109 110 concurrency/exception.hfa \ … … 116 117 thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \ 117 118 bits/signal.hfa \ 118 concurrency/alarm.cfa \119 concurrency/alarm.hfa \120 119 concurrency/clib/cfathread.cfa \ 121 120 concurrency/CtxSwitch-@ARCHITECTURE@.S \ -
libcfa/src/concurrency/coroutine.cfa
r82f4063 rbae0d35 267 267 struct $coroutine * cor = active_coroutine(); 268 268 269 // get the active thread once 270 $thread * athrd = active_thread(); 271 272 /* paranoid */ verify( athrd->corctx_flag ); 273 athrd->corctx_flag = false; 274 269 275 if(cor->state == Primed) { 270 276 __cfactx_suspend(); -
libcfa/src/concurrency/coroutine.hfa
r82f4063 rbae0d35 86 86 src->state = src->state == Halted ? Halted : Blocked; 87 87 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 88 95 // set new coroutine that task is executing 89 a ctive_thread()->curr_cor = dst;96 athrd->curr_cor = dst; 90 97 91 98 // context switch to specified coroutine 92 verify( dst->context.SP );99 /* paranoid */ verify( dst->context.SP ); 93 100 __cfactx_switch( &src->context, &dst->context ); 94 101 // when __cfactx_switch returns we are back in the src coroutine 102 103 /* paranoid */ verify( athrd->corctx_flag ); 104 athrd->corctx_flag = false; 95 105 96 106 // set state of new coroutine to active -
libcfa/src/concurrency/invoke.h
r82f4063 rbae0d35 168 168 enum __Preemption_Reason preempted:8; 169 169 170 bool corctx_flag; 171 170 172 //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it 171 173 -
libcfa/src/concurrency/kernel.cfa
r82f4063 rbae0d35 413 413 /* paranoid */ verify( thrd_dst->context.SP ); 414 414 /* 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 processor416 /* 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 processor415 /* 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 417 417 /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary ); 418 418 … … 424 424 425 425 /* 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 ); 428 428 /* paranoid */ verify( thrd_dst->context.SP ); 429 429 /* paranoid */ verify( thrd_dst->curr_cluster == this->cltr ); -
libcfa/src/concurrency/kernel/startup.cfa
r82f4063 rbae0d35 397 397 // make sure the current state is still correct 398 398 /* paranoid */ verify(src->state == Ready); 399 src->corctx_flag = true; 399 400 400 401 // context switch to specified coroutine -
libcfa/src/concurrency/thread.cfa
r82f4063 rbae0d35 32 32 state = Start; 33 33 preempted = __NO_PREEMPTION; 34 corctx_flag = false; 34 35 curr_cor = &self_cor; 35 36 self_mon.owner = &this; -
src/AST/Pass.proto.hpp
r82f4063 rbae0d35 119 119 template<typename core_t, typename node_t> 120 120 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 *>() ) ); 122 122 123 123 static constexpr bool value = std::is_void< ret_t >::value || -
src/AST/Type.hpp
r82f4063 rbae0d35 402 402 403 403 // 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; 408 408 409 409 TypeEnvKey() = default; … … 440 440 const Type * accept( Visitor & v ) const override { return v.visit( this ); } 441 441 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; 444 444 else return name; 445 445 } … … 548 548 res = p * res + x.expr_id; 549 549 return res; 550 } 550 } 551 551 }; 552 552 } -
src/AST/TypeEnvironment.cpp
r82f4063 rbae0d35 115 115 116 116 void TypeEnvironment::add( const TypeSubstitution & sub ) { 117 for ( const auto p : sub ) {117 for ( const auto & p : sub ) { 118 118 add( EqvClass{ p.first, p.second } ); 119 119 } -
src/CodeTools/ResolvProtoDump.cc
r82f4063 rbae0d35 746 746 // print child scopes 747 747 ++indent; 748 for ( const P assVisitor<ProtoDump>& s : subs ) {748 for ( const ProtoDump & s : subs ) { 749 749 std::cout << tab << '{' << std::endl; 750 s.p ass.print( indent );750 s.print( indent ); 751 751 std::cout << tab << '}' << std::endl; 752 752 } -
src/main.cc
r82f4063 rbae0d35 160 160 #define SIGPARMS int sig __attribute__(( unused )), siginfo_t * sfp __attribute__(( unused )), ucontext_t * cxt __attribute__(( unused )) 161 161 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; 162 static void _Signal(struct sigaction & act, int sig, int flags ) { 166 163 act.sa_flags = flags; 167 164 … … 170 167 _exit( EXIT_FAILURE ); 171 168 } // if 169 } 170 171 static 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 177 static void Signal( int sig, void (* handler)(int), int flags ) { 178 struct sigaction act; 179 act.sa_handler = handler; 180 _Signal(act, sig, flags); 172 181 } // Signal 173 182 … … 202 211 static void sigAbortHandler( SIGPARMS ) { 203 212 backtrace( 6 ); // skip first 6 stack frames 204 Signal( SIGABRT, (void (*)(SIGPARMS))SIG_DFL, SA_SIGINFO ); // reset default signal handler213 Signal( SIGABRT, SIG_DFL, SA_SIGINFO ); // reset default signal handler 205 214 raise( SIGABRT ); // reraise SIGABRT 206 215 } // sigAbortHandler -
tests/.expect/array.txt
r82f4063 rbae0d35 1 array.cfa: In function '_X4mainFi___1': 2 array.cfa:55:9: note: #pragma message: Compiled 1 array.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 1 cast.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 1 expression.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 1 forall.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 1 identFuncDeclarator.cfa:114:25: warning: Compiled -
tests/.expect/init1-ERROR.nast.txt
r82f4063 rbae0d35 1 init1.cfa:134:25: warning: Compiled 1 2 init1.cfa:56:1 error: Invalid application of existing declaration(s) in expression Untyped Init Expression 2 3 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 1 init1.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 1 labelledExit.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 1 limits.cfa:152:25: warning: Compiled -
tests/.expect/nested-types-ERR1.txt
r82f4063 rbae0d35 1 nested-types.cfa:100:25: warning: Compiled 1 2 nested-types.cfa:83:1 error: Use of undefined type T -
tests/.expect/nested-types-ERR2.txt
r82f4063 rbae0d35 1 nested-types.cfa:100:25: warning: Compiled 1 2 nested-types.cfa:86:1 error: Use of undefined global type Z 2 3 nested-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 1 nested-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 1 numericConstants.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 1 quasiKeyword.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 1 switch.cfa:103:25: warning: Compiled -
tests/.expect/typedefRedef-ERR1.txt
r82f4063 rbae0d35 1 typedefRedef.cfa:69:25: warning: Compiled 1 2 typedefRedef.cfa:4:1 error: Cannot redefine typedef: Foo 2 3 typedefRedef.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 1 typedefRedef.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 1 variableDeclarator.cfa:180:25: warning: Compiled -
tests/Makefile.am
r82f4063 rbae0d35 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Tue Mar 2 21:39:01202114 ## Update Count : 9 013 ## Last Modified On : Sat Jun 5 14:49:25 2021 14 ## Update Count : 92 15 15 ############################################################################### 16 16 … … 173 173 174 174 SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall \ 175 init1 limits nested-types stdincludes cast labelledExit array quasiKeywordinclude/includes builtins/sync warnings/self-assignment175 init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment 176 176 $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN) 177 177 $(CFACOMPILE_SYNTAX) -
tests/array.cfa
r82f4063 rbae0d35 11 11 // Created On : Tue Feb 19 21:18:06 2019 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : S un Sep 27 09:05:40 202014 // Update Count : 413 // Last Modified On : Sat Jun 5 10:05:51 2021 14 // Update Count : 5 15 15 // 16 16 … … 50 50 51 51 int 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!!! 55 53 } 56 54 -
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 1 builtins/sync.cfa:356:25: warning: Compiled -
tests/builtins/sync.cfa
r82f4063 rbae0d35 354 354 355 355 int main() { 356 #pragma message( "Compiled" ) // force non-empty .expect file 356 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 357 357 } -
tests/cast.cfa
r82f4063 rbae0d35 14 14 //Dummy main 15 15 int 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!!! 17 17 } -
tests/concurrent/.expect/sleep.txt
r82f4063 rbae0d35 1 1 start 2 fast loop 0.0473 fast loop 0.0944 fast loop 0.1415 fast loop 0.1886 fast loop 0.2357 slow loop 0.2778 fast loop 0.2829 fast loop 0.32910 fast loop 0.37611 fast loop 0.42312 fast loop 0.4713 fast loop 0.51714 slow loop 0.55415 fast loop 0.56416 fast loop 0.61117 fast loop 0.65818 fast loop 0.70519 fast loop 0.75220 fast loop 0.79921 slow loop 0.83122 fast loop 0.84623 fast loop 0.89324 fast loop 0.9425 slow loop 1.10826 2 done -
tests/concurrent/sleep.cfa
r82f4063 rbae0d35 7 7 } 8 8 9 volatile int counter = 0; 10 9 11 thread fast_sleeper {}; 10 12 void main(fast_sleeper &) { … … 12 14 for(i; 20) { 13 15 sleep(wait); 14 sout | acquire | "fast loop" | ((1 + i) * wait);16 __atomic_fetch_add( &counter, 1, __ATOMIC_RELAXED ); 15 17 } 16 18 } … … 20 22 Duration wait = 277`ms; 21 23 for(i; 4) { 22 23 24 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; 25 27 } 26 28 } -
tests/expression.cfa
r82f4063 rbae0d35 84 84 (S)@{2}`mary; 85 85 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!!! 89 87 } // main -
tests/forall.cfa
r82f4063 rbae0d35 10 10 // Created On : Wed May 9 08:48:15 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 08:43:20 202013 // Update Count : 3 512 // Last Modified On : Sat Jun 5 10:06:08 2021 13 // Update Count : 36 14 14 // 15 15 … … 214 214 215 215 int main( void ) { 216 #pragma message( "Compiled" ) // force non-empty .expect file 216 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 217 217 } 218 218 -
tests/identFuncDeclarator.cfa
r82f4063 rbae0d35 10 10 // Created On : Wed Aug 17 08:36:34 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 08:20:46 202013 // Update Count : 512 // Last Modified On : Sat Jun 5 10:06:25 2021 13 // Update Count : 6 14 14 // 15 15 … … 112 112 int (* const(* const f81)(int))(); 113 113 114 #pragma message( "Compiled" ) // force non-empty .expect file 114 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 115 115 } 116 116 -
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 1 include/includes.cfa:154:25: warning: Compiled -
tests/include/includes.cfa
r82f4063 rbae0d35 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 25 09:08:26 202113 // Update Count : 75 012 // Last Modified On : Sat Jun 5 10:06:46 2021 13 // Update Count : 751 14 14 // 15 15 … … 152 152 153 153 int 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!!! 155 155 } 156 156 -
tests/include/stdincludes.cfa
r82f4063 rbae0d35 10 10 // Created On : Tue Aug 29 08:26:14 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 08:51:38 202013 // Update Count : 812 // Last Modified On : Sat Jun 5 10:08:11 2021 13 // Update Count : 9 14 14 // 15 15 … … 48 48 49 49 int main() { 50 #pragma message( "Compiled" ) // force non-empty .expect file 50 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 51 51 } 52 52 -
tests/init1.cfa
r82f4063 rbae0d35 10 10 // Created On : Thu Jul 16 22:00:00 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Oct 11 10:26:50 202013 // Update Count : 812 // Last Modified On : Sat Jun 5 10:06:57 2021 13 // Update Count : 9 14 14 // 15 15 … … 132 132 133 133 int main() { 134 #pragma message( "Compiled" ) // force non-empty .expect file134 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 135 135 } -
tests/labelledExit.cfa
r82f4063 rbae0d35 10 10 // Created On : Wed Aug 10 07:29:39 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 09:01:34 202013 // Update Count : 1 212 // Last Modified On : Sat Jun 5 10:07:34 2021 13 // Update Count : 13 14 14 // 15 15 … … 179 179 180 180 int 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!!! 182 182 } 183 183 -
tests/limits.cfa
r82f4063 rbae0d35 10 10 // Created On : Tue May 10 20:44:20 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 08:45:43 202013 // Update Count : 1 012 // Last Modified On : Sat Jun 5 10:07:32 2021 13 // Update Count : 11 14 14 // 15 15 … … 150 150 151 151 int 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!!! 153 153 } 154 154 -
tests/nested-types.cfa
r82f4063 rbae0d35 10 10 // Created On : Mon Jul 9 10:20:03 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 08:48:59 202013 // Update Count : 612 // Last Modified On : Sat Jun 5 10:07:42 2021 13 // Update Count : 7 14 14 // 15 15 … … 98 98 // A.N(int) x; // xxx - should not be an error, but currently is. 99 99 100 #pragma message( "Compiled" ) // force non-empty .expect file 100 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 101 101 } 102 102 -
tests/numericConstants.cfa
r82f4063 rbae0d35 10 10 // Created On : Wed May 24 22:10:36 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 07:55:22 202013 // Update Count : 712 // Last Modified On : Sat Jun 5 10:07:52 2021 13 // Update Count : 8 14 14 // 15 15 … … 64 64 0x_1.ffff_ffff_p_128_l; 65 65 66 #pragma message( "Compiled" ) // force non-empty .expect file 66 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 67 67 } // main 68 68 -
tests/pybin/tools.py
r82f4063 rbae0d35 387 387 # make a directory for this test 388 388 # mkdir makes the parent directory only so add a dummy 389 mkdir( os.path.join(dst, name ))389 mkdir( os.path.join(dst, "core") ) 390 390 391 391 # moves the files 392 392 mv( core, os.path.join(dst, "core" ) ) 393 mv( exe , os.path.join(dst, name) )393 mv( exe , os.path.join(dst, "exe" ) ) 394 394 395 395 # return explanatory test -
tests/quasiKeyword.cfa
r82f4063 rbae0d35 8 8 // Created On : Wed Feb 17 10:33:49 2021 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : S un Feb 21 15:52:04202111 // Update Count : 710 // Last Modified On : Sat Jun 5 10:07:59 2021 11 // Update Count : 8 12 12 // 13 13 … … 52 52 else catch = 3; 53 53 54 #pragma message( "Compiled" ) // force non-empty .expect file 54 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 55 55 } -
tests/switch.cfa
r82f4063 rbae0d35 10 10 // Created On : Tue Jul 12 06:50:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 08:35:02 202013 // Update Count : 4 312 // Last Modified On : Sat Jun 5 10:08:20 2021 13 // Update Count : 44 14 14 // 15 15 … … 101 101 } // choose 102 102 103 #pragma message( "Compiled" ) // force non-empty .expect file 103 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 104 104 } // main 105 105 -
tests/typedefRedef.cfa
r82f4063 rbae0d35 67 67 typedef int *** pt; 68 68 69 #pragma message( "Compiled" ) // force non-empty .expect file 69 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 70 70 } -
tests/unified_locking/fast.cfa
r82f4063 rbae0d35 8 8 fast_lock l; 9 9 $thread * id; 10 size_t sum;10 uint32_t sum; 11 11 }; 12 12 … … 20 20 } 21 21 22 u nsignedcs() {22 uint32_t cs() { 23 23 $thread * me = active_thread(); 24 u nsigned value = (unsigned)me;24 uint32_t value = (uint32_t)me; 25 25 lock(mo.l); 26 26 { 27 size_t tsum = mo.sum;27 uint32_t tsum = mo.sum; 28 28 mo.id = me; 29 29 yield(random(5)); … … 36 36 37 37 thread LockCheck { 38 size_t sum;38 uint32_t sum; 39 39 }; 40 40 … … 50 50 51 51 int main() { 52 size_t sum = -32;52 uint32_t sum = -32; 53 53 mo.sum = -32; 54 54 processor p[2]; -
tests/unified_locking/timeout_lock.cfa
r82f4063 rbae0d35 1 1 #include <stdio.h> 2 #include "locks.hfa"3 #include "alarm.hfa"2 #include <locks.hfa> 3 #include <alarm.hfa> 4 4 #include <stdlib.hfa> 5 5 #include <thread.hfa> 6 #include "kernel.cfa"6 #include <kernel.hfa> 7 7 8 8 multiple_acquisition_lock m, n; … … 33 33 34 34 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 ) ) { 36 36 // printf("Thread: %p signalled\n", active_thread()); // removed since can't expect non deterministic output 37 37 } else { … … 73 73 processor p[2]; 74 74 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 ); 76 76 wait( c_m, 10, 1`ns ); // bool wait( condition_variable(L) & this, uintptr_t info, Duration duration ); 77 77 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 10 10 // Created On : Wed Aug 17 08:41:42 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 07:46:17 202013 // Update Count : 1 312 // Last Modified On : Sat Jun 5 10:08:47 2021 13 // Update Count : 14 14 14 // 15 15 … … 178 178 //Dummy main 179 179 int 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!!! 181 181 } 182 182 -
tests/warnings/.expect/self-assignment.nast.txt
r82f4063 rbae0d35 1 warnings/self-assignment.cfa:34:25: warning: Compiled 1 2 warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Generated Cast of: 2 3 Variable Expression: j: signed int … … 46 47 ... with resolved type: 47 48 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 10 10 // Created On : Thu Mar 1 13:53:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 27 09:24:34 202013 // Update Count : 612 // Last Modified On : Sat Jun 5 10:08:56 2021 13 // Update Count : 7 14 14 // 15 15 … … 32 32 t.s.i = t.s.i; 33 33 34 #pragma message( "Compiled" ) // force non-empty .expect file 34 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 35 35 } 36 36
Note:
See TracChangeset
for help on using the changeset viewer.