Changeset 812ba3d for doc/theses/andrew_beach_MMath/code/fixup-other-f.cfa
- Timestamp:
- Sep 7, 2021, 9:59:12 AM (19 months ago)
- Branches:
- enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 2bfee8e
- Parents:
- 49b3389
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.