Ignore:
Timestamp:
Jul 20, 2021, 6:34:22 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6acd020, f9d8755
Parents:
d30804a (diff), 54651005 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
doc/theses/andrew_beach_MMath/code
Files:
8 added
19 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/code/cond-catch.cfa

    rd30804a r86fc350  
    1919                throw_exception();
    2020        } catch (empty_exception * exc ; should_catch) {
    21                 // ...
     21                asm volatile ("# catch block (conditional)");
    2222        }
    2323}
     
    3737                        cond_catch();
    3838                } catch (empty_exception * exc) {
    39                         // ...
     39                        asm volatile ("# catch block (unconditional)");
    4040                }
    4141        }
  • doc/theses/andrew_beach_MMath/code/cond-catch.cpp

    rd30804a r86fc350  
    1919                throw_exception();
    2020        } catch (EmptyException & exc) {
    21                 if (should_catch) {
     21                if (!should_catch) {
    2222                        throw;
    2323                }
     24                asm volatile ("# catch block (conditional)");
    2425        }
    2526}
     
    3940                        cond_catch();
    4041                } catch (EmptyException &) {
    41                         // ...
     42                        asm volatile ("# catch block (unconditional)");
    4243                }
    4344    }
  • doc/theses/andrew_beach_MMath/code/cond-fixup.cfa

    rd30804a r86fc350  
    1212
    1313void throw_exception() {
    14         throw (empty_exception){&empty_vt};
     14        throwResume (empty_exception){&empty_vt};
    1515}
    1616
     
    1818        try {
    1919                throw_exception();
    20         } catch (empty_exception * exc ; should_catch) {
    21                 // ...
     20        } catchResume (empty_exception * exc ; should_catch) {
     21                asm volatile ("# fixup block (conditional)");
    2222        }
    2323}
     
    3636                try {
    3737                        cond_catch();
    38                 } catch (empty_exception * exc) {
    39                         // ...
     38                } catchResume (empty_exception * exc) {
     39                        asm volatile ("# fixup block (unconditional)");
    4040                }
    4141        }
  • doc/theses/andrew_beach_MMath/code/cross-catch.cfa

    rd30804a r86fc350  
    77EHM_EXCEPTION(not_raised_exception)();
    88
     9EHM_VIRTUAL_TABLE(not_raised_exception, not_vt);
     10
    911int main(int argc, char * argv[]) {
    1012        unsigned int times = 1;
    11         unsigned int total_frames = 1;
     13        bool should_throw = false;
    1214        if (1 < argc) {
    1315                times = strtol(argv[1], 0p, 10);
    14         }
    15         if (2 < argc) {
    16                 total_frames = strtol(argv[2], 0p, 10);
    1716        }
    1817
     
    2019        for (unsigned int count = 0 ; count < times ; ++count) {
    2120                try {
    22                         // ...
     21                        asm volatile ("# try block" : "=rm" (should_throw));
     22                        if (should_throw) {
     23                                throw (not_raised_exception){&not_vt};
     24                        }
    2325                } catch (not_raised_exception *) {
    24                         // ...
     26                        asm volatile ("# catch block");
    2527                }
    2628        }
  • doc/theses/andrew_beach_MMath/code/cross-catch.cpp

    rd30804a r86fc350  
    1111int main(int argc, char * argv[]) {
    1212        unsigned int times = 1;
     13        bool should_throw = false;
    1314        if (1 < argc) {
    1415                times = strtol(argv[1], nullptr, 10);
     
    1819        for (unsigned int count = 0 ; count < times ; ++count) {
    1920                try {
    20                         // ...
     21                        asm volatile ("# try block" : "=rm" (should_throw));
     22                        if (should_throw) {
     23                                throw NotRaisedException();
     24                        }
    2125                } catch (NotRaisedException &) {
    22                         // ...
     26                        asm volatile ("# catch block");
    2327                }
    2428        }
  • doc/theses/andrew_beach_MMath/code/cross-finally.cfa

    rd30804a r86fc350  
    55#include <stdlib.hfa>
    66
     7EHM_EXCEPTION(not_raised_exception)();
     8
     9EHM_VIRTUAL_TABLE(not_raised_exception, not_vt);
     10
    711int main(int argc, char * argv[]) {
    812        unsigned int times = 1;
    9         unsigned int total_frames = 1;
     13        bool should_throw = false;
    1014        if (1 < argc) {
    1115                times = strtol(argv[1], 0p, 10);
    12         }
    13         if (2 < argc) {
    14                 total_frames = strtol(argv[2], 0p, 10);
    1516        }
    1617
    1718        Time start_time = timeHiRes();
    1819        for (unsigned int count = 0 ; count < times ; ++count) {
    19                  try {
    20                         // ...
     20                try {
     21                        asm volatile ("# try block" : "=rm" (should_throw));
     22                        if (should_throw) {
     23                                throw (not_raised_exception){&not_vt};
     24                        }
    2125                } finally {
    22                         // ...
     26                        asm volatile ("# finally block");
    2327                }
    2428        }
  • doc/theses/andrew_beach_MMath/code/cross-resume.cfa

    rd30804a r86fc350  
    2020        for (unsigned int count = 0 ; count < times ; ++count) {
    2121                try {
    22                         // ...
     22                        asm volatile ("");
    2323                } catchResume (not_raised_exception *) {
    24                         // ...
     24                        asm volatile ("");
    2525                }
    2626        }
  • doc/theses/andrew_beach_MMath/code/resume-detor.cfa

    rd30804a r86fc350  
    1212
    1313void ^?{}(WithDestructor & this) {
    14     // ...
     14        asm volatile ("# destructor body");
    1515}
    1616
    1717void unwind_destructor(unsigned int frames) {
    18     if (frames) {
     18        if (frames) {
    1919
    20         WithDestructor object;
    21         unwind_destructor(frames - 1);
    22     } else {
    23         throwResume (empty_exception){&empty_vt};
    24     }
     20                WithDestructor object;
     21                unwind_destructor(frames - 1);
     22        } else {
     23                throwResume (empty_exception){&empty_vt};
     24        }
    2525}
    2626
     
    3636
    3737        Time start_time = timeHiRes();
    38     for (int count = 0 ; count < times ; ++count) {
    39         try {
    40             unwind_destructor(total_frames);
    41         } catchResume (empty_exception *) {
    42             // ...
    43         }
    44     }
     38        for (int count = 0 ; count < times ; ++count) {
     39                try {
     40                        unwind_destructor(total_frames);
     41                } catchResume (empty_exception *) {
     42                        asm volatile ("# fixup block");
     43                }
     44        }
    4545        Time end_time = timeHiRes();
    4646        sout | "Run-Time (ns): " | (end_time - start_time)`ns;
  • doc/theses/andrew_beach_MMath/code/resume-empty.cfa

    rd30804a r86fc350  
    1313                unwind_empty(frames - 1);
    1414        } else {
    15                 throw (empty_exception){&empty_vt};
     15                throwResume (empty_exception){&empty_vt};
    1616        }
    1717}
     
    3131                try {
    3232                        unwind_empty(total_frames);
    33                 } catch (empty_exception *) {
    34                         // ...
     33                } catchResume (empty_exception *) {
     34                        asm volatile ("# fixup block");
    3535                }
    3636        }
  • doc/theses/andrew_beach_MMath/code/resume-finally.cfa

    rd30804a r86fc350  
    1414                        unwind_finally(frames - 1);
    1515                } finally {
    16                         // ...
     16                        asm volatile ("# finally block");
    1717                }
    1818        } else {
     
    3636                        unwind_finally(total_frames);
    3737                } catchResume (empty_exception *) {
    38                         // ...
     38                        asm volatile ("# fixup block");
    3939                }
    4040        }
  • doc/theses/andrew_beach_MMath/code/resume-other.cfa

    rd30804a r86fc350  
    1616                        unwind_other(frames - 1);
    1717                } catchResume (not_raised_exception *) {
    18                         // ...
     18                        asm volatile ("# fixup block (stack)");
    1919                }
    2020        } else {
     
    3838                        unwind_other(total_frames);
    3939                } catchResume (empty_exception *) {
    40                         // ...
     40                        asm volatile ("# fixup block (base)");
    4141                }
    4242        }
  • doc/theses/andrew_beach_MMath/code/test.sh

    rd30804a r86fc350  
    1818        *.cfa)
    1919                # Requires a symbolic link.
    20                 mmake "${1%.cfa}" "$1" ./cfa "$1" -o "${1%.cfa}"
     20                mmake "${1%.cfa}" "$1" ./cfa -DNDEBUG -nodebug -O3 "$1" -o "${1%.cfa}"
    2121                ;;
    2222        *.cpp)
    23                 mmake "${1%.cpp}-cpp" "$1" g++ "$1" -o "${1%.cpp}-cpp"
     23                mmake "${1%.cpp}-cpp" "$1" g++ -DNDEBUG -O3 "$1" -o "${1%.cpp}-cpp"
    2424                ;;
    2525        *.java)
     
    3939        exit 0
    4040elif [ 2 -eq "$#" ]; then
    41     TEST_LANG="$1"
    42     TEST_CASE="$2"
     41        TEST_LANG="$1"
     42        TEST_CASE="$2"
    4343else
    44     echo "Unknown call pattern." >&2
    45     exit 2
     44        echo "Unknown call pattern." >&2
     45        exit 2
    4646fi
    4747
     
    5858        CPP="./cond-catch-cpp $ITERATIONS 1"
    5959        JAVA="java CondCatch $ITERATIONS 1"
     60        PYTHON="./cond_catch.py $ITERATIONS 1"
    6061        ;;
    6162cond-match-none)
     
    6465        CPP="./cond-catch-cpp $ITERATIONS 0"
    6566        JAVA="java CondCatch $ITERATIONS 0"
     67        PYTHON="./cond_catch.py $ITERATIONS 0"
    6668        ;;
    6769cross-catch)
     
    7072        CPP="./cross-catch-cpp $ITERATIONS"
    7173        JAVA="java CrossCatch $ITERATIONS"
     74        PYTHON="./cross_catch.py $ITERATIONS"
    7275        ;;
    7376cross-finally)
     
    7679        CPP=unsupported
    7780        JAVA="java CrossFinally $ITERATIONS"
     81        PYTHON="./cross_finally.py $ITERATIONS"
    7882        ;;
    7983raise-detor)
     
    8286        CPP="./throw-detor-cpp $ITERATIONS $STACK_HEIGHT"
    8387        JAVA=unsupported
     88        PYTHON=unsupported
    8489        ;;
    8590raise-empty)
     
    8893        CPP="./throw-empty-cpp $ITERATIONS $STACK_HEIGHT"
    8994        JAVA="java ThrowEmpty $ITERATIONS $STACK_HEIGHT"
     95        PYTHON="./throw_empty.py $ITERATIONS $STACK_HEIGHT"
    9096        ;;
    9197raise-finally)
     
    94100        CPP=unsupported
    95101        JAVA="java ThrowFinally $ITERATIONS $STACK_HEIGHT"
     102        PYTHON="./throw_finally.py $ITERATIONS $STACK_HEIGHT"
    96103        ;;
    97104raise-other)
     
    100107        CPP="./throw-other-cpp $ITERATIONS $STACK_HEIGHT"
    101108        JAVA="java ThrowOther $ITERATIONS $STACK_HEIGHT"
     109        PYTHON="./throw_other.py $ITERATIONS $STACK_HEIGHT"
    102110        ;;
    103111*)
     
    112120cpp) echo $CPP; $CPP;;
    113121java) echo $JAVA; $JAVA;;
     122python) echo $PYTHON; $PYTHON;;
    114123*)
    115124        echo "No such language: $TEST_LANG" >&2
    116125        exit 2
     126        ;;
    117127esac
  • doc/theses/andrew_beach_MMath/code/throw-detor.cfa

    rd30804a r86fc350  
    1212
    1313void ^?{}(WithDestructor & this) {
    14         // ...
     14        asm volatile ("# destructor body");
    1515}
    1616
     
    3939                        unwind_destructor(total_frames);
    4040                } catch (empty_exception *) {
    41                         // ...
     41                        asm volatile ("# catch block");
    4242                }
    4343        }
  • doc/theses/andrew_beach_MMath/code/throw-detor.cpp

    rd30804a r86fc350  
    1010
    1111struct WithDestructor {
    12         ~WithDestructor() {}
     12        ~WithDestructor() {
     13                asm volatile ("# destructor body");
     14        }
    1315};
    1416
     
    3739                        unwind_destructor(total_frames);
    3840                } catch (EmptyException &) {
    39                         // ...
     41                        asm volatile ("# catch block");
    4042                }
    4143        }
  • doc/theses/andrew_beach_MMath/code/throw-empty.cfa

    rd30804a r86fc350  
    3232                        unwind_empty(total_frames);
    3333                } catch (empty_exception *) {
    34                         // ...
     34                        asm volatile ("# catch block");
    3535                }
    3636        }
  • doc/theses/andrew_beach_MMath/code/throw-empty.cpp

    rd30804a r86fc350  
    3232                        unwind_empty(total_frames);
    3333                } catch (EmptyException &) {
    34                         // ...
     34                        asm volatile ("# catch block");
    3535                }
    3636        }
  • doc/theses/andrew_beach_MMath/code/throw-finally.cfa

    rd30804a r86fc350  
    1414                        unwind_finally(frames - 1);
    1515                } finally {
    16                         // ...
     16                        asm volatile ("# finally block");
    1717                }
    1818        } else {
     
    3636                        unwind_finally(total_frames);
    3737                } catch (empty_exception *) {
    38                         // ...
     38                        asm volatile ("# catch block");
    3939                }
    4040        }
  • doc/theses/andrew_beach_MMath/code/throw-other.cfa

    rd30804a r86fc350  
    1616                        unwind_other(frames - 1);
    1717                } catch (not_raised_exception *) {
    18                         // ...
     18                        asm volatile ("# catch block (stack)");
    1919                }
    2020        } else {
     
    3838                        unwind_other(total_frames);
    3939                } catch (empty_exception *) {
    40                         // ...
     40                        asm volatile ("# catch block (base)");
    4141                }
    4242        }
  • doc/theses/andrew_beach_MMath/code/throw-other.cpp

    rd30804a r86fc350  
    1616                        unwind_other(frames - 1);
    1717                } catch (NotRaisedException &) {
    18                         // ...
     18                        asm volatile ("# catch block (stack)");
    1919                }
    2020        } else {
     
    3838                        unwind_other(total_frames);
    3939                } catch (EmptyException &) {
    40                         // ...
     40                        asm volatile ("# catch block (base)");
    4141                }
    4242        }
Note: See TracChangeset for help on using the changeset viewer.