Changes in / [87b5bf0:e64365c]
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/working/resolver_design.md
r87b5bf0 re64365c 1414 1414 considered if no match was found in the previous class. 1415 1415 1416 Another source of efficiency would be to cache the best given interpretation 1417 of a subexpression within an environment; this may not be incredibly useful 1418 for explict parameters (though it may be useful for, e.g. `f( x, x )`, where 1419 both parameters of `f` have the same type), but should pay some dividends for 1420 the implicit assertion parameters, especially the otype parameters for the 1421 argument of a generic type, which will generally be resolved in duplicate for 1422 (at least) the assignment operator, constructor, copy constructor & destructor 1423 of the generic type. 1424 1416 1425 ## Appendix A: Partial and Total Orders ## 1417 1426 The `<=` relation on integers is a commonly known _total order_, and -
src/ResolvExpr/AlternativeFinder.cc
r87b5bf0 re64365c 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.