Changeset 5541ea3d for doc/theses/andrew_beach_MMath
- Timestamp:
- Aug 4, 2021, 2:40:11 PM (5 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 199894e
- Parents:
- 0640189e (diff), df5b2c8 (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. - Location:
- doc/theses/andrew_beach_MMath
- Files:
-
- 4 added
- 1 deleted
- 25 edited
-
callreturn.fig (deleted)
-
code/ThrowFinally.java (modified) (1 diff)
-
code/ThrowOther.java (modified) (1 diff)
-
code/cond-catch.cfa (modified) (2 diffs)
-
code/cond-catch.cpp (modified) (2 diffs)
-
code/cond-fixup.cfa (modified) (3 diffs)
-
code/cross-catch.cfa (modified) (2 diffs)
-
code/cross-catch.cpp (modified) (2 diffs)
-
code/cross-finally.cfa (modified) (1 diff)
-
code/cross-resume.cfa (modified) (1 diff)
-
code/resume-detor.cfa (modified) (2 diffs)
-
code/resume-empty.cfa (modified) (2 diffs)
-
code/resume-finally.cfa (modified) (2 diffs)
-
code/resume-other.cfa (modified) (2 diffs)
-
code/run.sh (added)
-
code/test.sh (modified) (4 diffs)
-
code/throw-detor.cfa (modified) (2 diffs)
-
code/throw-detor.cpp (modified) (2 diffs)
-
code/throw-empty.cfa (modified) (1 diff)
-
code/throw-empty.cpp (modified) (1 diff)
-
code/throw-finally.cfa (modified) (2 diffs)
-
code/throw-other.cfa (modified) (2 diffs)
-
code/throw-other.cpp (modified) (2 diffs)
-
existing.tex (modified) (12 diffs)
-
handler.fig (added)
-
intro.tex (modified) (4 diffs)
-
performance.tex (modified) (10 diffs)
-
resumption.fig (added)
-
termination.fig (added)
-
uw-ethesis.tex (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/ThrowFinally.java
r0640189e r5541ea3d 7 7 throws EmptyException { 8 8 if (0 < frames) { 9 unwind_finally(frames - 1); 9 try { 10 unwind_finally(frames - 1); 11 } finally { 12 // ... 13 } 10 14 } else { 11 15 throw new EmptyException(); -
doc/theses/andrew_beach_MMath/code/ThrowOther.java
r0640189e r5541ea3d 16 16 // ... 17 17 } 18 } else if (should_throw) { 19 throw new NotRaisedException(); 18 20 } else { 19 if (should_throw) {20 throw new NotRaisedException();21 }22 21 throw new EmptyException(); 23 22 } -
doc/theses/andrew_beach_MMath/code/cond-catch.cfa
r0640189e r5541ea3d 19 19 throw_exception(); 20 20 } catch (empty_exception * exc ; should_catch) { 21 // ...21 asm volatile ("# catch block (conditional)"); 22 22 } 23 23 } … … 37 37 cond_catch(); 38 38 } catch (empty_exception * exc) { 39 // ...39 asm volatile ("# catch block (unconditional)"); 40 40 } 41 41 } -
doc/theses/andrew_beach_MMath/code/cond-catch.cpp
r0640189e r5541ea3d 22 22 throw; 23 23 } 24 asm volatile ("# catch block (conditional)"); 24 25 } 25 26 } … … 39 40 cond_catch(); 40 41 } catch (EmptyException &) { 41 // ...42 asm volatile ("# catch block (unconditional)"); 42 43 } 43 44 } -
doc/theses/andrew_beach_MMath/code/cond-fixup.cfa
r0640189e r5541ea3d 12 12 13 13 void throw_exception() { 14 throw (empty_exception){&empty_vt};14 throwResume (empty_exception){&empty_vt}; 15 15 } 16 16 … … 18 18 try { 19 19 throw_exception(); 20 } catch (empty_exception * exc ; should_catch) {21 // ...20 } catchResume (empty_exception * exc ; should_catch) { 21 asm volatile ("# fixup block (conditional)"); 22 22 } 23 23 } … … 36 36 try { 37 37 cond_catch(); 38 } catch (empty_exception * exc) {39 // ...38 } catchResume (empty_exception * exc) { 39 asm volatile ("# fixup block (unconditional)"); 40 40 } 41 41 } -
doc/theses/andrew_beach_MMath/code/cross-catch.cfa
r0640189e r5541ea3d 7 7 EHM_EXCEPTION(not_raised_exception)(); 8 8 9 EHM_VIRTUAL_TABLE(not_raised_exception, not_vt); 10 9 11 int main(int argc, char * argv[]) { 10 12 unsigned int times = 1; 11 unsigned int total_frames = 1;13 volatile bool should_throw = false; 12 14 if (1 < argc) { 13 15 times = strtol(argv[1], 0p, 10); 14 }15 if (2 < argc) {16 total_frames = strtol(argv[2], 0p, 10);17 16 } 18 17 … … 20 19 for (unsigned int count = 0 ; count < times ; ++count) { 21 20 try { 22 // ... 21 asm volatile ("# try block"); 22 if (should_throw) { 23 throw (not_raised_exception){¬_vt}; 24 } 23 25 } catch (not_raised_exception *) { 24 // ...26 asm volatile ("# catch block"); 25 27 } 26 28 } -
doc/theses/andrew_beach_MMath/code/cross-catch.cpp
r0640189e r5541ea3d 11 11 int main(int argc, char * argv[]) { 12 12 unsigned int times = 1; 13 volatile bool should_throw = false; 13 14 if (1 < argc) { 14 15 times = strtol(argv[1], nullptr, 10); … … 18 19 for (unsigned int count = 0 ; count < times ; ++count) { 19 20 try { 20 // ... 21 asm volatile ("# try block"); 22 if (should_throw) { 23 throw NotRaisedException(); 24 } 21 25 } catch (NotRaisedException &) { 22 // ...26 asm volatile ("# catch block"); 23 27 } 24 28 } -
doc/theses/andrew_beach_MMath/code/cross-finally.cfa
r0640189e r5541ea3d 5 5 #include <stdlib.hfa> 6 6 7 EHM_EXCEPTION(not_raised_exception)(); 8 9 EHM_VIRTUAL_TABLE(not_raised_exception, not_vt); 10 7 11 int main(int argc, char * argv[]) { 8 12 unsigned int times = 1; 9 unsigned int total_frames = 1;13 volatile bool should_throw = false; 10 14 if (1 < argc) { 11 15 times = strtol(argv[1], 0p, 10); 12 }13 if (2 < argc) {14 total_frames = strtol(argv[2], 0p, 10);15 16 } 16 17 17 18 Time start_time = timeHiRes(); 18 19 for (unsigned int count = 0 ; count < times ; ++count) { 19 try { 20 // ... 20 try { 21 asm volatile ("# try block"); 22 if (should_throw) { 23 throw (not_raised_exception){¬_vt}; 24 } 21 25 } finally { 22 // ...26 asm volatile ("# finally block"); 23 27 } 24 28 } -
doc/theses/andrew_beach_MMath/code/cross-resume.cfa
r0640189e r5541ea3d 20 20 for (unsigned int count = 0 ; count < times ; ++count) { 21 21 try { 22 // ...22 asm volatile (""); 23 23 } catchResume (not_raised_exception *) { 24 // ...24 asm volatile (""); 25 25 } 26 26 } -
doc/theses/andrew_beach_MMath/code/resume-detor.cfa
r0640189e r5541ea3d 12 12 13 13 void ^?{}(WithDestructor & this) { 14 // ... 14 asm volatile ("# destructor body"); 15 15 } 16 16 17 17 void unwind_destructor(unsigned int frames) { 18 if (frames) {18 if (frames) { 19 19 20 WithDestructor object;21 unwind_destructor(frames - 1);22 } else {23 throwResume (empty_exception){&empty_vt};24 }20 WithDestructor object; 21 unwind_destructor(frames - 1); 22 } else { 23 throwResume (empty_exception){&empty_vt}; 24 } 25 25 } 26 26 … … 36 36 37 37 Time start_time = timeHiRes(); 38 for (int count = 0 ; count < times ; ++count) {39 try {40 unwind_destructor(total_frames);41 } catchResume (empty_exception *) {42 // ... 43 }44 }38 for (int count = 0 ; count < times ; ++count) { 39 try { 40 unwind_destructor(total_frames); 41 } catchResume (empty_exception *) { 42 asm volatile ("# fixup block"); 43 } 44 } 45 45 Time end_time = timeHiRes(); 46 46 sout | "Run-Time (ns): " | (end_time - start_time)`ns; -
doc/theses/andrew_beach_MMath/code/resume-empty.cfa
r0640189e r5541ea3d 13 13 unwind_empty(frames - 1); 14 14 } else { 15 throw (empty_exception){&empty_vt};15 throwResume (empty_exception){&empty_vt}; 16 16 } 17 17 } … … 31 31 try { 32 32 unwind_empty(total_frames); 33 } catch (empty_exception *) {34 // ...33 } catchResume (empty_exception *) { 34 asm volatile ("# fixup block"); 35 35 } 36 36 } -
doc/theses/andrew_beach_MMath/code/resume-finally.cfa
r0640189e r5541ea3d 14 14 unwind_finally(frames - 1); 15 15 } finally { 16 // ...16 asm volatile ("# finally block"); 17 17 } 18 18 } else { … … 36 36 unwind_finally(total_frames); 37 37 } catchResume (empty_exception *) { 38 // ...38 asm volatile ("# fixup block"); 39 39 } 40 40 } -
doc/theses/andrew_beach_MMath/code/resume-other.cfa
r0640189e r5541ea3d 16 16 unwind_other(frames - 1); 17 17 } catchResume (not_raised_exception *) { 18 // ...18 asm volatile ("# fixup block (stack)"); 19 19 } 20 20 } else { … … 38 38 unwind_other(total_frames); 39 39 } catchResume (empty_exception *) { 40 // ...40 asm volatile ("# fixup block (base)"); 41 41 } 42 42 } -
doc/theses/andrew_beach_MMath/code/test.sh
r0640189e r5541ea3d 1 1 #!/usr/bin/env bash 2 2 3 # Usage: LANGUAGE TEST | -b SOURCE_FILE 3 # Usage: 4 # test.sh LANGUAGE TEST 5 # Run the TEST in LANGUAGE. 6 # test.sh -b SOURCE_FILE... 7 # Build a test from SOURCE_FILE(s). 8 # test.sh -v LANGUAGE TEST FILE 9 # View the result from TEST in LANGUAGE stored in FILE. 4 10 5 11 readonly ITERATIONS=1000000 # 1 000 000, one million … … 38 44 done 39 45 exit 0 46 elif [ "-v" = "$1" -a 4 = "$#" ]; then 47 TEST_LANG="$2" 48 TEST_CASE="$3" 49 VIEW_FILE="$4" 40 50 elif [ 2 -eq "$#" ]; then 41 51 TEST_LANG="$1" … … 116 126 117 127 case "$TEST_LANG" in 118 cfa-t) echo $CFAT; $CFAT;;119 cfa-r) echo $CFAR; $CFAR;;120 cpp) echo $CPP; $CPP;;121 java) echo $JAVA; $JAVA;;122 python) echo $PYTHON; $PYTHON;;128 cfa-t) CALL="$CFAT";; 129 cfa-r) CALL="$CFAR";; 130 cpp) CALL="$CPP";; 131 java) CALL="$JAVA";; 132 python) CALL="$PYTHON";; 123 133 *) 124 134 echo "No such language: $TEST_LANG" >&2 … … 126 136 ;; 127 137 esac 138 139 echo $CALL 140 141 if [ -n "$VIEW_FILE" ]; then 142 grep -A 1 -B 0 "$CALL" "$VIEW_FILE" | sed -n -e 's!Run-Time (ns): !!;T;p' 143 exit 144 fi 145 146 $CALL -
doc/theses/andrew_beach_MMath/code/throw-detor.cfa
r0640189e r5541ea3d 12 12 13 13 void ^?{}(WithDestructor & this) { 14 // ...14 asm volatile ("# destructor body"); 15 15 } 16 16 … … 39 39 unwind_destructor(total_frames); 40 40 } catch (empty_exception *) { 41 // ...41 asm volatile ("# catch block"); 42 42 } 43 43 } -
doc/theses/andrew_beach_MMath/code/throw-detor.cpp
r0640189e r5541ea3d 10 10 11 11 struct WithDestructor { 12 ~WithDestructor() {} 12 ~WithDestructor() { 13 asm volatile ("# destructor body"); 14 } 13 15 }; 14 16 … … 37 39 unwind_destructor(total_frames); 38 40 } catch (EmptyException &) { 39 // ...41 asm volatile ("# catch block"); 40 42 } 41 43 } -
doc/theses/andrew_beach_MMath/code/throw-empty.cfa
r0640189e r5541ea3d 32 32 unwind_empty(total_frames); 33 33 } catch (empty_exception *) { 34 // ...34 asm volatile ("# catch block"); 35 35 } 36 36 } -
doc/theses/andrew_beach_MMath/code/throw-empty.cpp
r0640189e r5541ea3d 32 32 unwind_empty(total_frames); 33 33 } catch (EmptyException &) { 34 // ...34 asm volatile ("# catch block"); 35 35 } 36 36 } -
doc/theses/andrew_beach_MMath/code/throw-finally.cfa
r0640189e r5541ea3d 14 14 unwind_finally(frames - 1); 15 15 } finally { 16 // ...16 asm volatile ("# finally block"); 17 17 } 18 18 } else { … … 36 36 unwind_finally(total_frames); 37 37 } catch (empty_exception *) { 38 // ...38 asm volatile ("# catch block"); 39 39 } 40 40 } -
doc/theses/andrew_beach_MMath/code/throw-other.cfa
r0640189e r5541ea3d 16 16 unwind_other(frames - 1); 17 17 } catch (not_raised_exception *) { 18 // ...18 asm volatile ("# catch block (stack)"); 19 19 } 20 20 } else { … … 38 38 unwind_other(total_frames); 39 39 } catch (empty_exception *) { 40 // ...40 asm volatile ("# catch block (base)"); 41 41 } 42 42 } -
doc/theses/andrew_beach_MMath/code/throw-other.cpp
r0640189e r5541ea3d 16 16 unwind_other(frames - 1); 17 17 } catch (NotRaisedException &) { 18 // ...18 asm volatile ("# catch block (stack)"); 19 19 } 20 20 } else { … … 38 38 unwind_other(total_frames); 39 39 } catch (EmptyException &) { 40 // ...40 asm volatile ("# catch block (base)"); 41 41 } 42 42 } -
doc/theses/andrew_beach_MMath/existing.tex
r0640189e r5541ea3d 10 10 11 11 Only those \CFA features pertaining to this thesis are discussed. 12 Also, only new features of \CFA will be discussed, a familiarity with 12 % Also, only new features of \CFA will be discussed, 13 A familiarity with 13 14 C or C-like languages is assumed. 14 15 … … 16 17 \CFA has extensive overloading, allowing multiple definitions of the same name 17 18 to be defined~\cite{Moss18}. 18 \begin{ cfa}19 char i; int i; double i;20 int f(); double f();21 void g( int ); void g( double );22 \end{ cfa}19 \begin{lstlisting}[language=CFA,{moredelim=**[is][\color{red}]{@}{@}}] 20 char @i@; int @i@; double @i@; 21 int @f@(); double @f@(); 22 void @g@( int ); void @g@( double ); 23 \end{lstlisting} 23 24 This feature requires name mangling so the assembly symbols are unique for 24 25 different overloads. For compatibility with names in C, there is also a syntax … … 62 63 int && rri = ri; 63 64 rri = 3; 64 &ri = &j; 65 &ri = &j; // rebindable 65 66 ri = 5; 66 67 \end{cfa} … … 78 79 \end{minipage} 79 80 80 References are intended to be used when you would use pointers but would81 be dereferencing them (almost) every usage.81 References are intended for pointer situations where dereferencing is the common usage, 82 \ie the value is more important than the pointer. 82 83 Mutable references may be assigned to by converting them to a pointer 83 84 with a @&@ and then assigning a pointer to them, as in @&ri = &j;@ above … … 85 86 \section{Operators} 86 87 87 \CFA implements operator overloading by providing special names .88 Operator uses are translated into function calls using these names.89 These names arecreated by taking the operator symbols and joining them with88 \CFA implements operator overloading by providing special names, where 89 operator usages are translated into function calls using these names. 90 An operator name is created by taking the operator symbols and joining them with 90 91 @?@s to show where the arguments go. 91 92 For example, 92 infixed multiplication is @?*?@ while prefix dereference is @*?@.93 infixed multiplication is @?*?@, while prefix dereference is @*?@. 93 94 This syntax make it easy to tell the difference between prefix operations 94 95 (such as @++?@) and post-fix operations (@?++@). 95 96 For example, plus and equality operators are defined for a point type. 96 97 \begin{cfa} 97 98 point ?+?(point a, point b) { return point{a.x + b.x, a.y + b.y}; } 98 bool?==?(point a, point b) { return a.x == b.x && a.y == b.y; }99 int ?==?(point a, point b) { return a.x == b.x && a.y == b.y; } 99 100 { 100 101 assert(point{1, 2} + point{3, 4} == point{4, 6}); 101 102 } 102 103 \end{cfa} 103 Note that these special names are not limited to just being used for these 104 operator functions, and may be used name other declarations. 105 Some ``near misses", that will not match an operator form but looks like 106 it may have been supposed to, will generate wantings but otherwise they are 107 left alone. 104 Note these special names are not limited to builtin 105 operators, and hence, may be used with arbitrary types. 106 \begin{cfa} 107 double ?+?( int x, point y ); // arbitrary types 108 \end{cfa} 109 % Some ``near misses", that are that do not match an operator form but looks like 110 % it may have been supposed to, will generate warning but otherwise they are 111 % left alone. 112 Because operators are never part of the type definition they may be added 113 at any time, including on built-in types. 108 114 109 115 %\subsection{Constructors and Destructors} 110 116 111 Both constructors and destructors are operators, which means they are 112 functions with special operator names rather than type names in \Cpp. The 113 special operator names may be used to call the functions explicitly. 114 % Placement new means that this is actually equivant to C++. 117 \CFA also provides constructors and destructors as operators, which means they 118 are functions with special operator names rather than type names in \Cpp. 119 While constructors and destructions are normally called implicitly by the compiler, 120 the special operator names, allow explicit calls. 121 122 % Placement new means that this is actually equivalent to C++. 115 123 116 124 The special name for a constructor is @?{}@, which comes from the 117 125 initialization syntax in C, \eg @Example e = { ... }@. 118 \CFA will generatea constructor call each time a variable is declared,119 passing the initialization arguments to the constructor t.126 \CFA generates a constructor call each time a variable is declared, 127 passing the initialization arguments to the constructor. 120 128 \begin{cfa} 121 129 struct Example { ... }; 122 130 void ?{}(Example & this) { ... } 123 {124 Example a;125 Example b = {};126 }127 131 void ?{}(Example & this, char first, int num) { ... } 128 { 129 Example c = {'a', 2}; 130 } 131 \end{cfa} 132 Both @a@ and @b@ will be initalized with the first constructor, 133 while @c@ will be initalized with the second. 134 Currently, there is no general way to skip initialation. 135 132 Example a; // implicit constructor calls 133 Example b = {}; 134 Example c = {'a', 2}; 135 \end{cfa} 136 Both @a@ and @b@ are initialized with the first constructor, 137 while @c@ is initialized with the second. 138 Constructor calls can be replaced with C initialization using special operator \lstinline{@=}. 139 \begin{cfa} 140 Example d @= {42}; 141 \end{cfa} 136 142 % I don't like the \^{} symbol but $^\wedge$ isn't better. 137 Similarly destructors use the special name @^?{}@ (the @^@ has no special143 Similarly, destructors use the special name @^?{}@ (the @^@ has no special 138 144 meaning). 139 These are a normally called implicitly called on a variable when it goes out140 of scope. They can be called explicitly as well.145 % These are a normally called implicitly called on a variable when it goes out 146 % of scope. They can be called explicitly as well. 141 147 \begin{cfa} 142 148 void ^?{}(Example & this) { ... } 143 149 { 144 Example d; 145 } // <- implicit destructor call 146 \end{cfa} 147 148 Whenever a type is defined, \CFA will create a default zero-argument 150 Example e; // implicit constructor call 151 ^?{}(e); // explicit destructor call 152 ?{}(e); // explicit constructor call 153 } // implicit destructor call 154 \end{cfa} 155 156 Whenever a type is defined, \CFA creates a default zero-argument 149 157 constructor, a copy constructor, a series of argument-per-field constructors 150 158 and a destructor. All user constructors are defined after this. 151 Because operators are never part of the type definition they may be added152 at any time, including on built-in types.153 159 154 160 \section{Polymorphism} … … 202 208 Note, a function named @do_once@ is not required in the scope of @do_twice@ to 203 209 compile it, unlike \Cpp template expansion. Furthermore, call-site inferencing 204 allows local replacement of the mostspecific parametric functions needs for a210 allows local replacement of the specific parametric functions needs for a 205 211 call. 206 212 \begin{cfa} … … 218 224 to @do_twice@ and called within it. 219 225 The global definition of @do_once@ is ignored, however if quadruple took a 220 @double@ argument then the global definition would be used instead as it221 would bea better match.226 @double@ argument, then the global definition would be used instead as it 227 is a better match. 222 228 % Aaron's thesis might be a good reference here. 223 229 224 230 To avoid typing long lists of assertions, constraints can be collect into 225 convenient package scalled a @trait@, which can then be used in an assertion231 convenient package called a @trait@, which can then be used in an assertion 226 232 instead of the individual constraints. 227 233 \begin{cfa} … … 239 245 functionality, like @sumable@, @listable@, \etc. 240 246 241 Polymorphic structures and unions are defined by qualifying theaggregate type247 Polymorphic structures and unions are defined by qualifying an aggregate type 242 248 with @forall@. The type variables work the same except they are used in field 243 249 declarations instead of parameters, returns, and local variable declarations. … … 285 291 coroutine CountUp { 286 292 unsigned int next; 287 } 293 }; 288 294 CountUp countup; 295 for (10) sout | resume(countup).next; // print 10 values 289 296 \end{cfa} 290 297 Each coroutine has a @main@ function, which takes a reference to a coroutine 291 298 object and returns @void@. 292 299 %[numbers=left] Why numbers on this one? 293 \begin{cfa} 300 \begin{cfa}[numbers=left,numberstyle=\scriptsize\sf] 294 301 void main(CountUp & this) { 295 for (unsigned int next = 0 ; true ; ++next) {296 next = up;302 for (unsigned int up = 0;; ++up) { 303 this.next = up; 297 304 suspend;$\label{suspend}$ 298 305 } … … 300 307 \end{cfa} 301 308 In this function, or functions called by this function (helper functions), the 302 @suspend@ statement is used to return execution to the coroutine's caller303 without terminating the coroutine's function .309 @suspend@ statement is used to return execution to the coroutine's resumer 310 without terminating the coroutine's function(s). 304 311 305 312 A coroutine is resumed by calling the @resume@ function, \eg @resume(countup)@. … … 323 330 exclusion on a monitor object by qualifying an object reference parameter with 324 331 @mutex@. 325 \begin{ cfa}326 void example(MonitorA & mutex argA, MonitorB & mutexargB);327 \end{ cfa}332 \begin{lstlisting}[language=CFA,{moredelim=**[is][\color{red}]{@}{@}}] 333 void example(MonitorA & @mutex@ argA, MonitorB & @mutex@ argB); 334 \end{lstlisting} 328 335 When the function is called, it implicitly acquires the monitor lock for all of 329 336 the mutex parameters without deadlock. This semantics means all functions with … … 355 362 { 356 363 StringWorker stringworker; // fork thread running in "main" 357 } // <-implicitly join with thread / wait for completion364 } // implicitly join with thread / wait for completion 358 365 \end{cfa} 359 366 The thread main is where a new thread starts execution after a fork operation -
doc/theses/andrew_beach_MMath/intro.tex
r0640189e r5541ea3d 2 2 3 3 % The highest level overview of Cforall and EHMs. Get this done right away. 4 This thesis goes overthe design and implementation of the exception handling4 This thesis covers the design and implementation of the exception handling 5 5 mechanism (EHM) of 6 6 \CFA (pronounced sea-for-all and may be written Cforall or CFA). 7 \CFA is a new programming language that extends C, thatmaintains7 \CFA is a new programming language that extends C, which maintains 8 8 backwards-compatibility while introducing modern programming features. 9 9 Adding exception handling to \CFA gives it new ways to handle errors and 10 make otherlarge control-flow jumps.10 make large control-flow jumps. 11 11 12 12 % Now take a step back and explain what exceptions are generally. 13 A language's EHM is a combination of language syntax and run-time 14 components that are used to construct, raise, and handle exceptions, 15 including all control flow. 16 Exceptions are an active mechanism for replacing passive error/return codes and return unions (Go and Rust). 13 17 Exception handling provides dynamic inter-function control flow. 14 18 There are two forms of exception handling covered in this thesis: 15 19 termination, which acts as a multi-level return, 16 20 and resumption, which is a dynamic function call. 21 % PAB: Maybe this sentence was suppose to be deleted? 17 22 Termination handling is much more common, 18 to the extent that it is often seen 19 This seperation is uncommon because termination exception handling is so 20 much more common that it is often assumed. 23 to the extent that it is often seen as the only form of handling. 24 % PAB: I like this sentence better than the next sentence. 25 % This separation is uncommon because termination exception handling is so 26 % much more common that it is often assumed. 21 27 % WHY: Mention other forms of continuation and \cite{CommonLisp} here? 22 A language's EHM is the combination of language syntax and run-time 23 components that are used to construct, raise and handle exceptions, 24 including all control flow. 25 26 Termination exception handling allows control to return to any previous 27 function on the stack directly, skipping any functions between it and the 28 current function. 28 29 Exception handling relies on the concept of nested functions to create handlers that deal with exceptions. 29 30 \begin{center} 30 \input{callreturn} 31 \begin{tabular}[t]{ll} 32 \begin{lstlisting}[aboveskip=0pt,belowskip=0pt,language=CFA,{moredelim=**[is][\color{red}]{@}{@}}] 33 void f( void (*hp)() ) { 34 hp(); 35 } 36 void g( void (*hp)() ) { 37 f( hp ); 38 } 39 void h( int @i@, void (*hp)() ) { 40 void @handler@() { // nested 41 printf( "%d\n", @i@ ); 42 } 43 if ( i == 1 ) hp = handler; 44 if ( i > 0 ) h( i - 1, hp ); 45 else g( hp ); 46 } 47 h( 2, 0 ); 48 \end{lstlisting} 49 & 50 \raisebox{-0.5\totalheight}{\input{handler}} 51 \end{tabular} 31 52 \end{center} 32 33 Resumption exception handling seaches the stack for a handler and then calls 34 it without adding or removing any other stack frames. 35 \todo{Add a diagram showing control flow for resumption.} 53 The nested function @handler@ in the second stack frame is explicitly passed to function @f@. 54 When this handler is called in @f@, it uses the parameter @i@ in the second stack frame, which is accessible by an implicit lexical-link pointer. 55 Setting @hp@ in @h@ at different points in the recursion, results in invoking a different handler. 56 Exception handling extends this idea by eliminating explicit handler passing, and instead, performing a stack search for a handler that matches some criteria (conditional dynamic call), and calls the handler at the top of the stack. 57 It is the runtime search $O(N)$ that differentiates an EHM call (raise) from normal dynamic call $O(1)$ via a function or virtual-member pointer. 58 59 Termination exception handling searches the stack for a handler, unwinds the stack to the frame containing the matching handler, and calling the handler at the top of the stack. 60 \begin{center} 61 \input{termination} 62 \end{center} 63 Note, since the handler can reference variables in @h@, @h@ must remain on the stack for the handler call. 64 After the handler returns, control continues after the lexical location of the handler in @h@ (static return)~\cite[p.~108]{Tennent77}. 65 Unwinding allows recover to any previous 66 function on the stack, skipping any functions between it and the 67 function containing the matching handler. 68 69 Resumption exception handling searches the stack for a handler, does \emph{not} unwind the stack to the frame containing the matching handler, and calls the handler at the top of the stack. 70 \begin{center} 71 \input{resumption} 72 \end{center} 73 After the handler returns, control continues after the resume in @f@ (dynamic return). 74 Not unwinding allows fix up of the problem in @f@ by any previous function on the stack, without disrupting the current set of stack frames. 36 75 37 76 Although a powerful feature, exception handling tends to be complex to set up 38 77 and expensive to use 39 so they areoften limited to unusual or ``exceptional" cases.40 The classic example of this is error handling, exceptions can be used to41 remove error handling logic from the main execution path andwhile paying78 so it is often limited to unusual or ``exceptional" cases. 79 The classic example is error handling, where exceptions are used to 80 remove error handling logic from the main execution path, while paying 42 81 most of the cost only when the error actually occurs. 43 82 … … 49 88 some of the underlying tools used to implement and express exception handling 50 89 in other languages are absent in \CFA. 51 Still the resulting syntax resembles that of other languages:52 \begin{ cfa}53 try{90 Still the resulting basic syntax resembles that of other languages: 91 \begin{lstlisting}[language=CFA,{moredelim=**[is][\color{red}]{@}{@}}] 92 @try@ { 54 93 ... 55 94 T * object = malloc(request_size); 56 95 if (!object) { 57 throwOutOfMemory{fixed_allocation, request_size};96 @throw@ OutOfMemory{fixed_allocation, request_size}; 58 97 } 59 98 ... 60 } catch(OutOfMemory * error) {99 } @catch@ (OutOfMemory * error) { 61 100 ... 62 101 } 63 \end{cfa} 64 102 \end{lstlisting} 65 103 % A note that yes, that was a very fast overview. 66 104 The design and implementation of all of \CFA's EHM's features are … … 69 107 70 108 % The current state of the project and what it contributes. 71 All of these features have been implemented in \CFA, along with 72 a suite of test cases as part of this project. 73 The implementation techniques are generally applicable in other programming 109 The majority of the \CFA EHM is implemented in \CFA, except for a small amount of assembler code. 110 In addition, 111 a suite of tests and performance benchmarks were created as part of this project. 112 The \CFA implementation techniques are generally applicable in other programming 74 113 languages and much of the design is as well. 75 Some parts of the EHM use other features unique to \CFA and these would be 76 harder to replicate in other programming languages. 77 114 Some parts of the EHM use features unique to \CFA, and hence, 115 are harder to replicate in other programming languages. 78 116 % Talk about other programming languages. 79 Some existing programming languages that include EHMs/exception handling 80 include C++, Java and Python. All three examples focus on termination 81 exceptions which unwind the stack as part of the 82 Exceptions also can replace return codes and return unions. 117 Three well known programming languages with EHMs, %/exception handling 118 C++, Java and Python are examined in the performance work. However, these languages focus on termination 119 exceptions, so there is no comparison with resumption. 83 120 84 121 The contributions of this work are: 85 122 \begin{enumerate} 86 123 \item Designing \CFA's exception handling mechanism, adapting designs from 87 other programming languages and the creation ofnew features.88 \item Implementing stack unwinding and the EHM in \CFA, including updating89 the compiler and the run-time environment.90 \item Design ed and implementeda prototype virtual system.124 other programming languages, and creating new features. 125 \item Implementing stack unwinding for the \CFA EHM, including updating 126 the \CFA compiler and run-time environment to generate and execute the EHM code. 127 \item Designing and implementing a prototype virtual system. 91 128 % I think the virtual system and per-call site default handlers are the only 92 129 % "new" features, everything else is a matter of implementation. 130 \item Creating tests and performance benchmarks to compare with EHM's in other languages. 93 131 \end{enumerate} 94 132 95 \todo{I can't figure out a good lead-in to the roadmap.}96 The next section covers the existing state of exceptions.97 The existing state of \CFA is also covered in \autoref{c:existing}.98 The newfeatures are introduced in \autoref{c:features},99 which explainstheir usage and design.100 That is followed by the implementation of th ose features in133 %\todo{I can't figure out a good lead-in to the roadmap.} 134 The thesis is organization as follows. 135 The next section and parts of \autoref{c:existing} cover existing EHMs. 136 New \CFA EHM features are introduced in \autoref{c:features}, 137 covering their usage and design. 138 That is followed by the implementation of these features in 101 139 \autoref{c:implement}. 102 The performance results are examined in \autoref{c:performance}.103 Possibilities to extendthis project are discussed in \autoref{c:future}.140 Performance results are presented in \autoref{c:performance}. 141 Summing up and possibilities for extending this project are discussed in \autoref{c:future}. 104 142 105 143 \section{Background} 106 144 \label{s:background} 107 145 108 Exception handling is not a new concept, 109 with papers on the subject dating back 70s. 110 111 Their were popularised by \Cpp, 146 Exception handling is a well examined area in programming languages, 147 with papers on the subject dating back the 70s~\cite{Goodenough75}. 148 Early exceptions were often treated as signals, which carried no information 149 except their identity. Ada~\cite{Ada} still uses this system. 150 151 The modern flag-ship for termination exceptions is \Cpp, 112 152 which added them in its first major wave of non-object-orientated features 113 153 in 1990. 114 154 % https://en.cppreference.com/w/cpp/language/history 115 116 Java was the next popular language to use exceptions. It is also the most 117 popular language with checked exceptions. 118 Checked exceptions are part of the function interface they are raised from. 119 This includes functions they propogate through, until a handler for that 120 type of exception is found. 121 This makes exception information explicit, which can improve clarity and 155 While many EHMs have special exception types, 156 \Cpp has the ability to use any type as an exception. 157 However, this generality is not particularly useful, and has been pushed aside for classes, with a convention of inheriting from 158 \code{C++}{std::exception}. 159 While \Cpp has a special catch-all syntax @catch(...)@, there is no way to discriminate its exception type, so nothing can 160 be done with the caught value because nothing is known about it. 161 Instead the base exception-type \code{C++}{std::exception} is defined with common functionality (such as 162 the ability to print a message when the exception is raised but not caught) and all 163 exceptions have this functionality. 164 Having a root exception-type seems to be the standard now, as the guaranteed functionality is worth 165 any lost in flexibility from limiting exceptions types to classes. 166 167 Java~\cite{Java} was the next popular language to use exceptions. 168 Its exception system largely reflects that of \Cpp, except it requires 169 exceptions to be a subtype of \code{Java}{java.lang.Throwable} 170 and it uses checked exceptions. 171 Checked exceptions are part of a function's interface defining all exceptions it or its called functions raise. 172 Using this information, it is possible to statically verify if a handler exists for all raised exception, \ie no uncaught exceptions. 173 Making exception information explicit, improves clarity and 122 174 safety, but can slow down programming. 123 Some of these, such as dealing with high-order methods or an overly specified 124 throws clause, are technical. However some of the issues are much more 125 human, in that writing/updating all the exception signatures can be enough 126 of a burden people will hack the system to avoid them. 127 Including the ``catch-and-ignore" pattern where a catch block is used without 128 anything to repair or recover from the exception. 129 130 %\subsection 131 Resumption exceptions have been much less popular. 132 Although resumption has a history as old as termination's, very few 133 programming languages have implement them. 175 For example, programming complexity increases when dealing with high-order methods or an overly specified 176 throws clause. However some of the issues are more 177 programming annoyances, such as writing/updating many exception signatures after adding or remove calls. 178 Java programmers have developed multiple programming ``hacks'' to circumvent checked exceptions negating the robustness it is suppose to provide. 179 For example, the ``catch-and-ignore" pattern, where the handler is empty because the exception does not appear relevant to the programmer versus 180 repairing or recovering from the exception. 181 182 %\subsection 183 Resumption exceptions are less popular, 184 although resumption is as old as termination; 185 hence, few 186 programming languages have implemented them. 134 187 % http://bitsavers.informatik.uni-stuttgart.de/pdf/xerox/parc/techReports/ 135 188 % CSL-79-3_Mesa_Language_Manual_Version_5.0.pdf 136 Mesa is one programming languages that did and experiance with that137 languages is quoted as being one of the reasons resumptions were not189 Mesa~\cite{Mesa} is one programming languages that did. Experience with Mesa 190 is quoted as being one of the reasons resumptions are not 138 191 included in the \Cpp standard. 139 192 % https://en.wikipedia.org/wiki/Exception_handling 140 \todo{A comment about why we did include them when they are so unpopular 141 might be approprate.} 142 143 %\subsection 144 Functional languages, tend to use solutions like the return union, but some 145 exception-like constructs still appear. 146 147 For instance Haskell's built in error mechanism can make the result of any 148 expression, including function calls. Any expression that examines an 149 error value will in-turn produce an error. This continues until the main 150 function produces an error or until it is handled by one of the catch 151 functions. 152 153 %\subsection 154 More recently exceptions seem to be vanishing from newer programming 155 languages. 156 Rust and Go reduce this feature to panics. 157 Panicing is somewhere between a termination exception and a program abort. 158 Notably in Rust a panic can trigger either, a panic may unwind the stack or 159 simply kill the process. 193 As a result, resumption has ignored in main-stream programming languages. 194 However, ``what goes around comes around'' and resumption is being revisited now (like user-level threading). 195 While rejecting resumption might have been the right decision in the past, there are decades 196 of developments in computer science that have changed the situation. 197 Some of these developments, such as functional programming's resumption 198 equivalent, algebraic effects\cite{Zhang19}, are enjoying significant success. 199 A complete reexamination of resumptions is beyond this thesis, but their re-emergence is 200 enough to try them in \CFA. 201 % Especially considering how much easier they are to implement than 202 % termination exceptions. 203 204 %\subsection 205 Functional languages tend to use other solutions for their primary EHM, 206 but exception-like constructs still appear. 207 Termination appears in error construct, which marks the result of an 208 expression as an error; thereafter, the result of any expression that tries to use it is also an 209 error, and so on until an appropriate handler is reached. 210 Resumption appears in algebraic effects, where a function dispatches its 211 side-effects to its caller for handling. 212 213 %\subsection 214 Some programming languages have moved to a restricted kind of EHM 215 called ``panic". 216 In Rust~\cite{Rust}, a panic is just a program level abort that may be implemented by 217 unwinding the stack like in termination exception handling. 160 218 % https://doc.rust-lang.org/std/panic/fn.catch_unwind.html 161 Go's panic is much more similar to a termination exception but there is162 only a catch-all function with \code{Go}{recover()}. 163 So exceptions still are appearing, just in reduced forms.164 165 %\subsection 166 Exception handling's most common use cases are in error handling. 167 Here are some other ways to handle errors and comparisons withexceptions.219 In Go~\cite{Go}, a panic is very similar to a termination, except it only supports 220 a catch-all by calling \code{Go}{recover()}, simplifying the interface at 221 the cost of flexibility. 222 223 %\subsection 224 While exception handling's most common use cases are in error handling, 225 here are other ways to handle errors with comparisons to exceptions. 168 226 \begin{itemize} 169 227 \item\emph{Error Codes}: 170 This pattern uses an enumeration (or just a set of fixed values) to indicate 171 that an error has occured and which error it was. 172 173 There are some issues if a function wants to return an error code and another 174 value. The main issue is that it can be easy to forget checking the error 175 code, which can lead to an error being quitely and implicitly ignored. 176 Some new languages have tools that raise warnings if the return value is 177 discarded to avoid this. 178 It also puts more code on the main execution path. 228 This pattern has a function return an enumeration (or just a set of fixed values) to indicate 229 if an error occurred and possibly which error it was. 230 231 Error codes mix exceptional and normal values, artificially enlarging the type and/or value range. 232 Some languages address this issue by returning multiple values or a tuple, separating the error code from the function result. 233 However, the main issue with error codes is forgetting to checking them, 234 which leads to an error being quietly and implicitly ignored. 235 Some new languages have tools that issue warnings, if the error code is 236 discarded to avoid this problem. 237 Checking error codes also results in bloating the main execution path, especially if an error is not dealt with locally and has to be cascaded down the call stack to a higher-level function.. 238 179 239 \item\emph{Special Return with Global Store}: 180 A function that encounters an error returns some value indicating that it 181 encountered a value but store which error occured in a fixed global location. 182 183 Perhaps the C standard @errno@ is the most famous example of this, 184 where some standard library functions will return some non-value (often a 185 NULL pointer) and set @errno@. 186 187 This avoids the multiple results issue encountered with straight error codes 188 but otherwise many of the same advantages and disadvantages. 189 It does however introduce one other major disadvantage: 190 Everything that uses that global location must agree on all possible errors. 240 Some functions only return a boolean indicating success or failure 241 and store the exact reason for the error in a fixed global location. 242 For example, many C routines return non-zero or -1, indicating success or failure, 243 and write error details into the C standard variable @errno@. 244 245 This approach avoids the multiple results issue encountered with straight error codes 246 but otherwise has many (if not more) of the disadvantages. 247 For example, everything that uses the global location must agree on all possible errors and global variable are unsafe with concurrency. 248 191 249 \item\emph{Return Union}: 192 Replaces error codes with a tagged union.250 This pattern replaces error codes with a tagged union. 193 251 Success is one tag and the errors are another. 194 252 It is also possible to make each possible error its own tag and carry its own … … 196 254 so that one type can be used everywhere in error handling code. 197 255 198 This pattern is very popular in functional or semi-functional language,199 anything withprimitive support for tagged unions (or algebraic data types).256 This pattern is very popular in functional or any semi-functional language with 257 primitive support for tagged unions (or algebraic data types). 200 258 % We need listing Rust/rust to format code snipits from it. 201 259 % Rust's \code{rust}{Result<T, E>} 202 203 The main disadvantage is again it puts code on the main execution path.204 This is also the first technique that allows for more information about an 205 error, other than one of a fix-set of ids, to be sent.206 The y can be missed but some languages can force that they are checked.207 It is also implicitly forced in any languages with checked union access. 260 The main advantage is providing for more information about an 261 error, other than one of a fix-set of ids. 262 While some languages use checked union access to force error-code checking, 263 it is still possible to bypass the checking. 264 The main disadvantage is again significant error code on the main execution path and cascading through called functions. 265 208 266 \item\emph{Handler Functions}: 209 On error the function that produced the error calls another function to 267 This pattern implicitly associates functions with errors. 268 On error, the function that produced the error implicitly calls another function to 210 269 handle it. 211 270 The handler function can be provided locally (passed in as an argument, 212 271 either directly as as a field of a structure/object) or globally (a global 213 272 variable). 214 215 C++ uses this as its fallback system if exception handling fails. 273 C++ uses this approach as its fallback system if exception handling fails, \eg 216 274 \snake{std::terminate_handler} and for a time \snake{std::unexpected_handler} 217 275 218 Handler functions work a lot like resumption exceptions .219 The difference is they are more expencive to set up but cheaper to use, and220 so are more suited to more fequent errors.221 The exception being global handlers if they are rarely change as the time222 in both cases strinks towards zero.276 Handler functions work a lot like resumption exceptions, without the dynamic handler search. 277 Therefore, setting setting up the handler can be more complex/expensive, especially if the handle must be passed through multiple function calls, but cheaper to call $O(1)$, and hence, 278 are more suited to frequent exceptional situations. 279 % The exception being global handlers if they are rarely change as the time 280 % in both cases shrinks towards zero. 223 281 \end{itemize} 224 282 225 283 %\subsection 226 Because of their cost exceptions are rarely used for hot paths of execution. 227 There is an element of self-fulfilling prophocy here as implementation 228 techniques have been designed to make exceptions cheap to set-up at the cost 229 of making them expencive to use. 230 Still, use of exceptions for other tasks is more common in higher-level 231 scripting languages. 232 An iconic example is Python's StopIteration exception which is thrown by 233 an iterator to indicate that it is exausted. Combined with Python's heavy 234 use of the iterator based for-loop. 284 Because of their cost, exceptions are rarely used for hot paths of execution. 285 Therefore, there is an element of self-fulfilling prophecy for implementation 286 techniques to make exceptions cheap to set-up at the cost 287 of expensive usage. 288 This cost differential is less important in higher-level scripting languages, where use of exceptions for other tasks is more common. 289 An iconic example is Python's @StopIteration@ exception that is thrown by 290 an iterator to indicate that it is exhausted, especially when combined with Python's heavy 291 use of the iterator-based for-loop. 235 292 % https://docs.python.org/3/library/exceptions.html#StopIteration -
doc/theses/andrew_beach_MMath/performance.tex
r0640189e r5541ea3d 1 1 \chapter{Performance} 2 2 \label{c:performance} 3 4 \textbf{Just because of the stage of testing there are design notes for5 the tests as well as commentary on them.}6 3 7 4 Performance has been of secondary importance for most of this project. … … 11 8 12 9 \section{Test Set-Up} 13 Tests will be run on \CFA, C++ and Java. 10 Tests will be run in \CFA, C++, Java and Python. 11 In addition there are two sets of tests for \CFA, 12 one for termination exceptions and once with resumption exceptions. 14 13 15 14 C++ is the most comparable language because both it and \CFA use the same … … 18 17 comparison. \CFA's EHM has had significantly less time to be optimized and 19 18 does not generate its own assembly. It does have a slight advantage in that 20 there are some features it does not handle. 19 there are some features it does not handle, through utility functions, 20 but otherwise \Cpp has a significant advantage. 21 21 22 22 Java is another very popular language with similar termination semantics. … … 25 25 It also implements the finally clause on try blocks allowing for a direct 26 26 feature-to-feature comparison. 27 As with \Cpp, Java's implementation is more mature, has more optimizations 28 and more extra features. 29 30 Python was used as a point of comparison because of the \CFA EHM's 31 current performance goals, which is not be prohibitively slow while the 32 features are designed and examined. Python has similar performance goals for 33 creating quick scripts and its wide use suggests it has achieved those goals. 34 35 Unfortunately there are no notable modern programming languages with 36 resumption exceptions. Even the older programming languages with resumptions 37 seem to be notable only for having resumptions. 38 So instead resumptions are compared to a less similar but much more familiar 39 feature, termination exceptions. 27 40 28 41 All tests are run inside a main loop which will perform the test 29 42 repeatedly. This is to avoids start-up or tear-down time from 30 43 affecting the timing results. 31 A consequence of this is that tests cannot terminate the program, 32 which does limit how tests can be implemented. 33 There are catch-alls to keep unhandled 34 exceptions from terminating tests. 44 Most test were run 1 000 000 (a million) times. 45 The Java versions of the test also run this loop an extra 1000 times before 46 beginning to time the results to ``warm-up" the JVM. 47 48 Timing is done internally, with time measured immediately before and 49 immediately after the test loop. The difference is calculated and printed. 50 51 The loop structure and internal timing means it is impossible to test 52 unhandled exceptions in \Cpp and Java as that would cause the process to 53 terminate. 54 Luckily, performance on the ``give-up and kill the process" path is not 55 critical. 35 56 36 57 The exceptions used in these tests will always be a exception based off of 37 58 the base exception. This requirement minimizes performance differences based 38 on the object model. 39 Catch-alls are done by catching the root exception type (not using \Cpp's 40 \code{C++}{catch(...)}). 59 on the object model used to repersent the exception. 41 60 42 Tests run in Java were not warmed because exception code paths should not be 43 hot. 61 All tests were designed to be as minimal as possible while still preventing 62 exessive optimizations. 63 For example, empty inline assembly blocks are used in \CFA and \Cpp to 64 prevent excessive optimizations while adding no actual work. 65 66 % We don't use catch-alls but if we did: 67 % Catch-alls are done by catching the root exception type (not using \Cpp's 68 % \code{C++}{catch(...)}). 44 69 45 70 \section{Tests} … … 47 72 components of the exception system. 48 73 The should provide a guide as to where the EHM's costs can be found. 49 50 Tests are run in \CFA, \Cpp and Java.51 Not every test is run in every language, if the feature under test is missing52 the test is skipped. These cases will be noted.53 In addition to the termination tests for every language,54 \CFA has a second set of tests that test resumption. These are the same55 except that the raise statements and handler clauses are replaced with the56 resumption variants.57 74 58 75 \paragraph{Raise and Handle} … … 62 79 start-up and shutdown on the results. 63 80 Each iteration of the main loop 64 \begin{itemize} 81 \begin{itemize}[nosep] 65 82 \item Empty Function: 66 83 The repeating function is empty except for the necessary control code. … … 68 85 The repeating function creates an object with a destructor before calling 69 86 itself. 70 (Java is skipped as it does not destructors.)71 87 \item Finally: 72 88 The repeating function calls itself inside a try block with a finally clause 73 89 attached. 74 (\Cpp is skipped as it does not have finally clauses.)75 90 \item Other Handler: 76 91 The repeating function calls itself inside a try block with a handler that … … 84 99 In each iteration, a try statement is executed. Entering and leaving a loop 85 100 is all the test wants to do. 86 \begin{itemize} 101 \begin{itemize}[nosep] 87 102 \item Handler: 88 103 The try statement has a handler (of the matching kind). … … 95 110 Only \CFA implements the language level conditional match, 96 111 the other languages must mimic with an ``unconditional" match (it still 97 checks the exception's type) and conditional re-raise. 98 \begin{itemize} 99 \item Catch All: 112 checks the exception's type) and conditional re-raise if it was not supposed 113 to handle that exception. 114 \begin{itemize}[nosep] 115 \item Match All: 100 116 The condition is always true. (Always matches or never re-raises.) 101 \item Catch None:117 \item Match None: 102 118 The condition is always false. (Never matches or always re-raises.) 103 119 \end{itemize} … … 113 129 %related to -fexceptions.) 114 130 115 % Some languages I left out: 116 % Python: Its a scripting language, different 117 % uC++: Not well known and should the same results as C++, except for 118 % resumption which should be the same. 131 \section{Results} 132 Each test is was run five times, the best and worst result were discarded and 133 the remaining values were averaged. 119 134 120 %\section{Resumption Comparison} 121 \todo{Can we find a good language to compare resumptions in.} 135 In cases where a feature is not supported by a language the test is skipped 136 for that language. Similarly, if a test is does not change between resumption 137 and termination in \CFA, then only one test is written and the result 138 was put into the termination column. 139 140 \begin{tabular}{|l|c c c c c|} 141 \hline 142 & \CFA (Terminate) & \CFA (Resume) & \Cpp & Java & Python \\ 143 \hline 144 Raise Empty & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 145 Raise D'tor & 0.0 & 0.0 & 0.0 & N/A & N/A \\ 146 Raise Finally & 0.0 & 0.0 & N/A & 0.0 & 0.0 \\ 147 Raise Other & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 148 Cross Handler & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 149 Cross Finally & 0.0 & N/A & N/A & 0.0 & 0.0 \\ 150 Match All & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 151 Match None & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ 152 \hline 153 \end{tabular} -
doc/theses/andrew_beach_MMath/uw-ethesis.tex
r0640189e r5541ea3d 210 210 \lstMakeShortInline@ 211 211 \lstset{language=CFA,style=cfacommon,basicstyle=\linespread{0.9}\tt} 212 \lstset{moredelim=**[is][\protect\color{red}]{@}{@}} 212 % PAB causes problems with inline @= 213 %\lstset{moredelim=**[is][\protect\color{red}]{@}{@}} 213 214 % Annotations from Peter: 214 215 \newcommand{\PAB}[1]{{\color{blue}PAB: #1}}
Note:
See TracChangeset
for help on using the changeset viewer.