Changeset 86fc350 for doc/theses/andrew_beach_MMath/code
- Timestamp:
- Jul 20, 2021, 6:34:22 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6acd020, f9d8755
- Parents:
- d30804a (diff), 54651005 (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/code
- Files:
-
- 8 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/cond-catch.cfa
rd30804a r86fc350 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
rd30804a r86fc350 19 19 throw_exception(); 20 20 } catch (EmptyException & exc) { 21 if ( should_catch) {21 if (!should_catch) { 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
rd30804a r86fc350 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
rd30804a r86fc350 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 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" : "=rm" (should_throw)); 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
rd30804a r86fc350 11 11 int main(int argc, char * argv[]) { 12 12 unsigned int times = 1; 13 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" : "=rm" (should_throw)); 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
rd30804a r86fc350 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 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" : "=rm" (should_throw)); 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
rd30804a r86fc350 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
rd30804a r86fc350 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 18 if (frames) { 19 19 20 21 22 23 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 39 40 41 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
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 18 18 *.cfa) 19 19 # Requires a symbolic link. 20 mmake "${1%.cfa}" "$1" ./cfa "$1" -o "${1%.cfa}"20 mmake "${1%.cfa}" "$1" ./cfa -DNDEBUG -nodebug -O3 "$1" -o "${1%.cfa}" 21 21 ;; 22 22 *.cpp) 23 mmake "${1%.cpp}-cpp" "$1" g++ "$1" -o "${1%.cpp}-cpp"23 mmake "${1%.cpp}-cpp" "$1" g++ -DNDEBUG -O3 "$1" -o "${1%.cpp}-cpp" 24 24 ;; 25 25 *.java) … … 39 39 exit 0 40 40 elif [ 2 -eq "$#" ]; then 41 42 41 TEST_LANG="$1" 42 TEST_CASE="$2" 43 43 else 44 45 44 echo "Unknown call pattern." >&2 45 exit 2 46 46 fi 47 47 … … 58 58 CPP="./cond-catch-cpp $ITERATIONS 1" 59 59 JAVA="java CondCatch $ITERATIONS 1" 60 PYTHON="./cond_catch.py $ITERATIONS 1" 60 61 ;; 61 62 cond-match-none) … … 64 65 CPP="./cond-catch-cpp $ITERATIONS 0" 65 66 JAVA="java CondCatch $ITERATIONS 0" 67 PYTHON="./cond_catch.py $ITERATIONS 0" 66 68 ;; 67 69 cross-catch) … … 70 72 CPP="./cross-catch-cpp $ITERATIONS" 71 73 JAVA="java CrossCatch $ITERATIONS" 74 PYTHON="./cross_catch.py $ITERATIONS" 72 75 ;; 73 76 cross-finally) … … 76 79 CPP=unsupported 77 80 JAVA="java CrossFinally $ITERATIONS" 81 PYTHON="./cross_finally.py $ITERATIONS" 78 82 ;; 79 83 raise-detor) … … 82 86 CPP="./throw-detor-cpp $ITERATIONS $STACK_HEIGHT" 83 87 JAVA=unsupported 88 PYTHON=unsupported 84 89 ;; 85 90 raise-empty) … … 88 93 CPP="./throw-empty-cpp $ITERATIONS $STACK_HEIGHT" 89 94 JAVA="java ThrowEmpty $ITERATIONS $STACK_HEIGHT" 95 PYTHON="./throw_empty.py $ITERATIONS $STACK_HEIGHT" 90 96 ;; 91 97 raise-finally) … … 94 100 CPP=unsupported 95 101 JAVA="java ThrowFinally $ITERATIONS $STACK_HEIGHT" 102 PYTHON="./throw_finally.py $ITERATIONS $STACK_HEIGHT" 96 103 ;; 97 104 raise-other) … … 100 107 CPP="./throw-other-cpp $ITERATIONS $STACK_HEIGHT" 101 108 JAVA="java ThrowOther $ITERATIONS $STACK_HEIGHT" 109 PYTHON="./throw_other.py $ITERATIONS $STACK_HEIGHT" 102 110 ;; 103 111 *) … … 112 120 cpp) echo $CPP; $CPP;; 113 121 java) echo $JAVA; $JAVA;; 122 python) echo $PYTHON; $PYTHON;; 114 123 *) 115 124 echo "No such language: $TEST_LANG" >&2 116 125 exit 2 126 ;; 117 127 esac -
doc/theses/andrew_beach_MMath/code/throw-detor.cfa
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 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
rd30804a r86fc350 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 }
Note:
See TracChangeset
for help on using the changeset viewer.