Changes in / [c9b3a41:000ff2c]
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/cfa-pair.c
rc9b3a41 r000ff2c 2 2 #include "fstream" 3 3 4 forall(otype R, otype S 4 forall(otype R, otype S 5 5 | { int ?==?(R, R); int ?<?(R, R); int ?<?(S, S); }) 6 6 int ?<?(pair(R, S) p, pair(R, S) q) { … … 8 8 } 9 9 10 forall(otype R, otype S 10 forall(otype R, otype S 11 11 | { int ?==?(R, R); int ?<?(R, R); int ?<=?(S, S); }) 12 12 int ?<=?(pair(R, S) p, pair(R, S) q) { … … 24 24 } 25 25 26 forall(otype R, otype S 26 forall(otype R, otype S 27 27 | { int ?==?(R, R); int ?>?(R, R); int ?>?(S, S); }) 28 28 int ?>?(pair(R, S) p, pair(R, S) q) { … … 30 30 } 31 31 32 forall(otype R, otype S 32 forall(otype R, otype S 33 33 | { int ?==?(R, R); int ?>?(R, R); int ?>=?(S, S); }) 34 34 int ?>=?(pair(R, S) p, pair(R, S) q) { … … 37 37 38 38 forall(otype R, otype S) 39 forall(dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, pair(R, S) );})39 forall(dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, R ); ostype & ?|?( ostype &, S ); }) 40 40 ostype & ?|?( ostype & os, pair(R, S) p ) { 41 41 return os | '[' | p.first | ',' | p.second | ']'; -
doc/papers/general/evaluation/cfa-stack.c
rc9b3a41 r000ff2c 16 16 stack_node(T) ** crnt = &s.head; 17 17 for ( stack_node(T) * next = t.head; next; next = next->next ) { 18 *crnt = new( next->value, 0 ); 18 // *crnt = new( next->value, 0 ); 19 stack_node(T)* new_node = ((stack_node(T)*)malloc()); 20 (*new_node){ next->value }; /***/ 21 *crnt = new_node; 19 22 stack_node(T) * acrnt = *crnt; 20 23 crnt = &acrnt->next; … … 35 38 36 39 forall(otype T) void push( stack(T) & s, T value ) { 37 s.head = new( value, s.head ); 40 // s.head = new( value, s.head ); 41 stack_node(T)* new_node = ((stack_node(T)*)malloc()); 42 (*new_node){ value, s.head }; /***/ 43 s.head = new_node; 38 44 } 39 45 … … 42 48 s.head = n->next; 43 49 T v = n->value; 44 // ^n{}; 45 free( n ); 50 delete( n ); 46 51 return v; 47 52 } -
src/InitTweak/FixInit.cc
rc9b3a41 r000ff2c 187 187 }; 188 188 189 class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors> {189 class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors>, public WithTypeSubstitution { 190 190 public: 191 191 FixCopyCtors( UnqCount & unqCount ) : unqCount( unqCount ){} … … 448 448 ResolvExpr::findVoidExpression( resolved, indexer ); 449 449 assert( resolved ); 450 if ( resolved-> get_env()) {450 if ( resolved->env ) { 451 451 // Extract useful information and discard new environments. Keeping them causes problems in PolyMutator passes. 452 env->add( *resolved-> get_env());453 delete resolved-> get_env();454 resolved-> set_env( nullptr );452 env->add( *resolved->env ); 453 delete resolved->env; 454 resolved->env = nullptr; 455 455 } // if 456 456 delete stmt; … … 636 636 // take relevant bindings from environment 637 637 assert( ! dtor->env ); 638 dtor->env = TypeSubstitution::newFromExpr( dtor, impCpCtorExpr->env );638 dtor->env = maybeClone( env ); 639 639 stmtsToAddAfter.push_back( new ExprStmt( dtor ) ); 640 640 } // for -
src/ResolvExpr/Resolver.cc
rc9b3a41 r000ff2c 788 788 stmtExpr->accept( resolver ); 789 789 stmtExpr->computeResult(); 790 // xxx - aggregate the environments from all statements? Possibly in AlternativeFinder instead? 790 791 } 791 792 … … 793 794 visit_children = false; 794 795 // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit 795 maybeAccept( ctorInit-> get_ctor(), *visitor );796 maybeAccept( ctorInit-> get_dtor(), *visitor );796 maybeAccept( ctorInit->ctor, *visitor ); 797 maybeAccept( ctorInit->dtor, *visitor ); 797 798 798 799 // found a constructor - can get rid of C-style initializer 799 delete ctorInit-> get_init();800 ctorInit-> set_init( NULL );800 delete ctorInit->init; 801 ctorInit->init = nullptr; 801 802 802 803 // intrinsic single parameter constructors and destructors do nothing. Since this was 803 804 // implicitly generated, there's no way for it to have side effects, so get rid of it 804 805 // to clean up generated code. 805 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit-> get_ctor()) ) {806 delete ctorInit-> get_ctor();807 ctorInit-> set_ctor( NULL );808 } 809 810 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit-> get_dtor()) ) {811 delete ctorInit-> get_dtor();812 ctorInit-> set_dtor( NULL );806 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->ctor ) ) { 807 delete ctorInit->ctor; 808 ctorInit->ctor = nullptr; 809 } 810 811 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->dtor ) ) { 812 delete ctorInit->dtor; 813 ctorInit->dtor = nullptr; 813 814 } 814 815 -
src/ResolvExpr/TypeEnvironment.cc
rc9b3a41 r000ff2c 118 118 env.push_back( newClass ); 119 119 } // for 120 } 121 122 void TypeEnvironment::add( const TypeSubstitution & sub ) { 123 EqvClass newClass; 124 for ( auto p : sub ) { 125 newClass.vars.insert( p.first ); 126 newClass.type = p.second->clone(); 127 newClass.allowWidening = false; 128 // Minimal assumptions. Not technically correct, but might be good enough, and 129 // is the best we can do at the moment since information is lost in the 130 // transition to TypeSubstitution 131 newClass.data = TypeDecl::Data{ TypeDecl::Dtype, false }; 132 add( newClass ); 133 } 120 134 } 121 135 -
src/ResolvExpr/TypeEnvironment.h
rc9b3a41 r000ff2c 76 76 void add( const EqvClass &eqvClass ); 77 77 void add( const Type::ForallList &tyDecls ); 78 void add( const TypeSubstitution & sub ); 78 79 template< typename SynTreeClass > int apply( SynTreeClass *&type ) const; 79 80 template< typename SynTreeClass > int applyFree( SynTreeClass *&type ) const; -
src/SynTree/TypeSubstitution.h
rc9b3a41 r000ff2c 82 82 TypeEnvType typeEnv; 83 83 VarEnvType varEnv; 84 85 public: 86 // has to come after declaration of typeEnv 87 auto begin() -> decltype( typeEnv.begin() ) { return typeEnv.begin(); } 88 auto end() -> decltype( typeEnv. end() ) { return typeEnv. end(); } 89 auto begin() const -> decltype( typeEnv.begin() ) { return typeEnv.begin(); } 90 auto end() const -> decltype( typeEnv. end() ) { return typeEnv. end(); } 84 91 }; 85 92 -
src/Tuples/TupleAssignment.cc
rc9b3a41 r000ff2c 281 281 } 282 282 283 // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator .283 // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator, and adds the bindings to the compositeEnv 284 284 // xxx - maybe this should happen in alternative finder for every StmtExpr? 285 // xxx - it's possible that these environments could contain some useful information. Maybe the right thing to do is aggregate the environments and pass the aggregate back to be added into the compositeEnv286 285 struct EnvRemover { 287 286 void previsit( ExprStmt * stmt ) { 288 delete stmt->expr->env; 289 stmt->expr->env = nullptr; 290 } 287 assert( compositeEnv ); 288 if ( stmt->expr->env ) { 289 compositeEnv->add( *stmt->expr->env ); 290 delete stmt->expr->env; 291 stmt->expr->env = nullptr; 292 } 293 } 294 295 ResolvExpr::TypeEnvironment * compositeEnv = nullptr; 291 296 }; 292 297 … … 300 305 ResolvExpr::resolveCtorInit( ctorInit, spotter.currentFinder.get_indexer() ); // resolve ctor/dtors for the new object 301 306 PassVisitor<EnvRemover> rm; // remove environments from subexpressions of StmtExprs 307 rm.pass.compositeEnv = &compositeEnv; 302 308 ctorInit->accept( rm ); 303 309 }
Note: See TracChangeset
for help on using the changeset viewer.