Ignore:
Timestamp:
Jun 1, 2018, 2:54:55 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
262bd63
Parents:
41e16b1
git-author:
Aaron Moss <a3moss@…> (05/31/18 16:24:49)
git-committer:
Aaron Moss <a3moss@…> (06/01/18 14:54:55)
Message:

stop eagerly copying EqvClass? on lookup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    r41e16b1 r00ac42e  
    4242        Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    4343                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    44                         EqvClass eqvClass;
    45                         NamedTypeDecl *namedType;
    4644                        PRINT( std::cerr << "type inst " << destAsTypeInst->name; )
    47                         if ( env.lookup( destAsTypeInst->name, eqvClass ) ) {
    48                                 if ( eqvClass.type ) {
    49                                         return conversionCost( src, eqvClass.type, indexer, env );
     45                        if ( const EqvClass* eqvClass = env.lookup( destAsTypeInst->name ) ) {
     46                                if ( eqvClass->type ) {
     47                                        return conversionCost( src, eqvClass->type, indexer, env );
    5048                                } else {
    5149                                        return Cost::infinity;
    5250                                }
    53                         } else if ( ( namedType = indexer.lookupType( destAsTypeInst->name ) ) ) {
     51                        } else if ( NamedTypeDecl *namedType = indexer.lookupType( destAsTypeInst->name ) ) {
    5452                                PRINT( std::cerr << " found" << std::endl; )
    5553                                TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
     
    369367
    370368        void ConversionCost::postvisit( TypeInstType *inst ) {
    371                 EqvClass eqvClass;
    372                 NamedTypeDecl *namedType;
    373                 if ( env.lookup( inst->name, eqvClass ) ) {
    374                         cost = costFunc( eqvClass.type, dest, indexer, env );
     369                if ( const EqvClass *eqvClass = env.lookup( inst->name ) ) {
     370                        cost = costFunc( eqvClass->type, dest, indexer, env );
    375371                } else if ( TypeInstType *destAsInst = dynamic_cast< TypeInstType* >( dest ) ) {
    376372                        if ( inst->name == destAsInst->name ) {
    377373                                cost = Cost::zero;
    378374                        }
    379                 } else if ( ( namedType = indexer.lookupType( inst->name ) ) ) {
     375                } else if ( NamedTypeDecl *namedType = indexer.lookupType( inst->name ) ) {
    380376                        TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
    381377                        // all typedefs should be gone by this point
Note: See TracChangeset for help on using the changeset viewer.