Ignore:
Timestamp:
Jul 23, 2019, 4:46:33 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
83b52f1
Parents:
d6b03b7 (diff), fd642d2 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/TypeEnvironment.h

    rd6b03b7 r8fc15cf  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:24:58 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 30 23:04:10 2019
    13 // Update Count     : 9
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jul 19 17:00:10 2019
     13// Update Count     : 10
    1414//
    1515
     
    4040        // declarations.
    4141        //
    42         // I've seen a TU go from 54 minutes to 1 minute 34 seconds with the addition of this 
     42        // I've seen a TU go from 54 minutes to 1 minute 34 seconds with the addition of this
    4343        // comparator.
    4444        //
     
    4646        // memory layout can alter compilation time in unpredictable ways. For example, the placement
    4747        // of a line directive can reorder type pointers with respect to each other so that assertions
    48         // are seen in different orders, causing a potentially different number of unification calls 
    49         // when resolving assertions. I've seen a TU go from 36 seconds to 27 seconds by reordering 
    50         // line directives alone, so it would be nice to fix this comparison so that assertions compare 
    51         // more consistently. I've tried to modify this to compare on mangle name instead of type as 
    52         // the second comparator, but this causes some assertions to never be recorded. More 
     48        // are seen in different orders, causing a potentially different number of unification calls
     49        // when resolving assertions. I've seen a TU go from 36 seconds to 27 seconds by reordering
     50        // line directives alone, so it would be nice to fix this comparison so that assertions compare
     51        // more consistently. I've tried to modify this to compare on mangle name instead of type as
     52        // the second comparator, but this causes some assertions to never be recorded. More
    5353        // investigation is needed.
    5454        struct AssertCompare {
    55                 bool operator()( DeclarationWithType * d1, DeclarationWithType * d2 ) const {
     55                bool operator()( const DeclarationWithType * d1, const DeclarationWithType * d2 ) const {
    5656                        int cmp = d1->get_name().compare( d2->get_name() );
    5757                        return cmp < 0 ||
     
    6565                AssertionSetValue() : isUsed(false), resnSlot(0) {}
    6666        };
    67         typedef std::map< DeclarationWithType *, AssertionSetValue, AssertCompare > AssertionSet;
     67        typedef std::map< const DeclarationWithType *, AssertionSetValue, AssertCompare > AssertionSet;
    6868        typedef std::unordered_map< std::string, TypeDecl::Data > OpenVarSet;
    6969
     
    7878        struct EqvClass {
    7979                std::set< std::string > vars;
    80                 Type *type;
     80                Type * type;
    8181                bool allowWidening;
    8282                TypeDecl::Data data;
     
    111111                bool isEmpty() const { return env.empty(); }
    112112                void print( std::ostream &os, Indenter indent = {} ) const;
    113                
     113
    114114                /// Simply concatenate the second environment onto this one; no safety checks performed
    115115                void simpleCombine( const TypeEnvironment &second );
     
    126126                /// Returns false if fails, but does NOT roll back partial changes.
    127127                bool combine( const TypeEnvironment& second, OpenVarSet& openVars, const SymTab::Indexer& indexer );
    128                
     128
    129129                void extractOpenVars( OpenVarSet &openVars ) const;
    130130                TypeEnvironment *clone() const { return new TypeEnvironment( *this ); }
     
    134134                void addActual( const TypeEnvironment& actualEnv, OpenVarSet& openVars );
    135135
    136                 /// Binds the type class represented by `typeInst` to the type `bindTo`; will add 
     136                /// Binds the type class represented by `typeInst` to the type `bindTo`; will add
    137137                /// the class if needed. Returns false on failure.
    138                 bool bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer );
    139                
    140                 /// Binds the type classes represented by `var1` and `var2` together; will add 
     138                bool bindVar( const TypeInstType * typeInst, Type * bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer );
     139
     140                /// Binds the type classes represented by `var1` and `var2` together; will add
    141141                /// one or both classes if needed. Returns false on failure.
    142                 bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, TypeDecl::Data && data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer );
     142                bool bindVarToVar( const TypeInstType * var1, const TypeInstType * var2, TypeDecl::Data && data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer );
    143143
    144144                /// Disallows widening for all bindings in the environment
     
    151151          private:
    152152                ClassList env;
    153                
     153
    154154                ClassList::iterator internal_lookup( const std::string &var );
    155155        };
Note: See TracChangeset for help on using the changeset viewer.