Changeset 95eec2c
- Timestamp:
 - Jan 4, 2021, 3:49:19 PM (5 years ago)
 - Branches:
 - ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
 - Children:
 - ed1a6374
 - Parents:
 - c04a19e (diff), 1958fec (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. - Files:
 - 
      
- 6 edited
 
- 
          
  libcfa/src/memory.cfa (modified) (2 diffs)
 - 
          
  libcfa/src/stdlib.hfa (modified) (1 diff)
 - 
          
  src/ResolvExpr/RenameVars.cc (modified) (2 diffs)
 - 
          
  src/ResolvExpr/RenameVars.h (modified) (1 diff)
 - 
          
  src/ResolvExpr/Resolver.cc (modified) (1 diff)
 - 
          
  src/ResolvExpr/SatisfyAssertions.cpp (modified) (4 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
libcfa/src/memory.cfa
rc04a19e r95eec2c 66 66 forall(dtype T | sized(T), ttype Args | { void ?{}(T&, Args); }) 67 67 void ?{}(counter_ptr(T) & this, Args args) { 68 this.data = new(args);68 this.data = (counter_data(T)*)new(args); 69 69 } 70 70 … … 126 126 forall(dtype T | sized(T), ttype Args | { void ?{}(T &, Args); }) 127 127 void ?{}(unique_ptr(T) & this, Args args) { 128 this.data = new(args);128 this.data = (T *)new(args); 129 129 } 130 130  - 
      
libcfa/src/stdlib.hfa
rc04a19e r95eec2c 267 267 static inline forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } ) 268 268 T * new( TT p ) { 269 return &(* malloc()){ p }; // run constructor269 return &(*(T *)malloc()){ p }; // run constructor 270 270 } // new 271 271  - 
      
src/ResolvExpr/RenameVars.cc
rc04a19e r95eec2c 186 186 } 187 187 188 const ast::Type * renameTyVars( const ast::Type * t, RenameMode mode ) {188 const ast::Type * renameTyVars( const ast::Type * t, RenameMode mode, bool reset ) { 189 189 // ast::Type *tc = ast::deepCopy(t); 190 190 ast::Pass<RenameVars_new> renamer; 191 191 renamer.core.mode = mode; 192 if (mode == GEN_USAGE ) {192 if (mode == GEN_USAGE && reset) { 193 193 renaming.nextUsage(); 194 194 } … … 198 198 void resetTyVarRenaming() { 199 199 renaming.reset(); 200 renaming.nextUsage(); 200 201 } 201 202  - 
      
src/ResolvExpr/RenameVars.h
rc04a19e r95eec2c 35 35 GEN_EXPR_ID // for type in decl 36 36 }; 37 const ast::Type * renameTyVars( const ast::Type *, RenameMode mode = GEN_USAGE ); 37 const ast::Type * renameTyVars( const ast::Type *, RenameMode mode = GEN_USAGE, bool reset = true ); 38 38 39 39 40 /// resets internal state of renamer to avoid overflow  - 
      
src/ResolvExpr/Resolver.cc
rc04a19e r95eec2c 1151 1151 const ast::Expr * untyped, const ast::SymbolTable & symtab 1152 1152 ) { 1153 resetTyVarRenaming();1154 1153 ast::TypeEnvironment env; 1155 1154 ast::ptr< ast::Expr > newExpr = resolveInVoidContext( untyped, symtab, env );  - 
      
src/ResolvExpr/SatisfyAssertions.cpp
rc04a19e r95eec2c 202 202 ast::ptr< ast::Type > toType = assn.first->result; 203 203 ast::ptr< ast::Type > adjType = 204 renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ) );204 renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ), GEN_USAGE, false ); 205 205 206 206 // only keep candidates which unify … … 385 385 386 386 /// Limit to depth of recursion of assertion satisfaction 387 static const int recursionLimit = 4;387 static const int recursionLimit = 8; 388 388 /// Maximum number of simultaneously-deferred assertions to attempt concurrent satisfaction of 389 389 static const int deferLimit = 10; … … 417 417 if ( it != thresholds.end() && it->second < sat.costs ) goto nextSat; 418 418 419 // make initial pass at matching assertions 420 for ( auto & assn : sat.need ) { 421 // fail early if any assertion is not satisfiable 422 if ( ! satisfyAssertion( assn, sat ) ) { 419 // should a limit be imposed? worst case here is O(n^2) but very unlikely to happen. 420 for (unsigned resetCount = 0; ; ++resetCount) { 421 ast::AssertionList next; 422 resetTyVarRenaming(); 423 // make initial pass at matching assertions 424 for ( auto & assn : sat.need ) { 425 // fail early if any assertion is not satisfiable 426 if ( ! satisfyAssertion( assn, sat ) ) { 427 next.emplace_back(assn); 428 // goto nextSat; 429 } 430 } 431 // success 432 if (next.empty()) break; 433 // fail if nothing resolves 434 else if (next.size() == sat.need.size()) { 423 435 Indenter tabs{ 3 }; 424 436 std::ostringstream ss; … … 426 438 print( ss, *sat.cand, ++tabs ); 427 439 ss << (tabs-1) << "Could not satisfy assertion:\n"; 428 ast::print( ss, assn.first, tabs );440 ast::print( ss, next[0].first, tabs ); 429 441 430 442 errors.emplace_back( ss.str() ); 431 443 goto nextSat; 432 444 } 445 sat.need = std::move(next); 433 446 } 434 447  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.