Changes in / [2bfee8e:1341ce1]


Ignore:
Files:
6 deleted
8 edited

Legend:

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

    r2bfee8e r1341ce1  
    22#include <clock.hfa>
    33#include <fstream.hfa>
    4 #include <stdlib.hfa>
     4#include <stdlib.hfa>                                                                   // strto
    55
    6 void nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) {
     6int nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) {
    77        if (frames) {
    8                 nounwind_fixup(frames - 1, raised_rtn);
    9                 // "Always" false, but prevents recursion elimination.
    10                 if (-1 == frames) printf("~");
     8                int rtn = nounwind_fixup(frames - 1, raised_rtn);
     9                if ( rtn == 42 ) printf( "42" );                                // make non-tail recursive
     10                return rtn;
     11
    1112        } else {
    1213                int fixup = 17;
    1314                raised_rtn(fixup);
     15                return fixup;
    1416        }
    1517}
     
    2527        }
    2628
    27         // Closures at the top level are allowed to be true closures.
    2829        void raised(int & fixup) {
    29                 fixup = total_frames + 42;
    30                 if (total_frames == 42) printf("42");
     30                fixup = total_frames + 42;                                              // use local scope => lexical link
     31                if ( total_frames == 42 ) printf( "42" );
    3132        }
    3233
  • doc/theses/andrew_beach_MMath/code/fixup-empty-r.cfa

    r2bfee8e r1341ce1  
    33#include <exception.hfa>
    44#include <fstream.hfa>
    5 #include <stdlib.hfa>
     5#include <stdlib.hfa>                                                                   // strto
    66
    77exception fixup_exception {
     
    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);
    15                 // "Always" false, but prevents recursion elimination.
    16                 if (-1 == frames) printf("~");
     14                int rtn = nounwind_empty(frames - 1);
     15                if ( rtn == 42 ) printf( "42" );                                // make non-tail recursive
     16                return rtn;
    1717        } else {
    1818                int fixup = 17;
    19                 throwResume (fixup_exception){&fixup_vt, fixup};
     19                throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup
     20                return fixup;
    2021        }
    2122}
  • doc/theses/andrew_beach_MMath/code/fixup-other-f.cfa

    r2bfee8e r1341ce1  
    22#include <clock.hfa>
    33#include <fstream.hfa>
    4 #include <stdlib.hfa>
     4#include <stdlib.hfa>                                                                   // strto
    55
    6 // Using a global value to allow hoisting (and avoid thunks).
    7 unsigned int frames;
     6unsigned int frames;                                                                    // use global because of gcc thunk problem
    87
    98void nounwind_fixup(unsigned int dummy, void (*raised_rtn)(int &), void (*not_raised_rtn)(int &)) {
    109        void not_raised(int & fixup) {
    11                 fixup = frames + 42;
     10                fixup = frames + 42;                                                    // use local scope => lexical link
    1211        }
    1312
     
    1514                frames -= 1;
    1615                nounwind_fixup(42, raised_rtn, not_raised);
    17                 // Always false, but prevents recursion elimination.
    18                 if (-1 == frames) printf("~");
    1916        } else {
    2017                int fixup = dummy;
     
    3431        frames = total_frames;
    3532
    36         // Closures at the top level are allowed to be true closures.
    3733        void raised(int & fixup) {
    38                 fixup = total_frames + 42;
     34                fixup = total_frames + 42;                                              // use local scope => lexical link
    3935        }
    4036        void not_raised(int & fixup) {
    41                 fixup = total_frames + 42;
     37                fixup = total_frames + 42;                                              // use local scope => lexical link
    4238        }
    4339
  • doc/theses/andrew_beach_MMath/code/fixup-other-r.cfa

    r2bfee8e r1341ce1  
    33#include <exception.hfa>
    44#include <fstream.hfa>
    5 #include <stdlib.hfa>
     5#include <stdlib.hfa>                                                                   // strto
    66
    77exception fixup_exception {
     
    1313};
    1414
    15 // Using a global value to allow hoisting (and avoid thunks).
    16 unsigned int frames;
     15unsigned int frames;                                                                    // use global because of gcc thunk problem
    1716
    1817void nounwind_other(unsigned int dummy) {
     
    2120                try {
    2221                        nounwind_other(42);
    23                         // Always false, but prevents recursion elimination.
    24                         if (-1 == frames) printf("~");
    2522                } catchResume (not_raised_exception * ex) {
    26                         ex->fixup = frames + 42;
     23                        ex->fixup = frames + 42;                                        // use local scope => lexical link
    2724                }
    2825        } else {
    2926                int fixup = dummy;
    30                 throwResume (fixup_exception){&fixup_vt, fixup};
     27                throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup
    3128        }
    3229}
  • doc/theses/andrew_beach_MMath/code/resume-empty.cfa

    r2bfee8e r1341ce1  
    1111        if (frames) {
    1212                nounwind_empty(frames - 1);
    13                 if ( frames == -1 ) printf( "42" );                             // prevent recursion optimizations
    1413        } else {
    1514                throwResume (empty_exception){&empty_vt};
  • doc/theses/andrew_beach_MMath/code/test.sh

    r2bfee8e r1341ce1  
    1212# test.sh -v LANGUAGE TEST FILE
    1313#   View the result from TEST in LANGUAGE stored in FILE.
    14 
    15 readonly DIR=$(dirname "$(readlink -f "$0")")
    16 cd $DIR
    1714
    1815readonly MIL=000000
  • doc/theses/andrew_beach_MMath/code/throw-empty.cpp

    r2bfee8e r1341ce1  
    11// Throw Across Empty Function
    22#include <chrono>
    3 #include <cstdio>
    43#include <cstdlib>
    54#include <exception>
     
    1514        if (frames) {
    1615                unwind_empty(frames - 1);
    17                 if (-1 == frames) printf("~");
    1816        } else {
    1917                throw (EmptyException){};
  • libcfa/src/Makefile.am

    r2bfee8e r1341ce1  
    8787        containers/pair.hfa \
    8888        containers/result.hfa \
    89         containers/string.hfa \
    90         containers/string_res.hfa \
    9189        containers/vector.hfa \
    9290        device/cpu.hfa
Note: See TracChangeset for help on using the changeset viewer.