Changeset 89b686a


Ignore:
Timestamp:
Jun 29, 2016, 4:47:52 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, 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:
e64365c
Parents:
59f9273
Message:

patch resolver-loop bug by bringing max-recursive-resolution depth down to 3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r59f9273 r89b686a  
    411411        }
    412412
    413         /// Map of declaration uniqueIds (intended to be the assertions in an AssertionSet) to their parents and the number of times they've been included
    414         typedef std::unordered_map< UniqueId, std::unordered_map< UniqueId, unsigned > > AssertionParentSet;
     413        // /// Map of declaration uniqueIds (intended to be the assertions in an AssertionSet) to their parents and the number of times they've been included
     414        //typedef std::unordered_map< UniqueId, std::unordered_map< UniqueId, unsigned > > AssertionParentSet;
    415415       
    416         static const int recursionLimit = 10;  ///< Limit to depth of recursion satisfaction
    417         static const unsigned recursionParentLimit = 1;  ///< Limit to the number of times an assertion can recursively use itself
     416        static const int recursionLimit = /*10*/ 3;  ///< Limit to depth of recursion satisfaction
     417        //static const unsigned recursionParentLimit = 1;  ///< Limit to the number of times an assertion can recursively use itself
    418418
    419419        void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) {
     
    426426       
    427427        template< typename ForwardIterator, typename OutputIterator >
    428         void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, const AssertionParentSet &needParents,
     428        void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, /*const AssertionParentSet &needParents,*/
    429429                                                 int level, const SymTab::Indexer &indexer, OutputIterator out ) {
    430430                if ( begin == end ) {
     
    440440                                        printAssertionSet( newNeed, std::cerr, 8 );
    441441                                )
    442                                 inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, needParents, level+1, indexer, out );
     442                                inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, /*needParents,*/ level+1, indexer, out );
    443443                                return;
    444444                        }
     
    447447                ForwardIterator cur = begin++;
    448448                if ( ! cur->second ) {
    449                         inferRecursive( begin, end, newAlt, openVars, decls, newNeed, needParents, level, indexer, out );
     449                        inferRecursive( begin, end, newAlt, openVars, decls, newNeed, /*needParents,*/ level, indexer, out );
    450450                }
    451451                DeclarationWithType *curDecl = cur->first;
     
    488488                                assert( (*candidate)->get_uniqueId() );
    489489                                DeclarationWithType *candDecl = static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) );
    490                                 AssertionParentSet newNeedParents( needParents );
     490                                //AssertionParentSet newNeedParents( needParents );
    491491                                // skip repeatingly-self-recursive assertion satisfaction
    492                                 if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
     492                                // DOESN'T WORK: grandchild nodes conflict with their cousins
     493                                //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
    493494                                Expression *varExpr = new VariableExpr( candDecl );
    494495                                deleteAll( varExpr->get_results() );
     
    505506                                // XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions
    506507                                appExpr->get_inferParams()[ curDecl->get_uniqueId() ] = ParamEntry( (*candidate)->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr );
    507                                 inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, newNeedParents, level, indexer, out );
     508                                inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, /*newNeedParents,*/ level, indexer, out );
    508509                        } else {
    509510                                delete adjType;
     
    527528                addToIndexer( have, decls );
    528529                AssertionSet newNeed;
    529                 AssertionParentSet needParents;
    530                 inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, needParents, 0, indexer, out );
     530                //AssertionParentSet needParents;
     531                inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, /*needParents,*/ 0, indexer, out );
    531532//      PRINT(
    532533//          std::cerr << "declaration 14 is ";
Note: See TracChangeset for help on using the changeset viewer.