Ignore:
Timestamp:
Aug 30, 2021, 9:01:51 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
2a3f0d9
Parents:
9cb6514
Message:

add code to prevent tail recursion optimization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/resume-fixup-empty-r.cfa

    r9cb6514 r01f78e0  
    1010vtable(fixup_exception) fixup_vt;
    1111
    12 void nounwind_empty(unsigned int frames) {
     12int nounwind_empty(unsigned int frames) {
    1313        if (frames) {
    14                 nounwind_empty(frames - 1);
     14                int rtn = nounwind_empty(frames - 1);
     15                if ( rtn == 42 ) printf( "42" );                                // make non-tail recursive
     16                return rtn;
    1517        } else {
    1618                int fixup = 17;
    1719                throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup
     20                return fixup;
    1821        }
    1922}
Note: See TracChangeset for help on using the changeset viewer.