Changeset 5541ea3d for doc/theses/andrew_beach_MMath/code
- Timestamp:
- Aug 4, 2021, 2:40:11 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- 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/code
- Files:
-
- 1 added
- 21 edited
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 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
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 }
Note:
See TracChangeset
for help on using the changeset viewer.