Changeset d5f6a14

Jul 5, 2021, 2:11:58 PM (2 years ago)
caparsons <caparson@…>
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
f7f07f6 (diff), 943bfad (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.

Merge branch 'master' of

24 added
8 edited


  • doc/theses/andrew_beach_MMath/performance.tex

    rf7f07f6 rd5f6a14  
    44\textbf{Just because of the stage of testing there are design notes for
    55the tests as well as commentary on them.}
    6 \todo{Revisit organization of the performance chapter once tests are chosen.}
    7 % What are good tests for resumption?
    97Performance has been of secondary importance for most of this project.
    1210amount of time.
    14 %\section{Termination Comparison}
    1512\section{Test Set-Up}
    1613Tests will be run on \CFA, C++ and Java.
    5148The should provide a guide as to where the EHM's costs can be found.
    53 \paragraph{Raise/Handle}
    54 What is the basic cost to raise and handle an exception?
     50Tests are run in \CFA, \Cpp and Java.
     51Not every test is run in every language, if the feature under test is missing
     52the test is skipped. These cases will be noted.
     53In addition to the termination tests for every language,
     54\CFA has a second set of tests that test resumption. These are the same
     55except that the raise statements and handler clauses are replaced with the
     56resumption variants.
    56 There are a number of factors that can effect this.
    57 For \CFA this includes the type of raise,
     58\paragraph{Raise and Handle}
     59The first group of tests involve setting up
     60So there is three layers to the test. The first is set up and a loop, which
     61configures the test and then runs it repeatedly to reduce the impact of
     62start-up and shutdown on the results.
     63Each iteration of the main loop
     65\item Empty Function:
     66The repeating function is empty except for the necessary control code.
     67\item Destructor:
     68The repeating function creates an object with a destructor before calling
     70(Java is skipped as it does not destructors.)
     71\item Finally:
     72The repeating function calls itself inside a try block with a finally clause
     74(\Cpp is skipped as it does not have finally clauses.)
     75\item Other Handler:
     76The repeating function calls itself inside a try block with a handler that
     77will not match the raised exception. (But is of the same kind of handler.)
    59 Main loop, pass through a catch-all, call through some empty helper functions
    60 to put frames on the stack then raise and exception.
    61 \todo{Raise/Handle (or a similar test) could also test how much it costs to
    62 search over things, not sure if that is a useful test.}
     80\paragraph{Cross Try Statement}
     81The next group measures the cost of a try statement when no exceptions are
     82raised. The test is set-up, then there is a loop to reduce the impact of
     83start-up and shutdown on the results.
     84In each iteration, a try statement is executed. Entering and leaving a loop
     85is all the test wants to do.
     87\item Handler:
     88The try statement has a handler (of the matching kind).
     89\item Finally:
     90The try statement has a finally clause.
    64 \paragraph{Unwinding}
    65 Isolating the unwinding of the stack as much as possible.
    67 This has the same set-up as the raise/handle test except the intermediate
    68 stack frames contain either an object declaration with a destructor or a
    69 try statement with no handlers except for a finally clause.
    71 \paragraph{Enter/Leave}
    72 What is the cost of entering and leaving a try block, even if no exception
    73 is thrown?
    75 This test is a simple pattern of entering
    76 and leaving a try statement.
    78 The only tunables here are which clauses are attached to the try block:
    79 termination handlers, resumption handlers and finally clauses.
    81 \paragraph{Re-throw and Conditional-Catch}
    82 How expensive it is to run a non-exception type check for a handler?
    84 In this case different languages approach this problem differently, either
    85 through a re-throw or a conditional-catch.
    86 Where \CFA uses its condition other languages will have to unconditionally
    87 catch the exception then re-throw if the condition if the condition is false.
    89 The set up is as follows: main loop, a catch-all exception handler,
    90 a conditional catch and then the raise.
    92 % We could do a Cforall test without the catch all and a new default handler
    93 % that does a catch all.
    94 As a point of comparison one of the raise/handle tests (which one?) has
    95 same layout but never catches anything.
    97 The main tunable in this test is how often the conditional-catch matches.
     93\paragraph{Conditional Matching}
     94This group of tests checks the cost of conditional matching.
     95Only \CFA implements the language level conditional match,
     96the other languages must mimic with an ``unconditional" match (it still
     97checks the exception's type) and conditional re-raise.
     99\item Catch All:
     100The condition is always true. (Always matches or never re-raises.)
     101\item Catch None:
     102The condition is always false. (Never matches or always re-raises.)
    99105%\section{Cost in Size}
  • src/AST/Node.cpp

    rf7f07f6 rd5f6a14  
    4747        const ast::ParseNode * parse = dynamic_cast<const ast::ParseNode *>( node );
    4848        if ( nullptr == parse ) {
    49                 assertf(nullptr, "%s (no location)", toString(node).c_str());
     49                assertf(false, "%s (no location)", toString(node).c_str());
    5050        } else if ( parse->location.isUnset() ) {
    51                 assertf(nullptr, "%s (unset location)", toString(node).c_str());
     51                assertf(false, "%s (unset location)", toString(node).c_str());
    5252        } else {
    53                 assertf(nullptr, "%s (at %s:%d)", toString(node).c_str(),
     53                assertf(false, "%s (at %s:%d)", toString(node).c_str(),
    5454                        parse->location.filename.c_str(), parse->location.first_line);
    5555        }
  • src/GenPoly/

    rf7f07f6 rd5f6a14  
    6464                }
     66                __attribute__((ununsed))
    6667                bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TyVarMap & tyVars, const ast::TypeSubstitution * env) {
    6768                        for (auto &param : params) {
  • src/ResolvExpr/CandidateFinder.cpp

    rf7f07f6 rd5f6a14  
    597597                const ast::SymbolTable & symtab;
    598598        public:
    599                 static size_t traceId;
     599                // static size_t traceId;
    600600                CandidateFinder & selfFinder;
    601601                CandidateList & candidates;
    890890                                                        }
    891891                                                }
    893893                                                // if argType is an unbound type parameter, all special functions need to be searched.
    894894                                                if (isUnboundType(argType)) {
    11041104                                // unification run for side-effects
    11051105                                unify( toType, cand->expr->result, cand->env, need, have, open, symtab );
    1106                                 Cost thisCost = 
     1106                                Cost thisCost =
    11071107                                        (castExpr->isGenerated == ast::GeneratedFlag::GeneratedCast)
    11081108                            ? conversionCost( cand->expr->result, toType, cand->expr->get_lvalue(), symtab, cand->env )
    17291729                                                found->second.ambiguous = true;
    17301730                                        }
    1731                                 } else { 
     1731                                } else {
    17321732                                        // xxx - can satisfyAssertions increase the cost?
    17331733                                        PRINT(
    17341734                                                std::cerr << "cost " << newCand->cost << " loses to "
    17351735                                                        << found->second.candidate->cost << std::endl;
    1736                                         )       
     1736                                        )
    17371737                                }
    17381738                        } else {
    18191819                if ( mode.failFast && pruned.empty() ) {
    18201820                        std::ostringstream stream;
    1821                         if (found) {           
     1821                        if (found) {
    18221822                                CandidateList winners = findMinCost( candidates );
    18231823                                stream << "Cannot choose between " << winners.size() << " alternatives for "
  • src/ResolvExpr/

    rf7f07f6 rd5f6a14  
    10441044                        }
    1046                         return { new ast::TupleType{ std::move(out) } };
     1046                        return new ast::TupleType{ std::move(out) };
    10471047                }
  • src/SymTab/

    rf7f07f6 rd5f6a14  
    16281628                }
    16291629        };
    1630         */
    16321631        /// expand assertions from a trait instance, performing appropriate type variable substitutions
    16461645                }
    16471646        }
    1649         /*
    16511648        /// Associates forward declarations of aggregates with their definitions
  • src/SynTree/

    rf7f07f6 rd5f6a14  
    9292        std::list< Expression * > copy_parameters;
    9393        cloneAll( new_parameters, copy_parameters );
    94         return makeInst( move( copy( copy_parameters ) ) );
     94        return makeInst( copy( copy_parameters ) );
  • src/SynTree/

    rf7f07f6 rd5f6a14  
    207207        Type::print( os, indent );
    208208        os << "instance of " << typeString() << " ";
    209         const auto & name_ = get_name();
    210209        if( deterministic_output && isUnboundType(name) ) os << "[unbound]";
    211210        else os << name;
Note: See TracChangeset for help on using the changeset viewer.