Changeset 3bb195cb for src


Ignore:
Timestamp:
Aug 8, 2016, 3:44:56 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
ce76eb9
Parents:
752dc70
Message:

Dtypes now erased on dtype-only generic types, tests pass, build produces many warnings

Location:
src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r752dc70 r3bb195cb  
    104104                        Type *replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone = true );
    105105                        /// wraps a function application returning a polymorphic type with a new temporary for the out-parameter return value
    106                         Expression *addPolyRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg );
     106                        Expression *addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg );
    107107                        Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
    108108                        void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars );
     
    661661                                // process polymorphic return value
    662662                                retval = 0;
    663                                 if ( isPolyRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {
     663                                if ( isDynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {
    664664                                        retval = functionDecl->get_functionType()->get_returnVals().front();
    665665
     
    868868                }
    869869
    870                 Expression *Pass1::addPolyRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg ) {
     870                Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *dynType, std::list< Expression *>::iterator &arg ) {
    871871                        assert( env );
    872                         Type *concrete = replaceWithConcrete( appExpr, polyType );
     872                        Type *concrete = replaceWithConcrete( appExpr, dynType );
    873873                        // add out-parameter for return value
    874874                        return addRetParam( appExpr, function, concrete, arg );
     
    877877                Expression *Pass1::applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    878878                        Expression *ret = appExpr;
    879                         if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
     879//                      if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
     880                        if ( isDynRet( function, tyVars ) ) {
    880881                                ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg );
    881882                        } // if
     
    968969                        // actually make the adapter type
    969970                        FunctionType *adapter = adaptee->clone();
    970                         if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
     971//                      if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
     972                        if ( isDynRet( adapter, tyVars ) ) {
    971973                                makeRetParm( adapter );
    972974                        } // if
     
    10301032                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    10311033                                bodyStmt = new ExprStmt( noLabels, adapteeApp );
    1032                         } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     1034//                      } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     1035                        } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    10331036                                // return type T
    10341037                                if ( (*param)->get_name() == "" ) {
     
    12771280                        TyVarMap exprTyVars( (TypeDecl::Kind)-1 );
    12781281                        makeTyVarMap( function, exprTyVars );
    1279                         ReferenceToType *polyRetType = isPolyRet( function );
    1280 
    1281                         if ( polyRetType ) {
    1282                                 ret = addPolyRetParam( appExpr, function, polyRetType, arg );
     1282                        ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
     1283
     1284                        if ( dynRetType ) {
     1285                                ret = addDynRetParam( appExpr, function, dynRetType, arg );
    12831286                        } else if ( needsAdapter( function, scopeTyVars ) ) {
    12841287                                // std::cerr << "needs adapter: ";
     
    12901293                        arg = appExpr->get_args().begin();
    12911294
    1292                         passTypeVars( appExpr, polyRetType, arg, exprTyVars );
     1295                        passTypeVars( appExpr, dynRetType, arg, exprTyVars );
    12931296                        addInferredParams( appExpr, function, arg, exprTyVars );
    12941297
     
    15771580
    15781581                        // move polymorphic return type to parameter list
    1579                         if ( isPolyRet( funcType ) ) {
     1582                        if ( isDynRet( funcType ) ) {
    15801583                                DeclarationWithType *ret = funcType->get_returnVals().front();
    15811584                                ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
     
    20512054
    20522055                        DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
    2053                         ScrubTyVars::scrub( decl, scopeTyVars );
     2056                        ScrubTyVars::scrubDynamic( decl, scopeTyVars );
    20542057
    20552058                        scopeTyVars.endScope();
  • src/GenPoly/GenPoly.cc

    r752dc70 r3bb195cb  
    2323
    2424namespace GenPoly {
    25         bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) {
    26                 if ( ! adaptee->get_returnVals().empty() && isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    27                         return true;
    28                 } // if
    29                 for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
    30                         if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
    31                                 return true;
    32                         } // if
    33                 } // for
    34                 return false;
    35         }
    36 
    37         ReferenceToType *isPolyRet( FunctionType *function ) {
    38                 if ( ! function->get_returnVals().empty() ) {
    39                         TyVarMap forallTypes( (TypeDecl::Kind)-1 );
    40                         makeTyVarMap( function, forallTypes );
    41                         return (ReferenceToType*)isPolyType( function->get_returnVals().front()->get_type(), forallTypes );
    42                 } // if
    43                 return 0;
    44         }
    45 
    4625        namespace {
    4726                /// Checks a parameter list for polymorphic parameters; will substitute according to env if present
     
    6443                        return false;
    6544                }
     45
     46                /// Checks a parameter list for dynamic-layout parameters from tyVars; will substitute according to env if present
     47                bool hasDynParams( std::list< Expression* >& params, const TyVarMap &tyVars, const TypeSubstitution *env ) {
     48                        for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
     49                                TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
     50                                assert(paramType && "Aggregate parameters should be type expressions");
     51                                if ( isDynType( paramType->get_type(), tyVars, env ) ) return true;
     52                        }
     53                        return false;
     54                }
    6655        }
    6756
     
    10190                }
    10291                return 0;
     92        }
     93
     94        Type *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
     95                type = replaceTypeInst( type, env );
     96
     97                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) {
     98                        auto var = tyVars.find( typeInst->get_name() );
     99                        if ( var != tyVars.end() && var->second == TypeDecl::Any ) {
     100                                return type;
     101                        }
     102                } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
     103                        if ( hasDynParams( structType->get_parameters(), tyVars, env ) ) return type;
     104                } else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) {
     105                        if ( hasDynParams( unionType->get_parameters(), tyVars, env ) ) return type;
     106                }
     107                return 0;
     108        }
     109
     110        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) {
     111                if ( function->get_returnVals().empty() ) return 0;
     112               
     113                return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
     114        }
     115
     116        ReferenceToType *isDynRet( FunctionType *function ) {
     117                if ( function->get_returnVals().empty() ) return 0;
     118
     119                TyVarMap forallTypes( (TypeDecl::Kind)-1 );
     120                makeTyVarMap( function, forallTypes );
     121                return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
     122        }
     123
     124        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) {
     125//              if ( ! adaptee->get_returnVals().empty() && isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     126//                      return true;
     127//              } // if
     128                if ( isDynRet( adaptee, tyVars ) ) return true;
     129               
     130                for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
     131//                      if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
     132                        if ( isDynType( (*innerArg)->get_type(), tyVars ) ) {
     133                                return true;
     134                        } // if
     135                } // for
     136                return false;
    103137        }
    104138
  • src/GenPoly/GenPoly.h

    r752dc70 r3bb195cb  
    3131namespace GenPoly {
    3232        typedef ErasableScopedMap< std::string, TypeDecl::Kind > TyVarMap;
    33        
    34         /// A function needs an adapter if it returns a polymorphic value or if any of its
    35         /// parameters have polymorphic type
    36         bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
    37 
    38         /// true iff function has polymorphic return type
    39         ReferenceToType *isPolyRet( FunctionType *function );
    4033
    4134        /// Replaces a TypeInstType by its referrent in the environment, if applicable
     
    4740        /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
    4841        Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
     42
     43        /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided
     44        Type *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
     45
     46        /// true iff function has dynamic-layout return type under the given type variable map
     47        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &tyVars );
     48
     49        /// true iff function has dynamic-layout return type under the type variable map generated from its forall-parameters
     50        ReferenceToType *isDynRet( FunctionType *function );
     51
     52        /// A function needs an adapter if it returns a dynamic-layout value or if any of its parameters have dynamic-layout type
     53        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
    4954
    5055        /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
  • src/GenPoly/InstantiateGeneric.cc

    r752dc70 r3bb195cb  
    2424#include "GenPoly.h"
    2525#include "ScopedMap.h"
     26#include "ScopedSet.h"
    2627
    2728#include "ResolvExpr/typeops.h"
     
    122123                }
    123124        };
     125
     126        /// Possible options for a given specialization of a generic type
     127        enum class genericType {
     128                dtypeStatic,  ///< Concrete instantiation based solely on {d,f}type-to-void conversions
     129                concrete,     ///< Concrete instantiation requiring at least one parameter type
     130                dynamic       ///< No concrete instantiation
     131        };
     132
     133        genericType& operator |= ( genericType& gt, const genericType& ht ) {
     134                switch ( gt ) {
     135                case genericType::dtypeStatic:
     136                        gt = ht;
     137                        break;
     138                case genericType::concrete:
     139                        if ( ht == genericType::dynamic ) { gt = genericType::dynamic; }
     140                        break;
     141                case genericType::dynamic:
     142                        // nothing possible
     143                        break;
     144                }
     145                return gt;
     146        }
    124147       
    125148        /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately
     
    127150                /// Map of (generic type, parameter list) pairs to concrete type instantiations
    128151                InstantiationMap< AggregateDecl, AggregateDecl > instantiations;
     152                /// Set of types which are dtype-only generic (and therefore have static layout)
     153                ScopedSet< AggregateDecl* > dtypeStatics;
    129154                /// Namer for concrete types
    130155                UniqueName typeNamer;
    131156
    132157        public:
    133                 GenericInstantiator() : DeclMutator(), instantiations(), typeNamer("_conc_") {}
     158                GenericInstantiator() : DeclMutator(), instantiations(), dtypeStatics(), typeNamer("_conc_") {}
    134159
    135160                virtual Type* mutate( StructInstType *inst );
     
    147172                /// Wrap instantiation insertion for unions
    148173                void insert( UnionInstType *inst, const std::list< TypeExpr* > &typeSubs, UnionDecl *decl ) { instantiations.insert( inst->get_baseUnion(), typeSubs, decl ); }
     174
     175                /// If this is an instance of a type already determined to be dtype-static, strips the instances's type parameters and returns true
     176                bool stripInstParams( AggregateDecl *base, ReferenceToType *inst );
     177       
     178                /// Strips a dtype-static aggregate decl of its type parameters, marks it as stripped
     179                void stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs );
    149180        };
    150181
     
    154185        }
    155186
    156         //////////////////////////////////////// GenericInstantiator //////////////////////////////////////////////////
    157 
    158         /// Possible options for a given specialization of a generic type
    159         enum class genericType {
    160                 dtypeStatic,  ///< Concrete instantiation based solely on {d,f}type-to-void conversions
    161                 concrete,     ///< Concrete instantiation requiring at least one parameter type
    162                 dynamic       ///< No concrete instantiation
    163         };
    164 
    165         genericType& operator |= ( genericType& gt, const genericType& ht ) {
    166                 switch ( gt ) {
    167                 case genericType::dtypeStatic:
    168                         gt = ht;
    169                         break;
    170                 case genericType::concrete:
    171                         if ( ht == genericType::dynamic ) { gt = genericType::dynamic; }
    172                         break;
    173                 case genericType::dynamic:
    174                         // nothing possible
    175                         break;
    176                 }
    177                 return gt;
    178         }
    179 
    180         /// Makes substitutions of params into baseParams; returns true if all parameters substituted for a concrete type
     187        /// Makes substitutions of params into baseParams; returns dtypeStatic if there is a concrete instantiation based only on {d,f}type-to-void conversions,
     188        /// concrete if there is a concrete instantiation requiring at least one parameter type, and dynamic if there is no concrete instantiation
    181189        genericType makeSubstitutions( const std::list< TypeDecl* >& baseParams, const std::list< Expression* >& params, std::list< TypeExpr* >& out ) {
    182190                genericType gt = genericType::dtypeStatic;
     
    223231        }
    224232
     233        /// Substitutes types of members according to baseParams => typeSubs, working in-place
     234        void substituteMembers( std::list< Declaration* >& members, const std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) {
     235                // substitute types into new members
     236                TypeSubstitution subs( baseParams.begin(), baseParams.end(), typeSubs.begin() );
     237                for ( std::list< Declaration* >::iterator member = members.begin(); member != members.end(); ++member ) {
     238                        subs.apply(*member);
     239                }
     240        }
     241
     242        bool GenericInstantiator::stripInstParams( AggregateDecl *base, ReferenceToType *inst ) {
     243                if ( dtypeStatics.find( base ) == dtypeStatics.end() ) return false;
     244
     245                deleteAll( inst->get_parameters() );
     246                inst->get_parameters().clear();
     247
     248                return true;
     249        }
     250       
     251        void GenericInstantiator::stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) {
     252                substituteMembers( base->get_members(), baseParams, typeSubs );
     253
     254                deleteAll( baseParams );
     255                baseParams.clear();
     256               
     257                dtypeStatics.insert( base );
     258        }
     259
    225260        Type* GenericInstantiator::mutate( StructInstType *inst ) {
    226261                // mutate subtypes
     
    231266                // exit early if no need for further mutation
    232267                if ( inst->get_parameters().empty() ) return inst;
     268
     269                // check for an already-instantiatiated dtype-static type
     270                if ( stripInstParams( inst->get_baseStruct(), inst ) ) return inst;
     271               
     272                // check if type can be concretely instantiated; put substitutions into typeSubs
    233273                assert( inst->get_baseParameters() && "Base struct has parameters" );
    234 
    235                 // check if type can be concretely instantiated; put substitutions into typeSubs
    236274                std::list< TypeExpr* > typeSubs;
    237275                genericType gt = makeSubstitutions( *inst->get_baseParameters(), inst->get_parameters(), typeSubs );
    238276                switch ( gt ) {
    239                 case genericType::dtypeStatic: // TODO strip params off original decl and reuse here
    240                 case genericType::concrete:
    241                 {
     277                case genericType::dtypeStatic:
     278                        stripDtypeParams( inst->get_baseStruct(), *inst->get_baseParameters(), typeSubs );
     279                        break;
     280               
     281                case genericType::concrete: {
    242282                        // make concrete instantiation of generic type
    243283                        StructDecl *concDecl = lookup( inst, typeSubs );
     
    274314                // exit early if no need for further mutation
    275315                if ( inst->get_parameters().empty() ) return inst;
     316
     317                // check for an already-instantiatiated dtype-static type
     318                if ( stripInstParams( inst->get_baseUnion(), inst ) ) return inst;
     319
     320                // check if type can be concretely instantiated; put substitutions into typeSubs
    276321                assert( inst->get_baseParameters() && "Base union has parameters" );
    277 
    278                 // check if type can be concretely instantiated; put substitutions into typeSubs
    279322                std::list< TypeExpr* > typeSubs;
    280323                genericType gt = makeSubstitutions( *inst->get_baseParameters(), inst->get_parameters(), typeSubs );
    281324                switch ( gt ) {
    282                 case genericType::dtypeStatic:  // TODO strip params off original decls and reuse here
     325                case genericType::dtypeStatic:
     326                        stripDtypeParams( inst->get_baseUnion(), *inst->get_baseParameters(), typeSubs );
     327                        break;
     328                       
    283329                case genericType::concrete:
    284330                {
     
    311357                DeclMutator::doBeginScope();
    312358                instantiations.beginScope();
     359                dtypeStatics.beginScope();
    313360        }
    314361
     
    316363                DeclMutator::doEndScope();
    317364                instantiations.endScope();
     365                dtypeStatics.endScope();
    318366        }
    319367
  • src/GenPoly/ScrubTyVars.cc

    r752dc70 r3bb195cb  
    4545
    4646        Type * ScrubTyVars::mutateAggregateType( Type *ty ) {
    47                 if ( isPolyType( ty, tyVars ) ) {
     47                if ( shouldScrub( ty ) ) {
    4848                        PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( ty->get_qualifiers() ) );
    4949                        delete ty;
     
    6363        Expression * ScrubTyVars::mutate( SizeofExpr *szeof ) {
    6464                // sizeof( T ) => _sizeof_T parameter, which is the size of T
    65                 if ( Type *polyType = isPolyType( szeof->get_type() ) ) {
    66                         Expression *expr = new NameExpr( sizeofName( mangleType( polyType ) ) );
     65                if ( Type *dynType = shouldScrub( szeof->get_type() ) ) {
     66                        Expression *expr = new NameExpr( sizeofName( mangleType( dynType ) ) );
    6767                        return expr;
    6868                } else {
     
    7373        Expression * ScrubTyVars::mutate( AlignofExpr *algnof ) {
    7474                // alignof( T ) => _alignof_T parameter, which is the alignment of T
    75                 if ( Type *polyType = isPolyType( algnof->get_type() ) ) {
    76                         Expression *expr = new NameExpr( alignofName( mangleType( polyType ) ) );
     75                if ( Type *dynType = shouldScrub( algnof->get_type() ) ) {
     76                        Expression *expr = new NameExpr( alignofName( mangleType( dynType ) ) );
    7777                        return expr;
    7878                } else {
     
    8282
    8383        Type * ScrubTyVars::mutate( PointerType *pointer ) {
    84                 if ( Type *polyType = isPolyType( pointer->get_base(), tyVars ) ) {
    85                         Type *ret = polyType->acceptMutator( *this );
     84//              // special case of shouldScrub that takes all TypeInstType pointer bases, even if they're not dynamic
     85//              Type *base = pointer->get_base();
     86//              Type *dynType = 0;
     87//              if ( dynamicOnly ) {
     88//                      if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( base ) ) {
     89//                              if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) { dynType = typeInst; }
     90//                      } else {
     91//                              dynType = isDynType( base, tyVars );
     92//                      }
     93//              } else {
     94//                      dynType = isPolyType( base, tyVars );
     95//              }
     96//              if ( dynType ) {
     97                if ( Type *dynType = shouldScrub( pointer->get_base() ) ) {
     98                        Type *ret = dynType->acceptMutator( *this );
    8699                        ret->get_qualifiers() += pointer->get_qualifiers();
    87100                        pointer->set_base( 0 );
  • src/GenPoly/ScrubTyVars.h

    r752dc70 r3bb195cb  
    2727        class ScrubTyVars : public Mutator {
    2828          public:
    29                 ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {}
     29                ScrubTyVars( const TyVarMap &tyVars, bool dynamicOnly = false ): tyVars( tyVars ), dynamicOnly( dynamicOnly ) {}
    3030
    3131                /// For all polymorphic types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
     
    3333                template< typename SynTreeClass >
    3434                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
     35
     36                /// For all dynamic-layout types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
     37                /// and sizeof/alignof expressions with the proper variable
     38                template< typename SynTreeClass >
     39                static SynTreeClass *scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars );
    3540
    3641                virtual Type* mutate( TypeInstType *typeInst );
     
    4247
    4348          private:
     49                /// Returns the type if it should be scrubbed, NULL otherwise.
     50                Type* shouldScrub( Type *ty ) {
     51                        return dynamicOnly ? isDynType( ty, tyVars ) : isPolyType( ty, tyVars );
     52//                      if ( ! dynamicOnly ) return isPolyType( ty, tyVars );
     53//
     54//                      if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( ty ) ) {
     55//                              return tyVars.find( typeInst->get_name() ) != tyVars.end() ? ty : 0;
     56//                      }
     57//
     58//                      return isDynType( ty, tyVars );
     59                }
     60               
    4461                /// Mutates (possibly generic) aggregate types appropriately
    4562                Type* mutateAggregateType( Type *ty );
    4663               
    47                 const TyVarMap &tyVars;
     64                const TyVarMap &tyVars;  ///< Type variables to scrub
     65                bool dynamicOnly;        ///< only scrub the types with dynamic layout? [false]
    4866        };
    4967
    50         /* static class method */
    5168        template< typename SynTreeClass >
    5269        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
    5370                ScrubTyVars scrubber( tyVars );
     71                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
     72        }
     73
     74        template< typename SynTreeClass >
     75        SynTreeClass * ScrubTyVars::scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars ) {
     76                ScrubTyVars scrubber( tyVars, true );
    5477                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    5578        }
  • src/SymTab/Autogen.cc

    r752dc70 r3bb195cb  
    174174
    175175        void makeStructMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, TypeSubstitution & genericSubs, bool isDynamicLayout, bool forward = true ) {
    176                 if ( isDynamicLayout && src ) {
    177                         genericSubs.apply( src );
    178                 }
     176//              if ( isDynamicLayout && src ) {
     177//                      genericSubs.apply( src );
     178//              }
    179179
    180180                ObjectDecl * returnVal = NULL;
Note: See TracChangeset for help on using the changeset viewer.