Changeset 0633cf2 for src/SymTab


Ignore:
Timestamp:
Feb 28, 2019, 5:13:47 PM (5 years ago)
Author:
tdelisle <tdelisle@…>
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:
0050a5f
Parents:
5509ff4 (diff), 79de2210 (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:
4 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r5509ff4 r0633cf2  
    2626#include "Common/SemanticError.h"  // for SemanticError
    2727#include "Common/utility.h"        // for cloneAll
     28#include "Common/Stats/Counter.h" // for counters
    2829#include "GenPoly/GenPoly.h"
    2930#include "InitTweak/InitTweak.h"   // for isConstructor, isCopyFunction, isC...
     
    4142
    4243namespace SymTab {
     44
     45        // Statistics block
     46        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);
     57        }
     58
    4359        std::ostream & operator<<( std::ostream & out, const Indexer::IdData & data ) {
    4460                return out << "(" << data.id << "," << data.baseExpr << ")";
     
    197213        }
    198214
    199         Indexer::Indexer() : tables( 0 ), scope( 0 ) {}
    200 
    201         Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {}
     215        Indexer::Indexer() : tables( 0 ), scope( 0 ) {
     216                (*indexers_count)++;
     217        }
     218
     219        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {
     220                (*indexers_count)++;
     221        }
    202222
    203223        Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) {
     
    206226
    207227        Indexer::~Indexer() {
     228                if(tables) {
     229                        indexers_size->push( tables->idTable.size() );
     230                        size_t depth = 1;
     231                        for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {
     232                                ++depth;
     233                        }
     234                        indexers_depth_a->push( depth );
     235                        indexers_depth_m->push( depth );
     236                }
    208237                deleteRef( tables );
    209238        }
     
    237266                while ( searchTables ) {
    238267
     268                        (*idtable_find)++;
     269                        idtable_key->push( id.size() );
     270                        idtable_size->push( searchTables->idTable.size() );
    239271                        IdTable::const_iterator decls = searchTables->idTable.find( id );
    240272                        if ( decls != searchTables->idTable.end() ) {
     
    313345                if ( tables->scope < scope ) return nullptr;
    314346
     347                (*idtable_find)++;
     348                idtable_key->push( id.size() );
     349                idtable_size->push( tables->idTable.size() );
    315350                IdTable::const_iterator decls = tables->idTable.find( id );
    316351                if ( decls != tables->idTable.end() ) {
     
    331366                if ( tables->scope < scope ) return false;
    332367
     368                (*idtable_find)++;
     369                idtable_key->push( id.size() );
     370                idtable_size->push( tables->idTable.size() );
    333371                IdTable::const_iterator decls = tables->idTable.find( id );
    334372                if ( decls != tables->idTable.end() ) {
     
    347385                if ( tables->scope < scope ) return false;
    348386
     387                (*idtable_find)++;
     388                idtable_key->push( id.size() );
     389                idtable_size->push( tables->idTable.size() );
    349390                IdTable::const_iterator decls = tables->idTable.find( id );
    350391                if ( decls != tables->idTable.end() ) {
  • src/SymTab/ManglerCommon.cc

    r5509ff4 r0633cf2  
    2424
    2525                        // GENERATED START, DO NOT EDIT
    26                         // GENERATED BY BasicTypes-gen.cc
     26                        // GENERATED BY ../../main/src/BasicTypes-gen.cc
    2727                        // NOTES ON MANGLING:
    2828                        // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems.
  • src/SymTab/Validate.cc

    r5509ff4 r0633cf2  
    4949#include "CodeGen/OperatorTable.h"     // for isCtorDtor, isCtorDtorAssign
    5050#include "ControlStruct/Mutate.h"      // for ForExprMutator
     51#include "Common/Stats.h"              // for Stats::Heap
    5152#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
    5253#include "Common/ScopedMap.h"          // for ScopedMap
     
    303304                PassVisitor<FixQualifiedTypes> fixQual;
    304305
     306                Stats::Heap::newPass("validate-A");
    305307                acceptAll( translationUnit, hoistDecls );
    306308                ReplaceTypedef::replaceTypedef( translationUnit );
    307309                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    308310                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");
    309312                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    310313                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
    311314                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    312315                EliminateTypedef::eliminateTypedef( translationUnit ); //
     316                Stats::Heap::newPass("validate-C");
    313317                acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    314318                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    315319                ReturnChecker::checkFunctionReturns( translationUnit );
    316320                InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     321                Stats::Heap::newPass("validate-D");
    317322                Concurrency::applyKeywords( translationUnit );
    318323                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    319324                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    320325                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
     326                Stats::Heap::newPass("validate-E");
    321327                Concurrency::implementMutexFuncs( translationUnit );
    322328                Concurrency::implementThreadStarter( translationUnit );
    323329                mutateAll( translationUnit, compoundliteral );
    324330                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     331                Stats::Heap::newPass("validate-F");
    325332                FixObjectType::fix( translationUnit );
    326333                ArrayLength::computeLength( translationUnit );
  • src/SymTab/module.mk

    r5509ff4 r0633cf2  
    1515###############################################################################
    1616
    17 SRC += SymTab/Indexer.cc \
    18        SymTab/Mangler.cc \
    19        SymTab/ManglerCommon.cc \
    20        SymTab/Validate.cc \
    21        SymTab/FixFunction.cc \
    22        SymTab/Autogen.cc
     17SRC_SYMTAB = \
     18      SymTab/Autogen.cc \
     19      SymTab/FixFunction.cc \
     20      SymTab/Indexer.cc \
     21      SymTab/Mangler.cc \
     22      SymTab/ManglerCommon.cc \
     23      SymTab/Validate.cc
     24
     25SRC += $(SRC_SYMTAB)
     26SRCDEMANGLE += $(SRC_SYMTAB) SymTab/Demangle.cc
Note: See TracChangeset for help on using the changeset viewer.