Changeset 89b686a
- Timestamp:
- Jun 29, 2016, 4:47:52 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r59f9273 r89b686a 411 411 } 412 412 413 // / Map of declaration uniqueIds (intended to be the assertions in an AssertionSet) to their parents and the number of times they've been included414 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; 415 415 416 static const int recursionLimit = 10; ///< Limit to depth of recursion satisfaction417 static const unsigned recursionParentLimit = 1; ///< Limit to the number of times an assertion can recursively use itself416 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 418 418 419 419 void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) { … … 426 426 427 427 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,*/ 429 429 int level, const SymTab::Indexer &indexer, OutputIterator out ) { 430 430 if ( begin == end ) { … … 440 440 printAssertionSet( newNeed, std::cerr, 8 ); 441 441 ) 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 ); 443 443 return; 444 444 } … … 447 447 ForwardIterator cur = begin++; 448 448 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 ); 450 450 } 451 451 DeclarationWithType *curDecl = cur->first; … … 488 488 assert( (*candidate)->get_uniqueId() ); 489 489 DeclarationWithType *candDecl = static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) ); 490 AssertionParentSet newNeedParents( needParents );490 //AssertionParentSet newNeedParents( needParents ); 491 491 // 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; 493 494 Expression *varExpr = new VariableExpr( candDecl ); 494 495 deleteAll( varExpr->get_results() ); … … 505 506 // XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions 506 507 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 ); 508 509 } else { 509 510 delete adjType; … … 527 528 addToIndexer( have, decls ); 528 529 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 ); 531 532 // PRINT( 532 533 // std::cerr << "declaration 14 is ";
Note: See TracChangeset
for help on using the changeset viewer.