Changeset 408d460
 Timestamp:
 Feb 5, 2016, 4:41:25 PM (7 years ago)
 Branches:
 aaronthesis, armeh, cleanupdtors, ctor, deferred_resn, demangler, enum, forallpointerdecay, gc_noraii, jacob/cs343translation, jenkinssandbox, master, memory, newast, newastuniqueexpr, newenv, no_list, persistentindexer, pthreademulation, qualifiedEnum, resolvnew, string, with_gc
 Children:
 98735ef
 Parents:
 b10c9959 (diff), 4789f44 (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.  Location:
 src
 Files:

 4 edited
Legend:
 Unmodified
 Added
 Removed

src/GenPoly/Box.cc
rb10c9959 r408d460 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Dec 18 14:53:08 201513 // Update Count : 2 1712 // Last Modified On : Fri Feb 05 12:23:10 2016 13 // Update Count : 280 14 14 // 15 15 … … 139 139 virtual Expression *mutate( OffsetofExpr *offsetofExpr ); 140 140 }; 141 141 142 142 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable 143 143 class Pass3 : public PolyMutator { … … 178 178 seenIntrinsic = false; // break on this line when debugging for end of prelude 179 179 } 180 180 181 181 *i = dynamic_cast< Declaration* >( (*i)>acceptMutator( mutator ) ); 182 182 assert( *i ); … … 286 286 } 287 287 } 288 288 289 289 if ( functionDecl>get_statements() ) { // empty routine body ? 290 290 doBeginScope(); … … 320 320 findFunction( (*arg)>get_type(), functions, scopeTyVars, needsAdapter ); 321 321 } // for 322 322 323 323 AdapterMap & adapters = Pass1::adapters.top(); 324 324 for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) { … … 373 373 Expression *Pass1::makeOffsetArray( StructInstType *ty ) { 374 374 std::list< Declaration* > &baseMembers = ty>get_baseStruct()>get_members(); 375 375 376 376 // make a new temporary array 377 377 Type *offsetType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ); … … 397 397 return new VariableExpr( arrayTemp ); 398 398 } 399 399 400 400 void Pass1::passTypeVars( ApplicationExpr *appExpr, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) { 401 401 // pass size/align for type variables … … 493 493 } 494 494 } 495 495 496 496 Type *Pass1::replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone ) { 497 497 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) { … … 531 531 std::string adapterName = makeAdapterName( mangleName ); 532 532 533 appExpr>get_args().push_front( appExpr>get_function() ); 533 // cast adaptee to void (*)(), since it may have any type inside a polymorphic function 534 Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ); 535 appExpr>get_args().push_front( new CastExpr( appExpr>get_function(), adapteeType ) ); 534 536 appExpr>set_function( new NameExpr( adapterName ) ); 535 537 … … 559 561 } 560 562 563 /// cast parameters to polymorphic functions so that types are replaced with 564 /// void * if they are type parameters in the formal type. 565 /// this gets rid of warnings from gcc. 561 566 void addCast( Expression *&actual, Type *formal, const TyVarMap &tyVars ) { 562 Type *newType = formal>clone(); 563 std::list< FunctionType *> functions; 564 // instead of functions needing adapters, this really ought to look for 565 // any function mentioning a polymorphic type 566 findAndReplaceFunction( newType, functions, tyVars, needsAdapter ); 567 if ( ! functions.empty() ) { 567 Type * newType = formal>clone(); 568 if ( getFunctionType( newType ) ) { 569 newType = ScrubTyVars::scrub( newType, tyVars ); 568 570 actual = new CastExpr( actual, newType ); 569 } else {570 delete newType;571 571 } // if 572 572 } 
src/GenPoly/FindFunction.cc
rb10c9959 r408d460 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FindFunction.cc  7 // FindFunction.cc  8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue May 19 07:35:48 201513 // Update Count : 111 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Feb 05 12:22:20 2016 13 // Update Count : 6 14 14 // 15 15 … … 19 19 #include "SynTree/Visitor.h" 20 20 21 #include "ScrubTyVars.h" 22 21 23 namespace GenPoly { 22 24 class FindFunction : public Mutator { 23 25 public: 24 26 FindFunction( std::list< FunctionType* > &functions, const TyVarMap &tyVars, bool replaceMode, FindFunctionPredicate predicate ); 25 27 26 28 virtual Type *mutate( FunctionType *functionType ); 27 29 virtual Type *mutate( PointerType *pointerType ); … … 66 68 functions.push_back( functionType ); 67 69 if ( replaceMode ) { 68 ret = new FunctionType( Type::Qualifiers(), true ); 70 // replace type parameters in function type with void* 71 ret = ScrubTyVars::scrub( functionType>clone(), tyVars ); 69 72 } // if 70 73 } // if 
src/libcfa/algorithm
rb10c9959 r408d460 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // alorgithm  7 // alorgithm  8 8 // 9 9 // Author : Peter A. Buhr … … 16 16 // 17 17 18 forall( type T  { int ?<?( T,T ); } )18 forall( type T  { int ?<?( const T, const T ); } ) 19 19 T min( const T t1, const T t2 ); 20 20 21 forall( type T  { int ?>?( T,T ); } )21 forall( type T  { int ?>?( const T, const T ); } ) 22 22 T max( const T t1, const T t2 ); 23 23 
src/libcfa/algorithm.c
rb10c9959 r408d460 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // algorithm.c  7 // algorithm.c  8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Feb 1 13:42:05201613 // Update Count : 5 211 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Feb 04 17:19:12 2016 13 // Update Count : 54 14 14 // 15 15 16 16 #include "algorithm" 17 17 18 forall( type T  { int ?<?( T,T ); } )18 forall( type T  { int ?<?( const T, const T ); } ) 19 19 T min( const T t1, const T t2 ) { 20 20 return t1 < t2 ? t1 : t2; 21 21 } // min 22 22 23 forall( type T  { int ?>?( T,T ); } )23 forall( type T  { int ?>?( const T, const T ); } ) 24 24 T max( const T t1, const T t2 ) { 25 25 return t1 > t2 ? t1 : t2;
Note: See TracChangeset
for help on using the changeset viewer.