Changeset b38433b for src/SymTab


Ignore:
Timestamp:
Mar 5, 2019, 6:17:55 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
b830e046, c101756
Parents:
34737de (diff), 972540e (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:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r34737de rb38433b  
    4545        // Statistics block
    4646        namespace {
    47                 auto idtable_group = new Stats::Counters::CounterGroup("IdTable");
    48                 auto idtable_find  = new Stats::Counters::SimpleCounter("Find calls", idtable_group);
    49                 auto idtable_size  = new Stats::Counters::AverageCounter<double>("Average Size", idtable_group);
    50                 auto idtable_key   = new Stats::Counters::AverageCounter<double>("Average Key Size", idtable_group);
    51 
    52                 auto indexers_group = new Stats::Counters::CounterGroup("Indexers");
    53                 auto indexers_count = new Stats::Counters::SimpleCounter("Count", indexers_group);
    54                 auto indexers_size  = new Stats::Counters::AverageCounter<double>("Average Size", indexers_group);
    55                 auto indexers_depth_a  = new Stats::Counters::AverageCounter<double>("Average Depth", indexers_group);
    56                 auto indexers_depth_m  = new Stats::Counters::MaxCounter<size_t>("Max Depth", indexers_group);
     47
     48                static inline auto stats_idtable() {
     49                        using namespace Stats::Counters;
     50                        static auto group = build<CounterGroup>("IdTable");
     51                        static struct {
     52                                SimpleCounter * find;
     53                                AverageCounter<double> * size;
     54                                AverageCounter<double> * key;
     55                        } ret = {
     56                                .find = build<SimpleCounter>("Find calls", group),
     57                                .size = build<AverageCounter<double>>("Average Size", group),
     58                                .key  = build<AverageCounter<double>>("Average Key Size", group),
     59                        };
     60                        return ret;
     61                }
     62
     63                static inline auto stats_indexers() {
     64                        using namespace Stats::Counters;
     65                        static auto group   = build<CounterGroup>("Indexers");
     66                        static struct {
     67                                SimpleCounter * count;
     68                                AverageCounter<double> * size;
     69                                AverageCounter<double> * depth_a;
     70                                MaxCounter<size_t> * depth_m;
     71                        } ret = {
     72                                .count   = build<SimpleCounter>("Count", group),
     73                                .size    = build<AverageCounter<double>>("Average Size", group),
     74                                .depth_a = build<AverageCounter<double>>("Average Depth", group),
     75                                .depth_m = build<MaxCounter<size_t>>("Max Depth", group),
     76                        };
     77                        return ret;
     78                }
    5779        }
    5880
     
    214236
    215237        Indexer::Indexer() : tables( 0 ), scope( 0 ) {
    216                 (*indexers_count)++;
     238                (*stats_indexers().count)++;
    217239        }
    218240
    219241        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {
    220                 (*indexers_count)++;
     242                (*stats_indexers().count)++;
    221243        }
    222244
     
    227249        Indexer::~Indexer() {
    228250                if(tables) {
    229                         indexers_size->push( tables->idTable.size() );
     251                        stats_indexers().size->push( tables->idTable.size() );
    230252                        size_t depth = 1;
    231253                        for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {
    232254                                ++depth;
    233255                        }
    234                         indexers_depth_a->push( depth );
    235                         indexers_depth_m->push( depth );
     256                        stats_indexers().depth_a->push( depth );
     257                        stats_indexers().depth_m->push( depth );
    236258                }
    237259                deleteRef( tables );
     
    266288                while ( searchTables ) {
    267289
    268                         (*idtable_find)++;
    269                         idtable_key->push( id.size() );
    270                         idtable_size->push( searchTables->idTable.size() );
     290                        (*stats_idtable().find)++;
     291                        stats_idtable().key->push( id.size() );
     292                        stats_idtable().size->push( searchTables->idTable.size() );
    271293                        IdTable::const_iterator decls = searchTables->idTable.find( id );
    272294                        if ( decls != searchTables->idTable.end() ) {
     
    345367                if ( tables->scope < scope ) return nullptr;
    346368
    347                 (*idtable_find)++;
    348                 idtable_key->push( id.size() );
    349                 idtable_size->push( tables->idTable.size() );
     369                (*stats_idtable().find)++;
     370                stats_idtable().key->push( id.size() );
     371                stats_idtable().size->push( tables->idTable.size() );
    350372                IdTable::const_iterator decls = tables->idTable.find( id );
    351373                if ( decls != tables->idTable.end() ) {
     
    366388                if ( tables->scope < scope ) return false;
    367389
    368                 (*idtable_find)++;
    369                 idtable_key->push( id.size() );
    370                 idtable_size->push( tables->idTable.size() );
     390                (*stats_idtable().find)++;
     391                stats_idtable().key->push( id.size() );
     392                stats_idtable().size->push( tables->idTable.size() );
    371393                IdTable::const_iterator decls = tables->idTable.find( id );
    372394                if ( decls != tables->idTable.end() ) {
     
    385407                if ( tables->scope < scope ) return false;
    386408
    387                 (*idtable_find)++;
    388                 idtable_key->push( id.size() );
    389                 idtable_size->push( tables->idTable.size() );
     409                (*stats_idtable().find)++;
     410                stats_idtable().key->push( id.size() );
     411                stats_idtable().size->push( tables->idTable.size() );
    390412                IdTable::const_iterator decls = tables->idTable.find( id );
    391413                if ( decls != tables->idTable.end() ) {
  • src/SymTab/Validate.cc

    r34737de rb38433b  
    304304                PassVisitor<FixQualifiedTypes> fixQual;
    305305
    306                 Stats::Heap::newPass("validate-A");
    307                 acceptAll( translationUnit, hoistDecls );
    308                 ReplaceTypedef::replaceTypedef( translationUnit );
    309                 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    310                 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    311                 Stats::Heap::newPass("validate-B");
    312                 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    313                 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
    314                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    315                 EliminateTypedef::eliminateTypedef( translationUnit ); //
    316                 Stats::Heap::newPass("validate-C");
    317                 acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    318                 VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    319                 ReturnChecker::checkFunctionReturns( translationUnit );
    320                 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    321                 Stats::Heap::newPass("validate-D");
    322                 Concurrency::applyKeywords( translationUnit );
    323                 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    324                 ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    325                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    326                 Stats::Heap::newPass("validate-E");
    327                 Concurrency::implementMutexFuncs( translationUnit );
    328                 Concurrency::implementThreadStarter( translationUnit );
    329                 mutateAll( translationUnit, compoundliteral );
    330                 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    331                 Stats::Heap::newPass("validate-F");
    332                 FixObjectType::fix( translationUnit );
    333                 ArrayLength::computeLength( translationUnit );
    334                 acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    335                 mutateAll( translationUnit, labelAddrFixer );
    336                 Validate::handleAttributes( translationUnit );
     306                {
     307                        Stats::Heap::newPass("validate-A");
     308                        Stats::Time::BlockGuard guard("validate-A");
     309                        acceptAll( translationUnit, hoistDecls );
     310                        ReplaceTypedef::replaceTypedef( translationUnit );
     311                        ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
     312                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
     313                }
     314                {
     315                        Stats::Heap::newPass("validate-B");
     316                        Stats::Time::BlockGuard guard("validate-B");
     317                        Stats::Time::TimeBlock("Link Reference To Types", [&]() {
     318                                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     319                        });
     320                        Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
     321                                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
     322                        });
     323                        Stats::Time::TimeBlock("Hoist Structs", [&]() {
     324                                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     325                        });
     326                        Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
     327                                EliminateTypedef::eliminateTypedef( translationUnit ); //
     328                        });
     329                }
     330                {
     331                        Stats::Heap::newPass("validate-C");
     332                        Stats::Time::BlockGuard guard("validate-C");
     333                        acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
     334                        VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     335                        ReturnChecker::checkFunctionReturns( translationUnit );
     336                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     337                }
     338                {
     339                        Stats::Heap::newPass("validate-D");
     340                        Stats::Time::BlockGuard guard("validate-D");
     341                        Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
     342                                Concurrency::applyKeywords( translationUnit );
     343                        });
     344                        Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
     345                                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
     346                        });
     347                        Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
     348                                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
     349                        });
     350                        Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
     351                                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
     352                        });
     353                }
     354                {
     355                        Stats::Heap::newPass("validate-E");
     356                        Stats::Time::BlockGuard guard("validate-E");
     357                        Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
     358                                Concurrency::implementMutexFuncs( translationUnit );
     359                        });
     360                        Stats::Time::TimeBlock("Implement Thread Start", [&]() {
     361                                Concurrency::implementThreadStarter( translationUnit );
     362                        });
     363                        Stats::Time::TimeBlock("Compound Literal", [&]() {
     364                                mutateAll( translationUnit, compoundliteral );
     365                        });
     366                        Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
     367                                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     368                        });
     369                }
     370                {
     371                        Stats::Heap::newPass("validate-F");
     372                        Stats::Time::BlockGuard guard("validate-F");
     373                        Stats::Time::TimeBlock("Fix Object Type", [&]() {
     374                                FixObjectType::fix( translationUnit );
     375                        });
     376                        Stats::Time::TimeBlock("Array Length", [&]() {
     377                                ArrayLength::computeLength( translationUnit );
     378                        });
     379                        Stats::Time::TimeBlock("Find Special Declarations", [&]() {
     380                                acceptAll( translationUnit, finder ); // xxx - remove this pass soon
     381                        });
     382                        Stats::Time::TimeBlock("Fix Label Address", [&]() {
     383                                mutateAll( translationUnit, labelAddrFixer );
     384                        });
     385                        Stats::Time::TimeBlock("Handle Attributes", [&]() {
     386                                Validate::handleAttributes( translationUnit );
     387                        });
     388                }
    337389        }
    338390
Note: See TracChangeset for help on using the changeset viewer.