Changes in / [adb6a4f1:ecae5860]


Ignore:
Location:
src
Files:
3 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AdjustExprType.cc

    radb6a4f1 recae5860  
    6666
    6767        Type * AdjustExprType::postmutate( ArrayType * arrayType ) {
    68                 PointerType *pointerType = new PointerType{ arrayType->get_qualifiers(), arrayType->base };
     68                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base );
    6969                arrayType->base = nullptr;
    7070                delete arrayType;
     
    7373
    7474        Type * AdjustExprType::postmutate( FunctionType * functionType ) {
    75                 return new PointerType{ Type::Qualifiers(), functionType };
     75                return new PointerType( Type::Qualifiers(), functionType );
    7676        }
    7777
    7878        Type * AdjustExprType::postmutate( TypeInstType * typeInst ) {
    79                 if ( const EqvClass* eqvClass = env.lookup( typeInst->get_name() ) ) {
    80                         if ( eqvClass->data.kind == TypeDecl::Ftype ) {
    81                                 return new PointerType{ Type::Qualifiers(), typeInst };
     79                EqvClass eqvClass;
     80                if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     81                        if ( eqvClass.data.kind == TypeDecl::Ftype ) {
     82                                PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst );
     83                                return pointerType;
    8284                        }
    8385                } else if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
    8486                        if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
    8587                                if ( tyDecl->get_kind() == TypeDecl::Ftype ) {
    86                                         return new PointerType{ Type::Qualifiers(), typeInst };
     88                                        PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst );
     89                                        return pointerType;
    8790                                } // if
    8891                        } // if
  • src/ResolvExpr/Alternative.cc

    radb6a4f1 recae5860  
    2727
    2828namespace ResolvExpr {
    29         Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( nullptr ) {}
     29        Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( 0 ) {}
    3030
    3131        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
     
    4848        }
    4949
    50         Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( std::move( other.env ) ) {
     50        Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( other.env ) {
    5151                other.expr = nullptr;
    5252        }
     
    5858                cvtCost = other.cvtCost;
    5959                expr = other.expr;
    60                 env = std::move( other.env );
     60                env = other.env;
    6161                other.expr = nullptr;
    6262                return *this;
  • src/ResolvExpr/AlternativeFinder.cc

    radb6a4f1 recae5860  
    102102                void addAnonConversions( const Alternative & alt );
    103103                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    104                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string & name );
     104                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
    105105                /// Adds alternatives for member expressions where the left side has tuple type
    106106                void addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     
    307307
    308308                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->result ) ) {
    309                         addAggMembers( structInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, "" );
     309                        NameExpr nameExpr( "" );
     310                        addAggMembers( structInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr );
    310311                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->result ) ) {
    311                         addAggMembers( unionInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, "" );
     312                        NameExpr nameExpr( "" );
     313                        addAggMembers( unionInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr );
    312314                } // if
    313315        }
    314316
    315317        template< typename StructOrUnionType >
    316         void AlternativeFinder::Finder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string & name ) {
     318        void AlternativeFinder::Finder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     319                // by this point, member must be a name expr
     320                NameExpr * nameExpr = dynamic_cast< NameExpr * >( member );
     321                if ( ! nameExpr ) return;
     322                const std::string & name = nameExpr->name;
    317323                std::list< Declaration* > members;
    318324                aggInst->lookup( name, members );
    319325
    320                 for ( Declaration * decl : members ) {
    321                         if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( decl ) ) {
    322                                 // addAnonAlternatives uses vector::push_back, which invalidates references to existing elements, so
    323                                 // can't construct in place and use vector::back
    324                                 Alternative newAlt( new MemberExpr( dwt, expr->clone() ), env, newCost );
    325                                 renameTypes( newAlt.expr );
    326                                 addAnonConversions( newAlt ); // add anonymous member interpretations whenever an aggregate value type is seen as a member expression.
    327                                 alternatives.push_back( std::move(newAlt) );
     326                for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
     327                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) {
     328                                alternatives.push_back( Alternative( new MemberExpr( dwt, expr->clone() ), env, newCost ) );
     329                                renameTypes( alternatives.back().expr );
     330                                addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a member expression.
    328331                        } else {
    329332                                assert( false );
     
    466469        }
    467470
     471        // /// Map of declaration uniqueIds (intended to be the assertions in an AssertionSet) to their parents and the number of times they've been included
     472        //typedef std::unordered_map< UniqueId, std::unordered_map< UniqueId, unsigned > > AssertionParentSet;
     473
    468474        static const int recursionLimit = /*10*/ 4;  ///< Limit to depth of recursion satisfaction
     475        //static const unsigned recursionParentLimit = 1;  ///< Limit to the number of times an assertion can recursively use itself
    469476
    470477        void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) {
     
    477484
    478485        template< typename ForwardIterator, typename OutputIterator >
    479         void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, int level, const SymTab::Indexer &indexer, OutputIterator out ) {
     486        void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, /*const AssertionParentSet &needParents,*/
     487                                                 int level, const SymTab::Indexer &indexer, OutputIterator out ) {
    480488                if ( begin == end ) {
    481489                        if ( newNeed.empty() ) {
     
    495503                                        printAssertionSet( newNeed, std::cerr, 8 );
    496504                                )
    497                                 inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, level+1, indexer, out );
     505                                inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, /*needParents,*/ level+1, indexer, out );
    498506                                return;
    499507                        }
     
    502510                ForwardIterator cur = begin++;
    503511                if ( ! cur->second.isUsed ) {
    504                         inferRecursive( begin, end, newAlt, openVars, decls, newNeed, level, indexer, out );
     512                        inferRecursive( begin, end, newAlt, openVars, decls, newNeed, /*needParents,*/ level, indexer, out );
    505513                        return; // xxx - should this continue? previously this wasn't here, and it looks like it should be
    506514                }
     
    555563                                }
    556564
     565                                //AssertionParentSet newNeedParents( needParents );
     566                                // skip repeatingly-self-recursive assertion satisfaction
     567                                // DOESN'T WORK: grandchild nodes conflict with their cousins
     568                                //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
     569
    557570                                Expression *varExpr = data.combine( newerAlt.cvtCost );
    558571                                delete varExpr->get_result();
     
    572585                                // XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions
    573586                                (*inferParameters)[ curDecl->get_uniqueId() ] = ParamEntry( candidate->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr );
    574                                 inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, level, indexer, out );
     587                                inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, /*newNeedParents,*/ level, indexer, out );
    575588                        } else {
    576589                                delete adjType;
     
    594607                addToIndexer( have, decls );
    595608                AssertionSet newNeed;
     609                //AssertionParentSet needParents;
    596610                PRINT(
    597611                        std::cerr << "env is: " << std::endl;
     
    600614                )
    601615
    602                 inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, 0, indexer, out );
     616                inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, /*needParents,*/ 0, indexer, out );
    603617//      PRINT(
    604618//          std::cerr << "declaration 14 is ";
     
    10791093                AlternativeFinder funcOpFinder( indexer, env );
    10801094                // it's ok if there aren't any defined function ops
    1081                 funcOpFinder.maybeFind( opExpr );
     1095                funcOpFinder.maybeFind( opExpr);
    10821096                PRINT(
    10831097                        std::cerr << "known function ops:" << std::endl;
     
    11161130                                        }
    11171131                                } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( func->expr->result->stripReferences() ) ) { // handle ftype (e.g. *? on function pointer)
    1118                                         if ( const EqvClass *eqvClass = func->env.lookup( typeInst->name ) ) {
    1119                                                 if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass->type ) ) {
     1132                                        EqvClass eqvClass;
     1133                                        if ( func->env.lookup( typeInst->name, eqvClass ) && eqvClass.type ) {
     1134                                                if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass.type ) ) {
    11201135                                                        Alternative newFunc( *func );
    11211136                                                        referenceToRvalueConversion( newFunc.expr, newFunc.cost );
     
    13321347        }
    13331348
    1334         namespace {
    1335                 /// Gets name from untyped member expression (member must be NameExpr)
    1336                 const std::string& get_member_name( UntypedMemberExpr *memberExpr ) {
    1337                         NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() );
    1338                         assert( nameExpr );
    1339                         return nameExpr->get_name();
    1340                 }
    1341         }
    1342 
    13431349        void AlternativeFinder::Finder::postvisit( UntypedMemberExpr *memberExpr ) {
    13441350                AlternativeFinder funcFinder( indexer, env );
     
    13531359                        // find member of the given type
    13541360                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) {
    1355                                 addAggMembers( structInst, aggrExpr, cost, agg->env, get_member_name(memberExpr) );
     1361                                addAggMembers( structInst, aggrExpr, cost, agg->env, memberExpr->get_member() );
    13561362                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) {
    1357                                 addAggMembers( unionInst, aggrExpr, cost, agg->env, get_member_name(memberExpr) );
     1363                                addAggMembers( unionInst, aggrExpr, cost, agg->env, memberExpr->get_member() );
    13581364                        } else if ( TupleType * tupleType = dynamic_cast< TupleType * >( aggrExpr->get_result() ) ) {
    13591365                                addTupleMembers( tupleType, aggrExpr, cost, agg->env, memberExpr->get_member() );
     
    13731379                        Cost cost = Cost::zero;
    13741380                        Expression * newExpr = data.combine( cost );
    1375 
    1376                         // addAnonAlternatives uses vector::push_back, which invalidates references to existing elements, so
    1377                         // can't construct in place and use vector::back
    1378                         Alternative newAlt( newExpr, env, Cost::zero, cost );
     1381                        alternatives.push_back( Alternative( newExpr, env, Cost::zero, cost ) );
    13791382                        PRINT(
    13801383                                std::cerr << "decl is ";
     
    13851388                                std::cerr << std::endl;
    13861389                        )
    1387                         renameTypes( newAlt.expr );
    1388                         addAnonConversions( newAlt ); // add anonymous member interpretations whenever an aggregate value type is seen as a name expression.
    1389                         alternatives.push_back( std::move(newAlt) );
     1390                        renameTypes( alternatives.back().expr );
     1391                        addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a name expression.
    13901392                } // for
    13911393        }
  • src/ResolvExpr/CastCost.cc

    radb6a4f1 recae5860  
    4343        Cost castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    4444                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    45                         if ( const EqvClass* eqvClass = env.lookup( destAsTypeInst->get_name() ) ) {
    46                                 if ( eqvClass->type ) {
    47                                         return castCost( src, eqvClass->type, indexer, env );
     45                        EqvClass eqvClass;
     46                        NamedTypeDecl *namedType;
     47                        if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
     48                                if ( eqvClass.type ) {
     49                                        return castCost( src, eqvClass.type, indexer, env );
    4850                                } else {
    4951                                        return Cost::infinity;
    5052                                }
    51                         } else if ( NamedTypeDecl *namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) {
     53                        } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
    5254                                // all typedefs should be gone by this point
    5355                                TypeDecl *type = strict_dynamic_cast< TypeDecl* >( namedType );
  • src/ResolvExpr/ConversionCost.cc

    radb6a4f1 recae5860  
    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;
    4446                        PRINT( std::cerr << "type inst " << destAsTypeInst->name; )
    45                         if ( const EqvClass* eqvClass = env.lookup( destAsTypeInst->name ) ) {
    46                                 if ( eqvClass->type ) {
    47                                         return conversionCost( src, eqvClass->type, indexer, env );
     47                        if ( env.lookup( destAsTypeInst->name, eqvClass ) ) {
     48                                if ( eqvClass.type ) {
     49                                        return conversionCost( src, eqvClass.type, indexer, env );
    4850                                } else {
    4951                                        return Cost::infinity;
    5052                                }
    51                         } else if ( NamedTypeDecl *namedType = indexer.lookupType( destAsTypeInst->name ) ) {
     53                        } else if ( ( namedType = indexer.lookupType( destAsTypeInst->name ) ) ) {
    5254                                PRINT( std::cerr << " found" << std::endl; )
    5355                                TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
     
    367369
    368370        void ConversionCost::postvisit( TypeInstType *inst ) {
    369                 if ( const EqvClass *eqvClass = env.lookup( inst->name ) ) {
    370                         cost = costFunc( eqvClass->type, dest, indexer, env );
     371                EqvClass eqvClass;
     372                NamedTypeDecl *namedType;
     373                if ( env.lookup( inst->name, eqvClass ) ) {
     374                        cost = costFunc( eqvClass.type, dest, indexer, env );
    371375                } else if ( TypeInstType *destAsInst = dynamic_cast< TypeInstType* >( dest ) ) {
    372376                        if ( inst->name == destAsInst->name ) {
    373377                                cost = Cost::zero;
    374378                        }
    375                 } else if ( NamedTypeDecl *namedType = indexer.lookupType( inst->name ) ) {
     379                } else if ( ( namedType = indexer.lookupType( inst->name ) ) ) {
    376380                        TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
    377381                        // all typedefs should be gone by this point
  • src/ResolvExpr/Occurs.cc

    radb6a4f1 recae5860  
    3838
    3939        Occurs::Occurs( std::string varName, const TypeEnvironment & env ) : result( false ), tenv( env ) {
    40                 if ( const EqvClass *eqvClass = tenv.lookup( varName ) ) {
    41                         eqvVars = eqvClass->vars;
     40                EqvClass eqvClass;
     41                if ( tenv.lookup( varName, eqvClass ) ) {
     42                        eqvVars = eqvClass.vars;
    4243                } else {
    4344                        eqvVars.insert( varName );
     
    4647
    4748        void Occurs::previsit( TypeInstType * typeInst ) {
    48                 ///   std::cerr << "searching for vars: ";
     49                EqvClass eqvClass;
     50///   std::cerr << "searching for vars: ";
    4951///   std::copy( eqvVars.begin(), eqvVars.end(), std::ostream_iterator< std::string >( std::cerr, " " ) );
    5052///   std::cerr << std::endl;
    5153                if ( eqvVars.find( typeInst->get_name() ) != eqvVars.end() ) {
    5254                        result = true;
    53                 } else if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {
    54                         if ( eqvClass->type ) {
     55                } else if ( tenv.lookup( typeInst->get_name(), eqvClass ) ) {
     56                        if ( eqvClass.type ) {
    5557///       std::cerr << typeInst->get_name() << " is bound to";
    5658///       eqvClass.type->print( std::cerr );
    5759///       std::cerr << std::endl;
    58                                 eqvClass->type->accept( *visitor );
     60                                eqvClass.type->accept( *visitor );
    5961                        } // if
    6062                } // if
  • src/ResolvExpr/PolyCost.cc

    radb6a4f1 recae5860  
    3939
    4040        void PolyCost::previsit(TypeInstType * typeInst) {
    41                 if ( const EqvClass *eqvClass = tenv.lookup( typeInst->name ) ) {
    42                         if ( eqvClass->type ) {
    43                                 if ( TypeInstType * otherTypeInst = dynamic_cast< TypeInstType* >( eqvClass->type ) ) {
     41                EqvClass eqvClass;
     42                if ( tenv.lookup( typeInst->name, eqvClass ) ) {
     43                        if ( eqvClass.type ) {
     44                                if ( TypeInstType * otherTypeInst = dynamic_cast< TypeInstType* >( eqvClass.type ) ) {
    4445                                        if ( indexer.lookupType( otherTypeInst->name ) ) {
    4546                                                // bound to opaque type
  • src/ResolvExpr/PtrsAssignable.cc

    radb6a4f1 recae5860  
    5151                // std::cerr << "assignable: " << src << " | " << dest << std::endl;
    5252                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    53                         if ( const EqvClass *eqvClass = env.lookup( destAsTypeInst->get_name() ) ) {
    54                                 return ptrsAssignable( src, eqvClass->type, env );
     53                        EqvClass eqvClass;
     54                        if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
     55                                return ptrsAssignable( src, eqvClass.type, env );
    5556                        } // if
    5657                } // if
     
    9495        void PtrsAssignable::postvisit(  __attribute__((unused)) TraitInstType *inst ) {}
    9596        void PtrsAssignable::postvisit( TypeInstType *inst ) {
    96                 if ( const EqvClass *eqvClass = env.lookup( inst->get_name() ) ) {
    97                         if ( eqvClass->type ) {
    98                                 // T * = S * for any S depends on the type bound to T
    99                                 result = ptrsAssignable( eqvClass->type, dest, env );
    100                         }
     97                EqvClass eqvClass;
     98                if ( env.lookup( inst->get_name(), eqvClass ) && eqvClass.type ) {
     99                        // T * = S * for any S depends on the type bound to T
     100                        result = ptrsAssignable( eqvClass.type, dest, env );
    101101                } // if
    102102        }
  • src/ResolvExpr/PtrsCastable.cc

    radb6a4f1 recae5860  
    5757                                return -1;
    5858                        } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( src ) ) {
     59                                EqvClass eqvClass;
    5960                                if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
    6061                                        if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
     
    6364                                                } // if
    6465                                        } //if
    65                                 } else if ( const EqvClass *eqvClass = env.lookup( typeInst->get_name() ) ) {
    66                                         if ( eqvClass->data.kind == TypeDecl::Ftype ) {
     66                                } else if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
     67                                        if ( eqvClass.data.kind == TypeDecl::Ftype ) {
    6768                                                return -1;
    6869                                        } // if
     
    7879        int ptrsCastable( Type *src, Type *dest, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
    7980                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    80                         if ( const EqvClass *eqvClass = env.lookup( destAsTypeInst->get_name() ) ) {
     81                        EqvClass eqvClass;
     82                        if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
    8183                                // xxx - should this be ptrsCastable?
    82                                 return ptrsAssignable( src, eqvClass->type, env );
     84                                return ptrsAssignable( src, eqvClass.type, env );
    8385                        } // if
    8486                } // if
  • src/ResolvExpr/TypeEnvironment.cc

    radb6a4f1 recae5860  
    1717#include <algorithm>                   // for copy, set_intersection
    1818#include <iterator>                    // for ostream_iterator, insert_iterator
    19 #include <utility>                     // for pair, move
     19#include <utility>                     // for pair
    2020
    2121#include "Common/utility.h"            // for maybeClone
     
    4444
    4545        void EqvClass::initialize( const EqvClass &src, EqvClass &dest ) {
    46                 initialize( src, dest, src.type );
    47         }
    48 
    49         void EqvClass::initialize( const EqvClass &src, EqvClass &dest, const Type *ty ) {
    5046                dest.vars = src.vars;
    51                 dest.type = maybeClone( ty );
     47                dest.type = maybeClone( src.type );
    5248                dest.allowWidening = src.allowWidening;
    5349                dest.data = src.data;
    5450        }
    5551
    56         EqvClass::EqvClass() : type( nullptr ), allowWidening( true ) {
     52        EqvClass::EqvClass() : type( 0 ), allowWidening( true ) {
    5753        }
    5854
    5955        EqvClass::EqvClass( const EqvClass &other ) {
    6056                initialize( other, *this );
    61         }
    62 
    63         EqvClass::EqvClass( const EqvClass &other, const Type *ty ) {
    64                 initialize( other, *this, ty );
    6557        }
    6658
     
    9082        }
    9183
    92         const EqvClass* TypeEnvironment::lookup( const std::string &var ) const {
     84        bool TypeEnvironment::lookup( const std::string &var, EqvClass &eqvClass ) const {
    9385                for ( std::list< EqvClass >::const_iterator i = env.begin(); i != env.end(); ++i ) {
    9486                        if ( i->vars.find( var ) != i->vars.end() ) {
    9587///       std::cout << var << " is in class ";
    9688///       i->print( std::cout );
    97                                 return &*i;
     89                                eqvClass = *i;
     90                                return true;
    9891                        }
    9992///     std::cout << var << " is not in class ";
    10093///     i->print( std::cout );
    10194                } // for
    102                 return nullptr;
    103         }
    104 
    105         /// Removes any class from env that intersects eqvClass
    106         void filterOverlappingClasses( std::list<EqvClass> &env, const EqvClass &eqvClass ) {
    107                 for ( auto i = env.begin(); i != env.end(); ) {
    108                         auto next = i;
    109                         ++next;
    110                         std::set<std::string> intersection;
    111                         std::set_intersection( i->vars.begin(), i->vars.end(), eqvClass.vars.begin(), eqvClass.vars.end(),
    112                                 std::inserter( intersection, intersection.begin() ) );
    113                         if ( ! intersection.empty() ) { env.erase( i ); }
     95                return false;
     96        }
     97
     98        void TypeEnvironment::add( const EqvClass &eqvClass ) {
     99                std::list< EqvClass >::iterator i = env.begin();
     100                while ( i != env.end() ) {
     101                        std::list< EqvClass >::iterator next = i;
     102                        next++;
     103                        std::set< std::string > intersection;
     104                        std::set_intersection( i->vars.begin(), i->vars.end(), eqvClass.vars.begin(), eqvClass.vars.end(), std::inserter( intersection, intersection.begin() ) );
     105                        if ( ! intersection.empty() ) {
     106                                env.erase( i );
     107                        } // if
    114108                        i = next;
    115                 }
    116         }
    117 
    118         void TypeEnvironment::add( const EqvClass &eqvClass ) {
    119                 filterOverlappingClasses( env, eqvClass );
    120                 env.push_back( eqvClass );
    121         }
    122 
    123         void TypeEnvironment::add( EqvClass &&eqvClass ) {
    124                 filterOverlappingClasses( env, eqvClass );
    125                 env.push_back( std::move(eqvClass) );
     109                } // while
     110                env.insert( env.end(), eqvClass );
    126111        }
    127112
     
    174159
    175160        void TypeEnvironment::print( std::ostream &os, Indenter indent ) const {
    176                 for ( const EqvClass & theClass : env ) {
    177                         theClass.print( os, indent );
     161                for ( std::list< EqvClass >::const_iterator i = env.begin(); i != env.end(); ++i ) {
     162                        i->print( os, indent );
    178163                } // for
    179164        }
  • src/ResolvExpr/TypeEnvironment.h

    radb6a4f1 recae5860  
    7373
    7474                void initialize( const EqvClass &src, EqvClass &dest );
    75                 void initialize( const EqvClass &src, EqvClass &dest, const Type *ty );
    7675                EqvClass();
    7776                EqvClass( const EqvClass &other );
    78                 EqvClass( const EqvClass &other, const Type *ty );
    7977                EqvClass &operator=( const EqvClass &other );
    8078                ~EqvClass();
     
    8482        class TypeEnvironment {
    8583          public:
    86                 const EqvClass* lookup( const std::string &var ) const;
     84                bool lookup( const std::string &var, EqvClass &eqvClass ) const;
    8785                void add( const EqvClass &eqvClass );
    88                 void add( EqvClass &&eqvClass  );
    8986                void add( const Type::ForallList &tyDecls );
    9087                void add( const TypeSubstitution & sub );
  • src/ResolvExpr/Unify.cc

    radb6a4f1 recae5860  
    2020#include <set>                    // for set
    2121#include <string>                 // for string, operator==, operator!=, bas...
    22 #include <utility>                // for pair, move
     22#include <utility>                // for pair
    2323
    2424#include "Common/PassVisitor.h"   // for PassVisitor
     
    166166                        return false;
    167167                } // if
    168                 if ( const EqvClass *curClass = env.lookup( typeInst->get_name() ) ) {
    169                         if ( curClass->type ) {
     168                EqvClass curClass;
     169                if ( env.lookup( typeInst->get_name(), curClass ) ) {
     170                        if ( curClass.type ) {
    170171                                Type *common = 0;
    171172                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    172                                 std::unique_ptr< Type > newType( curClass->type->clone() );
     173                                std::unique_ptr< Type > newType( curClass.type->clone() );
    173174                                newType->get_qualifiers() = typeInst->get_qualifiers();
    174                                 if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass->allowWidening, true ), indexer, common ) ) {
     175                                if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
    175176                                        if ( common ) {
    176177                                                common->get_qualifiers() = Type::Qualifiers();
    177                                                 env.add( EqvClass{ *curClass, common } );
     178                                                delete curClass.type;
     179                                                curClass.type = common;
     180                                                env.add( curClass );
    178181                                        } // if
    179182                                        return true;
     
    182185                                } // if
    183186                        } else {
    184                                 EqvClass newClass { *curClass, other };
    185                                 newClass.type->get_qualifiers() = Type::Qualifiers();
    186                                 newClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond;
    187                                 env.add( std::move(newClass) );
     187                                curClass.type = other->clone();
     188                                curClass.type->get_qualifiers() = Type::Qualifiers();
     189                                curClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond;
     190                                env.add( curClass );
    188191                        } // if
    189192                } else {
     
    201204        bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
    202205                bool result = true;
    203                 const EqvClass *class1 = env.lookup( var1->get_name() );
    204                 const EqvClass *class2 = env.lookup( var2->get_name() );
     206                EqvClass class1, class2;
     207                bool hasClass1 = false, hasClass2 = false;
    205208                bool widen1 = false, widen2 = false;
    206                 Type *type1 = nullptr, *type2 = nullptr;
    207 
    208                 if ( class1 ) {
    209                         if ( class1->type ) {
    210                                 if ( occurs( class1->type, var2->get_name(), env ) ) {
     209                Type *type1 = 0, *type2 = 0;
     210
     211                if ( env.lookup( var1->get_name(), class1 ) ) {
     212                        hasClass1 = true;
     213                        if ( class1.type ) {
     214                                if ( occurs( class1.type, var2->get_name(), env ) ) {
    211215                                        return false;
    212216                                } // if
    213                                 type1 = class1->type->clone();
    214                         } // if
    215                         widen1 = widenMode.widenFirst && class1->allowWidening;
    216                 } // if
    217                 if ( class2 ) {
    218                         if ( class2->type ) {
    219                                 if ( occurs( class2->type, var1->get_name(), env ) ) {
     217                                type1 = class1.type->clone();
     218                        } // if
     219                        widen1 = widenMode.widenFirst && class1.allowWidening;
     220                } // if
     221                if ( env.lookup( var2->get_name(), class2 ) ) {
     222                        hasClass2 = true;
     223                        if ( class2.type ) {
     224                                if ( occurs( class2.type, var1->get_name(), env ) ) {
    220225                                        return false;
    221226                                } // if
    222                                 type2 = class2->type->clone();
    223                         } // if
    224                         widen2 = widenMode.widenSecond && class2->allowWidening;
     227                                type2 = class2.type->clone();
     228                        } // if
     229                        widen2 = widenMode.widenSecond && class2.allowWidening;
    225230                } // if
    226231
     
    230235                        Type *common = 0;
    231236                        if ( unifyInexact( type1, type2, env, needAssertions, haveAssertions, openVars, newWidenMode, indexer, common ) ) {
    232                                 EqvClass newClass1 = *class1;
    233                                 newClass1.vars.insert( class2->vars.begin(), class2->vars.end() );
    234                                 newClass1.allowWidening = widen1 && widen2;
     237                                class1.vars.insert( class2.vars.begin(), class2.vars.end() );
     238                                class1.allowWidening = widen1 && widen2;
    235239                                if ( common ) {
    236240                                        common->get_qualifiers() = Type::Qualifiers();
    237                                         delete newClass1.type;
    238                                         newClass1.type = common;
     241                                        delete class1.type;
     242                                        class1.type = common;
    239243                                } // if
    240                                 env.add( std::move(newClass1) );
     244                                env.add( class1 );
    241245                        } else {
    242246                                result = false;
    243247                        } // if
    244                 } else if ( class1 && class2 ) {
     248                } else if ( hasClass1 && hasClass2 ) {
    245249                        if ( type1 ) {
    246                                 EqvClass newClass1 = *class1;
    247                                 newClass1.vars.insert( class2->vars.begin(), class2->vars.end() );
    248                                 newClass1.allowWidening = widen1;
    249                                 env.add( std::move(newClass1) );
     250                                class1.vars.insert( class2.vars.begin(), class2.vars.end() );
     251                                class1.allowWidening = widen1;
     252                                env.add( class1 );
    250253                        } else {
    251                                 EqvClass newClass2 = *class2;
    252                                 newClass2.vars.insert( class1->vars.begin(), class1->vars.end() );
    253                                 newClass2.allowWidening = widen2;
    254                                 env.add( std::move(newClass2) );
    255                         } // if
    256                 } else if ( class1 ) {
    257                         EqvClass newClass1 = *class1;
    258                         newClass1.vars.insert( var2->get_name() );
    259                         newClass1.allowWidening = widen1;
    260                         env.add( std::move(newClass1) );
    261                 } else if ( class2 ) {
    262                         EqvClass newClass2 = *class2;
    263                         newClass2.vars.insert( var1->get_name() );
    264                         newClass2.allowWidening = widen2;
    265                         env.add( std::move(newClass2) );
     254                                class2.vars.insert( class1.vars.begin(), class1.vars.end() );
     255                                class2.allowWidening = widen2;
     256                                env.add( class2 );
     257                        } // if
     258                } else if ( hasClass1 ) {
     259                        class1.vars.insert( var2->get_name() );
     260                        class1.allowWidening = widen1;
     261                        env.add( class1 );
     262                } else if ( hasClass2 ) {
     263                        class2.vars.insert( var1->get_name() );
     264                        class2.allowWidening = widen2;
     265                        env.add( class2 );
    266266                } else {
    267267                        EqvClass newClass;
     
    539539                void premutate( TypeInstType * ) { visit_children = false; }
    540540                Type * postmutate( TypeInstType * typeInst ) {
    541                         if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {
    542                                 // expand ttype parameter into its actual type
    543                                 if ( eqvClass->data.kind == TypeDecl::Ttype && eqvClass->type ) {
    544                                         delete typeInst;
    545                                         return eqvClass->type->clone();
     541                        EqvClass eqvClass;
     542                        if ( tenv.lookup( typeInst->get_name(), eqvClass ) ) {
     543                                if ( eqvClass.data.kind == TypeDecl::Ttype ) {
     544                                        // expand ttype parameter into its actual type
     545                                        if ( eqvClass.type ) {
     546                                                delete typeInst;
     547                                                return eqvClass.type->clone();
     548                                        }
    546549                                }
    547550                        }
  • src/SynTree/ReferenceToType.cc

    radb6a4f1 recae5860  
    5050
    5151namespace {
    52         void doLookup( const std::list< Declaration * > & members, const std::string & name, std::list< Declaration* > & foundDecls ) {
    53                 for ( Declaration * decl : members ) {
    54                         if ( decl->name == name ) {
    55                                 foundDecls.push_back( decl );
     52        void doLookup( const std::list< Declaration* > &members, const std::string &name, std::list< Declaration* > &foundDecls ) {
     53                for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
     54                        if ( (*i)->get_name() == name ) {
     55                                foundDecls.push_back( *i );
    5656                        } // if
    5757                } // for
     
    6060
    6161StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes ) :
    62                 Parent( tq, baseStruct->name, attributes ), baseStruct( baseStruct ) {}
     62                Parent( tq, baseStruct->get_name(), attributes ), baseStruct( baseStruct ) {}
    6363
    6464std::string StructInstType::typeString() const { return "struct"; }
     
    8484void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    8585        assert( baseStruct );
    86         doLookup( baseStruct->members, name, foundDecls );
     86        doLookup( baseStruct->get_members(), name, foundDecls );
    8787}
    8888
     
    103103
    104104UnionInstType::UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes ) :
    105                 Parent( tq, baseUnion->name, attributes ), baseUnion( baseUnion ) {}
     105                Parent( tq, baseUnion->get_name(), attributes ), baseUnion( baseUnion ) {}
    106106
    107107std::string UnionInstType::typeString() const { return "union"; }
     
    127127void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    128128        assert( baseUnion );
    129         doLookup( baseUnion->members, name, foundDecls );
     129        doLookup( baseUnion->get_members(), name, foundDecls );
    130130}
    131131
  • src/benchmark/Makefile.am

    radb6a4f1 recae5860  
    9696        ctxswitch-cfa_coroutine.run     \
    9797        ctxswitch-cfa_thread.run        \
    98         ctxswitch-cfa_thread2.run       \
    9998        ctxswitch-upp_coroutine.run     \
    10099        ctxswitch-upp_thread.run        \
    101         -ctxswitch-kos_fibre.run        \
    102         -ctxswitch-kos_fibre2.run       \
    103100        ctxswitch-goroutine.run         \
    104101        ctxswitch-java_thread.run
    105102
     103ctxswitch-cfa_coroutine$(EXEEXT):
     104        @${CC}        ctxswitch/cfa_cor.c   -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     105
     106ctxswitch-cfa_thread$(EXEEXT):
     107        @${CC}        ctxswitch/cfa_thrd.c  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     108
     109ctxswitch-upp_coroutine$(EXEEXT):
     110        @u++          ctxswitch/upp_cor.cc  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     111
     112ctxswitch-upp_thread$(EXEEXT):
     113        @u++          ctxswitch/upp_thrd.cc -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     114
    106115ctxswitch-pthread$(EXEEXT):
    107         @@BACKEND_CC@ ctxswitch/pthreads.c     -DBENCH_N=50000000  -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    108 
    109 ctxswitch-cfa_coroutine$(EXEEXT):
    110         @${CC}        ctxswitch/cfa_cor.c      -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    111 
    112 ctxswitch-cfa_thread$(EXEEXT):
    113         @${CC}        ctxswitch/cfa_thrd.c     -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    114 
    115 ctxswitch-cfa_thread2$(EXEEXT):
    116         @${CC}        ctxswitch/cfa_thrd2.c    -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    117 
    118 ctxswitch-upp_coroutine$(EXEEXT):
    119         @u++          ctxswitch/upp_cor.cc     -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    120 
    121 ctxswitch-upp_thread$(EXEEXT):
    122         @u++          ctxswitch/upp_thrd.cc    -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    123 
    124 ctxswitch-kos_fibre$(EXEEXT):
    125         @${CXX}       ctxswitch/kos_fibre.cpp  -DBENCH_N=50000000  -I. -I/home/tdelisle/software/KOS/src/ -g -O2 -lfibre -lpthread -lrt
    126 
    127 ctxswitch-kos_fibre2$(EXEEXT):
    128         @${CXX}       ctxswitch/kos_fibre2.cpp -DBENCH_N=50000000  -I. -I/home/tdelisle/software/KOS/src/ -g -O2 -lfibre -lpthread -lrt
     116        @@BACKEND_CC@ ctxswitch/pthreads.c  -DBENCH_N=50000000  -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    129117
    130118ctxswitch-goroutine$(EXEEXT):
  • src/benchmark/Makefile.in

    radb6a4f1 recae5860  
    509509        ctxswitch-cfa_coroutine.run     \
    510510        ctxswitch-cfa_thread.run        \
    511         ctxswitch-cfa_thread2.run       \
    512511        ctxswitch-upp_coroutine.run     \
    513512        ctxswitch-upp_thread.run        \
    514         -ctxswitch-kos_fibre.run        \
    515         -ctxswitch-kos_fibre2.run       \
    516513        ctxswitch-goroutine.run         \
    517514        ctxswitch-java_thread.run
    518515
     516ctxswitch-cfa_coroutine$(EXEEXT):
     517        @${CC}        ctxswitch/cfa_cor.c   -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     518
     519ctxswitch-cfa_thread$(EXEEXT):
     520        @${CC}        ctxswitch/cfa_thrd.c  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     521
     522ctxswitch-upp_coroutine$(EXEEXT):
     523        @u++          ctxswitch/upp_cor.cc  -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     524
     525ctxswitch-upp_thread$(EXEEXT):
     526        @u++          ctxswitch/upp_thrd.cc -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     527
    519528ctxswitch-pthread$(EXEEXT):
    520         @@BACKEND_CC@ ctxswitch/pthreads.c     -DBENCH_N=50000000  -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    521 
    522 ctxswitch-cfa_coroutine$(EXEEXT):
    523         @${CC}        ctxswitch/cfa_cor.c      -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    524 
    525 ctxswitch-cfa_thread$(EXEEXT):
    526         @${CC}        ctxswitch/cfa_thrd.c     -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    527 
    528 ctxswitch-cfa_thread2$(EXEEXT):
    529         @${CC}        ctxswitch/cfa_thrd2.c    -DBENCH_N=50000000  -I. -nodebug -lrt -quiet @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    530 
    531 ctxswitch-upp_coroutine$(EXEEXT):
    532         @u++          ctxswitch/upp_cor.cc     -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    533 
    534 ctxswitch-upp_thread$(EXEEXT):
    535         @u++          ctxswitch/upp_thrd.cc    -DBENCH_N=50000000  -I. -nodebug -lrt -quiet             ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    536 
    537 ctxswitch-kos_fibre$(EXEEXT):
    538         @${CXX}       ctxswitch/kos_fibre.cpp  -DBENCH_N=50000000  -I. -I/home/tdelisle/software/KOS/src/ -g -O2 -lfibre -lpthread -lrt
    539 
    540 ctxswitch-kos_fibre2$(EXEEXT):
    541         @${CXX}       ctxswitch/kos_fibre2.cpp -DBENCH_N=50000000  -I. -I/home/tdelisle/software/KOS/src/ -g -O2 -lfibre -lpthread -lrt
     529        @@BACKEND_CC@ ctxswitch/pthreads.c  -DBENCH_N=50000000  -I. -lrt -pthread                    ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    542530
    543531ctxswitch-goroutine$(EXEEXT):
     
    694682
    695683compile-io$(EXEEXT):
    696         @${CC} -quiet -fsyntax-only -w ../tests/io1.c                           @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     684        @${CC} -quiet -fsyntax-only -w ../tests/io.c                                    @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    697685
    698686compile-monitor$(EXEEXT):
    699         @${CC} -quiet -fsyntax-only -w ../tests/concurrent/monitor.c    @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     687        @${CC} -quiet -fsyntax-only -w ../tests/concurrent/monitor.c            @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    700688
    701689compile-operators$(EXEEXT):
     
    706694
    707695compile-typeof$(EXEEXT):
    708         @${CC} -quiet -fsyntax-only -w ../tests/typeof.c                        @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
     696        @${CC} -quiet -fsyntax-only -w ../tests/typeof.c                                @CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
    709697
    710698# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/libcfa/concurrency/invoke.h

    radb6a4f1 recae5860  
    1010// Created On       : Tue Jan 17 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 19 08:23:21 2018
    13 // Update Count     : 31
     12// Last Modified On : Fri Mar 30 22:33:59 2018
     13// Update Count     : 30
    1414//
    1515
     
    1818#include "bits/locks.h"
    1919
     20#define TL_GET( member ) kernelTLS.member
     21#define TL_SET( member, value ) kernelTLS.member = value;
     22
    2023#ifdef __cforall
    2124extern "C" {
     
    2528#ifndef _INVOKE_H_
    2629#define _INVOKE_H_
    27 
    28 #ifdef __ARM_ARCH
    29         // function prototypes are only really used by these macros on ARM
    30         void disable_global_interrupts();
    31         void enable_global_interrupts();
    32 
    33         #define TL_GET( member ) ( { __typeof__( kernelTLS.member ) target; \
    34                 disable_global_interrupts(); \
    35                 target = kernelTLS.member; \
    36                 enable_global_interrupts(); \
    37                 target; } )
    38         #define TL_SET( member, value ) disable_global_interrupts(); \
    39                 kernelTLS.member = value; \
    40                 enable_global_interrupts();
    41 #else
    42         #define TL_GET( member ) kernelTLS.member
    43         #define TL_SET( member, value ) kernelTLS.member = value;
    44 #endif
    4530
    4631        #ifdef __cforall
Note: See TracChangeset for help on using the changeset viewer.