Changeset 18783b4 for doc/theses/andrew_beach_MMath/code
- Timestamp:
- Sep 4, 2021, 10:34:43 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 49b3389
- Parents:
- f450f2f
- Location:
- doc/theses/andrew_beach_MMath/code
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/fixup-empty-f.cfa
rf450f2f r18783b4 4 4 #include <stdlib.hfa> // strto 5 5 6 intnounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) {6 void nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) { 7 7 if (frames) { 8 int rtn = nounwind_fixup(frames - 1, raised_rtn); 9 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 10 return rtn; 11 8 nounwind_fixup(frames - 1, raised_rtn); 9 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 12 10 } else { 13 11 int fixup = 17; 14 12 raised_rtn(fixup); 15 return fixup;16 13 } 17 14 } -
doc/theses/andrew_beach_MMath/code/fixup-empty-r.cfa
rf450f2f r18783b4 10 10 vtable(fixup_exception) fixup_vt; 11 11 12 intnounwind_empty(unsigned int frames) {12 void nounwind_empty(unsigned int frames) { 13 13 if (frames) { 14 int rtn = nounwind_empty(frames - 1); 15 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 16 return rtn; 14 nounwind_empty(frames - 1); 15 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 17 16 } else { 18 17 int fixup = 17; 19 18 throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup 20 return fixup;21 19 } 22 20 } -
doc/theses/andrew_beach_MMath/code/fixup-other-f.cfa
rf450f2f r18783b4 14 14 frames -= 1; 15 15 nounwind_fixup(42, raised_rtn, not_raised); 16 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 16 17 } else { 17 18 int fixup = dummy; -
doc/theses/andrew_beach_MMath/code/fixup-other-r.cfa
rf450f2f r18783b4 20 20 try { 21 21 nounwind_other(42); 22 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 22 23 } catchResume (not_raised_exception * ex) { 23 24 ex->fixup = frames + 42; // use local scope => lexical link -
doc/theses/andrew_beach_MMath/code/resume-empty.cfa
rf450f2f r18783b4 11 11 if (frames) { 12 12 nounwind_empty(frames - 1); 13 if ( frames == -1 ) printf( "42" ); // prevent recursion optimizations 13 14 } else { 14 15 throwResume (empty_exception){&empty_vt};
Note: See TracChangeset
for help on using the changeset viewer.