Changeset 812ba3d
- Timestamp:
- Sep 7, 2021, 9:59:12 AM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 2bfee8e
- Parents:
- 49b3389
- Location:
- doc/theses/andrew_beach_MMath/code
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/fixup-empty-f.cfa
r49b3389 r812ba3d 2 2 #include <clock.hfa> 3 3 #include <fstream.hfa> 4 #include <stdlib.hfa> // strto4 #include <stdlib.hfa> 5 5 6 6 void nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) { 7 7 if (frames) { 8 8 nounwind_fixup(frames - 1, raised_rtn); 9 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 9 // "Always" false, but prevents recursion elimination. 10 if (-1 == frames) printf("~"); 10 11 } else { 11 12 int fixup = 17; … … 24 25 } 25 26 27 // Closures at the top level are allowed to be true closures. 26 28 void raised(int & fixup) { 27 fixup = total_frames + 42; // use local scope => lexical link28 if ( total_frames == 42 ) printf( "42");29 fixup = total_frames + 42; 30 if (total_frames == 42) printf("42"); 29 31 } 30 32 -
doc/theses/andrew_beach_MMath/code/fixup-empty-r.cfa
r49b3389 r812ba3d 3 3 #include <exception.hfa> 4 4 #include <fstream.hfa> 5 #include <stdlib.hfa> // strto5 #include <stdlib.hfa> 6 6 7 7 exception fixup_exception { … … 13 13 if (frames) { 14 14 nounwind_empty(frames - 1); 15 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 15 // "Always" false, but prevents recursion elimination. 16 if (-1 == frames) printf("~"); 16 17 } else { 17 18 int fixup = 17; 18 throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup19 throwResume (fixup_exception){&fixup_vt, fixup}; 19 20 } 20 21 } -
doc/theses/andrew_beach_MMath/code/fixup-other-f.cfa
r49b3389 r812ba3d 2 2 #include <clock.hfa> 3 3 #include <fstream.hfa> 4 #include <stdlib.hfa> // strto4 #include <stdlib.hfa> 5 5 6 unsigned int frames; // use global because of gcc thunk problem 6 // Using a global value to allow hoisting (and avoid thunks). 7 unsigned int frames; 7 8 8 9 void nounwind_fixup(unsigned int dummy, void (*raised_rtn)(int &), void (*not_raised_rtn)(int &)) { 9 10 void not_raised(int & fixup) { 10 fixup = frames + 42; // use local scope => lexical link11 fixup = frames + 42; 11 12 } 12 13 … … 14 15 frames -= 1; 15 16 nounwind_fixup(42, raised_rtn, not_raised); 16 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 17 // Always false, but prevents recursion elimination. 18 if (-1 == frames) printf("~"); 17 19 } else { 18 20 int fixup = dummy; … … 32 34 frames = total_frames; 33 35 36 // Closures at the top level are allowed to be true closures. 34 37 void raised(int & fixup) { 35 fixup = total_frames + 42; // use local scope => lexical link38 fixup = total_frames + 42; 36 39 } 37 40 void not_raised(int & fixup) { 38 fixup = total_frames + 42; // use local scope => lexical link41 fixup = total_frames + 42; 39 42 } 40 43 -
doc/theses/andrew_beach_MMath/code/fixup-other-r.cfa
r49b3389 r812ba3d 3 3 #include <exception.hfa> 4 4 #include <fstream.hfa> 5 #include <stdlib.hfa> // strto5 #include <stdlib.hfa> 6 6 7 7 exception fixup_exception { … … 13 13 }; 14 14 15 unsigned int frames; // use global because of gcc thunk problem 15 // Using a global value to allow hoisting (and avoid thunks). 16 unsigned int frames; 16 17 17 18 void nounwind_other(unsigned int dummy) { … … 20 21 try { 21 22 nounwind_other(42); 22 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 23 // Always false, but prevents recursion elimination. 24 if (-1 == frames) printf("~"); 23 25 } catchResume (not_raised_exception * ex) { 24 ex->fixup = frames + 42; // use local scope => lexical link26 ex->fixup = frames + 42; 25 27 } 26 28 } else { 27 29 int fixup = dummy; 28 throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup30 throwResume (fixup_exception){&fixup_vt, fixup}; 29 31 } 30 32 } -
doc/theses/andrew_beach_MMath/code/test.sh
r49b3389 r812ba3d 12 12 # test.sh -v LANGUAGE TEST FILE 13 13 # View the result from TEST in LANGUAGE stored in FILE. 14 15 readonly DIR=$(dirname "$(readlink -f "$0")") 16 cd $DIR 14 17 15 18 readonly MIL=000000
Note: See TracChangeset
for help on using the changeset viewer.