Changeset a12d5aa
- Timestamp:
- Jun 29, 2017, 5:13:42 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 435e75f
- Parents:
- 62423350 (diff), 1abc5ab (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:
-
- 21 added
- 36 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r62423350 ra12d5aa 31 31 32 32 src/prelude/builtins.cf 33 src/prelude/builtins.c 33 src/prelude/gcc-builtins.cf 34 src/prelude/gcc-builtins.c 34 35 src/prelude/extras.cf 35 36 src/prelude/bootloader.c 36 37 src/libcfa/libcfa-prelude.c 37 38 38 # generated by bison and lex from cfa.yy and lex.ll, respectively39 # generated by bison and lex from parser.yy and lex.ll 39 40 src/Parser/parser.output 40 41 src/Parser/lex.cc … … 42 43 src/Parser/parser.h 43 44 45 tools/prettyprinter/parser.output 46 tools/prettyprinter/lex.cc 47 tools/prettyprinter/parser.cc 48 tools/prettyprinter/parser.h 49 tools/prettyprinter/pretty 50 tools/pretty 51 44 52 # generated by xfig for user manual 45 53 doc/user/Cdecl.tex -
configure
r62423350 ra12d5aa 6251 6251 6252 6252 6253 ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile "6253 ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile tools/prettyprinter/Makefile" 6254 6254 6255 6255 … … 7022 7022 "src/prelude/Makefile") CONFIG_FILES="$CONFIG_FILES src/prelude/Makefile" ;; 7023 7023 "src/libcfa/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcfa/Makefile" ;; 7024 "tools/prettyprinter/Makefile") CONFIG_FILES="$CONFIG_FILES tools/prettyprinter/Makefile" ;; 7024 7025 7025 7026 *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; -
configure.ac
r62423350 ra12d5aa 238 238 src/prelude/Makefile 239 239 src/libcfa/Makefile 240 tools/prettyprinter/Makefile 240 241 ]) 241 242 -
doc/proposals/tagged-struct.txt
r62423350 ra12d5aa 14 14 say which of the possible values is currently stored in the union. The idea 15 15 here is similar, however the possibilities are more open ended. 16 17 Alternate names include virtual structure and abstract structure. 16 18 17 19 … … 36 38 their parent's fields to their field list so they can be upcast. 37 39 40 The type field may be public, if it is then it can be accessed through a 41 simple field access "instance.type". The type field would then be able to be 42 used to access the type object, which contains the information for the type. 43 It may just be a pointer to the type object "*instance.type", although a 44 lookup function could also be used. 45 46 47 Usage: 48 49 The central feature for tagged structs is a checked cast between pointer types 50 to the structures. A cast is successful if the true type of the pointed object 51 is of the type being cast to or any of its children, otherwise the cast 52 returns null. 53 54 The type field should also allow for equality comparison of types. 55 56 Currently, with only these operations (and similar features) the type field 57 could be hidden and the operations given through helper functions. However 58 if the type object has more complex (or even open ended) information in it 59 than providing direct access becomes very valuable. 60 38 61 39 62 Implemenation: 40 63 41 Adding to the field list is a simple matter, should be doable during 42 translation. The type field is just a pointer to a type object. With proper 43 linking we can create a single unique instance of the type object for each 44 declared tagged struct. The instance's address is used as an id for the type. 45 It also holds data about the type, such as its parent's id/a pointer to the 46 parent type object. 64 Adding to the field list would have to be handled during translation. The 65 simple act of adding declarations should not be difficult, althought it might 66 take a bit of work to find the parent's declarations. 47 67 48 The type field could be hidden (as best as C can hide it) or it could be 49 visible to the user with easy access to allow the user to examine the type 50 object directly. 51 52 Direct access is more useful if the data on the type-objects can change, other 53 wise the build in function could handle all cases. Perhaps each root object 54 can specify a type object to use or the type objects are themselves tagged, 55 although there may not be a base case with the latter. 56 57 In the simplest case the type object is a pointer to the parent type object. 58 Additional data could be added, such as a name, or a function pointer to the 59 destructor. 68 Type objects are also simple in to generate, they should just be global 69 (program lifetime) structures. Getting there to be exactly one instance of 70 each allows the pointer to the structure to be used as the type id, and that 71 should be possible to do during linking. 60 72 61 73 … … 94 106 If unions are declared tagged instead of creating a new tagged type, all 95 107 possible values of the union must be of that tagged type or a child type. 108 109 110 Custom Type Objects (Extention): 111 112 Some method to define type objects used within a tree of types. One option is 113 to allow the tree's type object to be specified by the tree root. It would 114 then have to be filled in for each type in the tree, including the root. 115 116 The only required field is the parent field, a pointer to the type object's 117 type. (This is also the only required field on the tagged structure itself.) 118 119 A further extention could allow expanding type objects, so child types could 120 append fields to their parent's feild list. They might need their own type 121 objects at that point, or maybe static checks will be enough to see the 122 minimum field list. -
src/CodeGen/FixNames.cc
r62423350 ra12d5aa 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 : Wed Jun 2 1 14:22:59201713 // Update Count : 1911 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:26:00 2017 13 // Update Count : 20 14 14 // 15 15 … … 93 93 void FixNames::fixDWT( DeclarationWithType *dwt ) { 94 94 if ( dwt->get_name() != "" ) { 95 if ( LinkageSpec::is Decoratable( dwt->get_linkage() ) ) {95 if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) { 96 96 dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) ); 97 97 dwt->set_scopeLevel( scopeLevel ); -
src/ControlStruct/ExceptTranslate.cc
r62423350 ra12d5aa 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 2 2 15:57:00 201713 // Update Count : 012 // Last Modified On : Thr Jun 29 15:18:00 2017 13 // Update Count : 1 14 14 // 15 15 16 16 #include "ExceptTranslate.h" 17 17 #include "Common/PassVisitor.h" 18 #include "SynTree/Statement.h" 19 #include "SynTree/Declaration.h" 20 #include "SynTree/Expression.h" 21 #include "SynTree/Type.h" 22 #include "SynTree/Attribute.h" 18 23 19 24 namespace ControlFlow { … … 34 39 35 40 static void init_func_types() { 36 static init_complete = false;41 static bool init_complete = false; 37 42 if (init_complete) { 38 43 return; 39 44 } 40 45 ObjectDecl index_obj( 41 " index_t",46 "__handler_index", 42 47 Type::StorageClasses(), 43 48 LinkageSpec::Cforall, … … 47 52 ); 48 53 ObjectDecl exception_obj( 49 " exception_t",54 "__exception_inst", 50 55 Type::StorageClasses(), 51 56 LinkageSpec::Cforall, … … 55 60 ); 56 61 ObjectDecl bool_obj( 57 " bool_t",62 "__ret_bool", 58 63 Type::StorageClasses(), 59 64 LinkageSpec::Cforall, … … 78 83 79 84 void split( CatchList& allHandlers, CatchList& terHandlers, 80 85 CatchList& resHandlers ) { 81 86 while ( !allHandlers.empty() ) { 82 Statement * stmt = allHandlers.front();87 CatchStmt * stmt = allHandlers.front(); 83 88 allHandlers.pop_front(); 84 if (Ca seStmt::Terminate == stmt->get_kind()) {89 if (CatchStmt::Terminate == stmt->get_kind()) { 85 90 terHandlers.push_back(stmt); 86 91 } else { … … 92 97 template<typename T> 93 98 void free_all( std::list<T *> &list ) { 94 std::list<T *>::iterator it;99 typename std::list<T *>::iterator it; 95 100 for ( it = list.begin() ; it != list.end() ; ++it ) { 96 101 delete *it; … … 100 105 101 106 void appendDeclStmt( CompoundStmt * block, Declaration * item ) { 102 block->push_back(new DeclStmt(no _labels, item));103 } 104 105 Expression * nameOf( FunctionDecl * function) {106 return new VariableExpr( function);107 block->push_back(new DeclStmt(noLabels, item)); 108 } 109 110 Expression * nameOf( DeclarationWithType * decl ) { 111 return new VariableExpr( decl ); 107 112 } 108 113 … … 111 116 Statement * create_terminate_throw( ThrowStmt *throwStmt ) { 112 117 // __throw_terminate( EXPR ); 113 ApplicationExpr * call = new ApplicationExpr( /* ... */ ); 114 call->get_args.push_back( throwStmt->get_expr() ); 118 UntypedExpr * call = new UntypedExpr( new NameExpr( 119 "__cfaehm__throw_termination" ) ); 120 call->get_args().push_back( throwStmt->get_expr() ); 115 121 Statement * result = new ExprStmt( throwStmt->get_labels(), call ); 116 122 throwStmt->set_expr( nullptr ); … … 120 126 Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) { 121 127 // __rethrow_terminate(); 128 assert( nullptr == throwStmt->get_expr() ); 122 129 Statement * result = new ExprStmt( 123 130 throwStmt->get_labels(), 124 new ApplicationExpr( /* ... */ );131 new UntypedExpr( new NameExpr( "__cfaehm__rethrow_termination" ) ) 125 132 ); 126 133 delete throwStmt; … … 129 136 Statement * create_resume_throw( ThrowStmt *throwStmt ) { 130 137 // __throw_resume( EXPR ); 131 ApplicationExpr * call = new ApplicationExpr( /* ... */ ); 132 call->get_args.push_back( throwStmt->get_expr() ); 138 UntypedExpr * call = new UntypedExpr( new NameExpr( 139 "__cfaehm__throw_resumption" ) ); 140 call->get_args().push_back( throwStmt->get_expr() ); 133 141 Statement * result = new ExprStmt( throwStmt->get_labels(), call ); 134 142 throwStmt->set_expr( nullptr ); … … 140 148 Statement * result = new ReturnStmt( 141 149 throwStmt->get_labels(), 142 new ConstantExpr( 143 Constant( 144 new BasicType( 145 Type::Qualifiers(), 146 BasicType::Bool 147 ), 148 "0") 149 ) 150 new ConstantExpr( Constant::from_bool( false ) ) 150 151 ); 151 152 delete throwStmt; … … 160 161 return block; 161 162 } 162 FunctionDecl * create_try_wrapper( TryStmt *tryStmt ) { 163 CompoundStmt * body = base_try->get_block(); 164 base_try->set_block(nullptr); 165 166 return new FunctionDecl("try", Type::StorageClasses(), 167 LinkageSpec::Cforall, void_func_t, body); 163 FunctionDecl * create_try_wrapper( CompoundStmt *body ) { 164 165 return new FunctionDecl( "try", Type::StorageClasses(), 166 LinkageSpec::Cforall, void_func_t.clone(), body ); 168 167 } 169 168 170 169 FunctionDecl * create_terminate_catch( CatchList &handlers ) { 171 170 std::list<CaseStmt *> handler_wrappers; 171 172 FunctionType *func_type = catch_func_t.clone(); 173 DeclarationWithType * index_obj = func_type->get_parameters().front(); 174 // DeclarationWithType * except_obj = func_type->get_parameters().back(); 172 175 173 176 // Index 1..{number of handlers} … … 178 181 CatchStmt * handler = *it; 179 182 180 std::list<Statement *> core; 181 if ( /*the exception is named*/ ) { 182 ObjectDecl * local_except = /* Dynamic case, same */; 183 core->push_back( new DeclStmt( noLabel, local_except ) ); 184 } 185 // Append the provided statement to the handler. 186 core->push_back( cur_handler->get_body() ); 187 // Append return onto the inner block? case stmt list? 188 CaseStmt * wrapper = new CaseStmt( 183 // INTEGERconstant Version 184 // case `index`: 185 // { 186 // `handler.body` 187 // } 188 // return; 189 std::list<Statement *> caseBody; 190 caseBody.push_back( handler->get_body() ); 191 handler->set_body( nullptr ); 192 caseBody.push_back( new ReturnStmt( noLabels, nullptr ) ); 193 194 handler_wrappers.push_back( new CaseStmt( 189 195 noLabels, 190 196 new ConstantExpr( Constant::from_int( index ) ), 191 core 192 ); 193 handler_wrappers.push_back(wrapper); 197 caseBody 198 ) ); 194 199 } 195 200 // TODO: Some sort of meaningful error on default perhaps? 201 202 std::list<Statement*> stmt_handlers; 203 while ( !handler_wrappers.empty() ) { 204 stmt_handlers.push_back( handler_wrappers.front() ); 205 handler_wrappers.pop_front(); 206 } 196 207 197 208 SwitchStmt * handler_lookup = new SwitchStmt( 198 209 noLabels, 199 /*parameter 0: index*/, 200 handler_wrappers, 201 false 210 nameOf( index_obj ), 211 stmt_handlers 202 212 ); 203 213 CompoundStmt * body = new CompoundStmt( noLabels ); … … 205 215 206 216 return new FunctionDecl("catch", Type::StorageClasses(), 207 LinkageSpec::Cforall, catch_func_t, body);217 LinkageSpec::Cforall, func_type, body); 208 218 } 209 219 210 220 // Create a single check from a moddified handler. 211 CompoundStmt *create_single_matcher( CatchStmt * modded_handler ) { 212 CompoundStmt * block = new CompoundStmt( noLables ); 213 214 appendDeclStmt( block, modded_handler->get_decl() ); 215 216 // TODO: This is not the actual check. 217 LogicalExpr * cond = new ConstantExpr( Constant::from_bool( false ) ); 221 // except_obj is referenced, modded_handler will be freed. 222 CompoundStmt *create_single_matcher( 223 DeclarationWithType * except_obj, CatchStmt * modded_handler ) { 224 CompoundStmt * block = new CompoundStmt( noLabels ); 225 226 // INTEGERconstant Version 227 assert( nullptr == modded_handler->get_decl() ); 228 ConstantExpr * number = 229 dynamic_cast<ConstantExpr*>( modded_handler->get_cond() ); 230 assert( number ); 231 modded_handler->set_cond( nullptr ); 232 233 Expression * cond; 234 { 235 std::list<Expression *> args; 236 args.push_back( number ); 237 args.push_back( nameOf( except_obj ) ); 238 cond = new UntypedExpr( new NameExpr( "?==?" /*???*/), args ); 239 } 218 240 219 241 if ( modded_handler->get_cond() ) { 220 cond = new LogicalExpr( cond, modded_handler->get_cond() ) q242 cond = new LogicalExpr( cond, modded_handler->get_cond() ); 221 243 } 222 244 block->push_back( new IfStmt( noLabels, 223 cond, modded_handler->get_body() );245 cond, modded_handler->get_body(), nullptr ) ); 224 246 225 247 modded_handler->set_decl( nullptr ); … … 232 254 FunctionDecl * create_terminate_match( CatchList &handlers ) { 233 255 CompoundStmt * body = new CompoundStmt( noLabels ); 256 257 FunctionType * func_type = match_func_t.clone(); 258 DeclarationWithType * except_obj = func_type->get_parameters().back(); 234 259 235 260 // Index 1..{number of handlers} … … 240 265 CatchStmt * handler = *it; 241 266 242 // body should have been taken by create_terminate_catch. 243 // assert( nullptr == handler->get_body() ); 267 // Body should have been taken by create_terminate_catch. 268 assert( nullptr == handler->get_body() ); 269 270 // Create new body. 244 271 handler->set_body( new ReturnStmt( noLabels, 245 272 new ConstantExpr( Constant::from_int( index ) ) ) ); 246 273 247 body->push_back( create_single_matcher( handler ) ); 274 // Create the handler. 275 body->push_back( create_single_matcher( except_obj, handler ) ); 276 *it = nullptr; 248 277 } 249 278 250 279 return new FunctionDecl("match", Type::StorageClasses(), 251 LinkageSpec::Cforall, match_func_t, body);252 } 253 254 Statement * create_terminate_caller(280 LinkageSpec::Cforall, func_type, body); 281 } 282 283 CompoundStmt * create_terminate_caller( 255 284 FunctionDecl * try_wrapper, 256 285 FunctionDecl * terminate_catch, 257 286 FunctionDecl * terminate_match) { 258 287 259 ApplicationExpr * caller = new ApplicationExpr( /* ... */ ); 260 std::list<Expression *>& args = caller.get_args(); 288 UntypedExpr * caller = new UntypedExpr( new NameExpr( 289 "__cfaehm__try_terminate" ) ); 290 std::list<Expression *>& args = caller->get_args(); 261 291 args.push_back( nameOf( try_wrapper ) ); 262 292 args.push_back( nameOf( terminate_catch ) ); 263 293 args.push_back( nameOf( terminate_match ) ); 264 294 265 return new ExprStmt( noLabels, caller ); 295 CompoundStmt * callStmt = new CompoundStmt( noLabels ); 296 callStmt->push_back( new ExprStmt( noLabels, caller ) ); 297 return callStmt; 266 298 } 267 299 268 300 FunctionDecl * create_resume_handler( CatchList &handlers ) { 269 CompoundStmt * body = new CompountStmt( noLabels ); 301 CompoundStmt * body = new CompoundStmt( noLabels ); 302 303 FunctionType * func_type = match_func_t.clone(); 304 DeclarationWithType * except_obj = func_type->get_parameters().back(); 270 305 271 306 CatchList::iterator it; … … 280 315 handling_code->push_back( handler->get_body() ); 281 316 } 282 handling_code->push_back( new ReturnStmt( noLabel ,317 handling_code->push_back( new ReturnStmt( noLabels, 283 318 new ConstantExpr( Constant::from_bool( false ) ) ) ); 284 319 handler->set_body( handling_code ); 285 320 286 321 // Create the handler. 287 body->push_back( create_single_matcher( handler ) ); 322 body->push_back( create_single_matcher( except_obj, handler ) ); 323 *it = nullptr; 288 324 } 289 325 290 326 return new FunctionDecl("handle", Type::StorageClasses(), 291 LinkageSpec::Cforall, handle_func_t, body); 292 } 293 294 Statement * create_resume_wrapper( 327 LinkageSpec::Cforall, func_type, body); 328 } 329 330 CompoundStmt * create_resume_wrapper( 331 StructDecl * node_decl, 295 332 Statement * wraps, 296 333 FunctionDecl * resume_handler ) { 297 334 CompoundStmt * body = new CompoundStmt( noLabels ); 298 335 299 // struct node = {current top resume handler, call to resume_handler}; 300 // __attribute__((cleanup( ... ))); 301 // set top resume handler to node. 302 // The wrapped statement. 303 304 ListInit * node_init; 305 { 306 std::list<Initializer*> field_inits; 307 field_inits.push_back( new SingleInit( /* ... */ ) ); 308 field_inits.push_back( new SingleInit( nameOf( resume_handler ) ) ); 309 node_init = new ListInit( field_inits ); 310 } 336 // struct __try_resume_node __resume_node 337 // __attribute__((cleanup( __cfaehm__try_resume_cleanup ))); 338 // ** unwinding of the stack here could cause problems ** 339 // ** however I don't think that can happen currently ** 340 // __cfaehm__try_resume_setup( &__resume_node, resume_handler ); 311 341 312 342 std::list< Attribute * > attributes; 313 343 { 314 344 std::list< Expression * > attr_params; 315 attr_params.push_back( n ameOf( /* ... deconstructor ... */ ) );316 attrributes.push_back( new Attribute( "cleanup", attr_params) );317 }318 319 appendDeclStmt( body, 320 /**/ObjectDecl(321 " resume_node",345 attr_params.push_back( new NameExpr( 346 "__cfaehm__try_resume_cleanup" ) ); 347 attributes.push_back( new Attribute( "cleanup", attr_params ) ); 348 } 349 350 ObjectDecl * obj = new ObjectDecl( 351 "__resume_node", 322 352 Type::StorageClasses(), 323 353 LinkageSpec::Cforall, 324 354 nullptr, 325 /* Type* = resume_node */, 326 node_init, 355 new StructInstType( 356 Type::Qualifiers(), 357 node_decl 358 ), 359 nullptr, 327 360 attributes 328 ) 329 ); 361 ); 362 appendDeclStmt( body, obj ); 363 364 UntypedExpr *setup = new UntypedExpr( new NameExpr( 365 "__cfaehm__try_resume_setup" ) ); 366 setup->get_args().push_back( nameOf( obj ) ); 367 setup->get_args().push_back( nameOf( resume_handler ) ); 368 369 body->push_back( new ExprStmt( noLabels, setup ) ); 370 330 371 body->push_back( wraps ); 331 372 return body; … … 333 374 334 375 FunctionDecl * create_finally_wrapper( TryStmt * tryStmt ) { 335 CompoundStmt * body = tryStmt->get_finally(); 376 FinallyStmt * finally = tryStmt->get_finally(); 377 CompoundStmt * body = finally->get_block(); 378 finally->set_block( nullptr ); 379 delete finally; 336 380 tryStmt->set_finally( nullptr ); 337 381 338 382 return new FunctionDecl("finally", Type::StorageClasses(), 339 LinkageSpec::Cforall, void_func_t, body); 340 } 341 342 ObjectDecl * create_finally_hook( FunctionDecl * finally_wrapper ) { 343 // struct _cleanup_hook NAME __attribute__((cleanup( ... ))); 383 LinkageSpec::Cforall, void_func_t.clone(), body); 384 } 385 386 ObjectDecl * create_finally_hook( 387 StructDecl * hook_decl, FunctionDecl * finally_wrapper ) { 388 // struct __cfaehm__cleanup_hook __finally_hook 389 // __attribute__((cleanup( finally_wrapper ))); 344 390 345 391 // Make Cleanup Attribute. … … 348 394 std::list< Expression * > attr_params; 349 395 attr_params.push_back( nameOf( finally_wrapper ) ); 350 attr ributes.push_back( new Attribute( "cleanup", attr_params ) );351 } 352 353 return ObjectDecl( /* ... */354 const std::string &name "finally_hook",396 attributes.push_back( new Attribute( "cleanup", attr_params ) ); 397 } 398 399 return new ObjectDecl( 400 "__finally_hook", 355 401 Type::StorageClasses(), 356 402 LinkageSpec::Cforall, 357 403 nullptr, 358 /* ... Type * ... */, 404 new StructInstType( 405 emptyQualifiers, 406 hook_decl 407 ), 359 408 nullptr, 360 409 attributes … … 363 412 364 413 365 class ExceptionMutatorCore : public With Scoping{414 class ExceptionMutatorCore : public WithGuards { 366 415 enum Context { NoHandler, TerHandler, ResHandler }; 367 416 … … 370 419 // loop, switch or the goto stays within the function. 371 420 372 Context cur Context;421 Context cur_context; 373 422 374 423 // We might not need this, but a unique base for each try block's … … 377 426 //unsigned int try_count = 0; 378 427 428 StructDecl *node_decl; 429 StructDecl *hook_decl; 379 430 380 431 public: 381 432 ExceptionMutatorCore() : 382 curContext(NoHandler) 433 cur_context(NoHandler), 434 node_decl(nullptr), hook_decl(nullptr) 383 435 {} 384 436 385 void premutate( CatchStmt *tryStmt ); 437 void premutate( CatchStmt *catchStmt ); 438 void premutate( StructDecl *structDecl ); 386 439 Statement * postmutate( ThrowStmt *throwStmt ); 387 440 Statement * postmutate( TryStmt *tryStmt ); … … 393 446 if ( throwStmt->get_expr() ) { 394 447 return create_terminate_throw( throwStmt ); 395 } else if ( TerHandler == cur Context ) {448 } else if ( TerHandler == cur_context ) { 396 449 return create_terminate_rethrow( throwStmt ); 397 450 } else { 398 451 assertf(false, "Invalid throw in %s at %i\n", 399 throwStmt->location.filename ,452 throwStmt->location.filename.c_str(), 400 453 throwStmt->location.linenumber); 401 454 return nullptr; … … 404 457 if ( throwStmt->get_expr() ) { 405 458 return create_resume_throw( throwStmt ); 406 } else if ( ResHandler == cur Context ) {459 } else if ( ResHandler == cur_context ) { 407 460 return create_resume_rethrow( throwStmt ); 408 461 } else { 409 462 assertf(false, "Invalid throwResume in %s at %i\n", 410 throwStmt->location.filename ,463 throwStmt->location.filename.c_str(), 411 464 throwStmt->location.linenumber); 412 465 return nullptr; … … 416 469 417 470 Statement * ExceptionMutatorCore::postmutate( TryStmt *tryStmt ) { 471 assert( node_decl ); 472 assert( hook_decl ); 473 418 474 // Generate a prefix for the function names? 419 475 420 CompoundStmt * block = new CompoundStmt( );421 Statement * inner = take_try_block( tryStmt );476 CompoundStmt * block = new CompoundStmt( noLabels ); 477 CompoundStmt * inner = take_try_block( tryStmt ); 422 478 423 479 if ( tryStmt->get_finally() ) { … … 427 483 appendDeclStmt( block, finally_block ); 428 484 // Create and add the finally cleanup hook. 429 appendDeclStmt( block, create_finally_hook( finally_block ) ); 430 } 431 432 StatementList termination_handlers; 433 StatementList resumption_handlers; 434 split( tryStmt->get_handlers(), 435 termination_handlers, resumption_handlers ); 436 437 if ( resumeption_handlers.size() ) { 485 appendDeclStmt( block, 486 create_finally_hook( hook_decl, finally_block ) ); 487 } 488 489 CatchList termination_handlers; 490 CatchList resumption_handlers; 491 split( tryStmt->get_catchers(), 492 termination_handlers, resumption_handlers ); 493 494 if ( resumption_handlers.size() ) { 438 495 // Define the helper function. 439 496 FunctionDecl * resume_handler = … … 441 498 appendDeclStmt( block, resume_handler ); 442 499 // Prepare hooks 443 inner = create_resume_wrapper( inner, resume_handler );500 inner = create_resume_wrapper( node_decl, inner, resume_handler ); 444 501 } 445 502 … … 462 519 block->push_back( inner ); 463 520 464 free_all( termination_handlers );465 free_all( resumption_handlers );521 //free_all( termination_handlers ); 522 //free_all( resumption_handlers ); 466 523 467 524 return block; … … 469 526 470 527 void ExceptionMutatorCore::premutate( CatchStmt *catchStmt ) { 471 GuardValue( cur Context );472 if ( CatchStmt::Terminat ion== catchStmt->get_kind() ) {473 cur Context = TerHandler;528 GuardValue( cur_context ); 529 if ( CatchStmt::Terminate == catchStmt->get_kind() ) { 530 cur_context = TerHandler; 474 531 } else { 475 curContext = ResHandler; 476 } 477 } 478 479 void translateEHM( std::list< Declaration *> & translationUnit ) { 532 cur_context = ResHandler; 533 } 534 } 535 536 void ExceptionMutatorCore::premutate( StructDecl *structDecl ) { 537 if ( !structDecl->has_body() ) { 538 // Skip children? 539 return; 540 } else if ( structDecl->get_name() == "__cfaehm__try_resume_node" ) { 541 assert( nullptr == node_decl ); 542 node_decl = structDecl; 543 } else if ( structDecl->get_name() == "__cfaehm__cleanup_hook" ) { 544 assert( nullptr == hook_decl ); 545 hook_decl = structDecl; 546 } 547 // Later we might get the exception type as well. 548 } 549 550 void translateEHM( std::list< Declaration *> & translationUnit ) { 551 init_func_types(); 552 480 553 PassVisitor<ExceptionMutatorCore> translator; 481 554 for ( Declaration * decl : translationUnit ) { 482 decl-> mutate( translator );555 decl->acceptMutator( translator ); 483 556 } 484 557 } -
src/ControlStruct/ExceptTranslate.h
r62423350 ra12d5aa 10 10 // Created On : Tus Jun 06 10:13:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 2 2 15:57:00 201713 // Update Count : 012 // Last Modified On : Thr Jun 29 15:18:00 2017 13 // Update Count : 1 14 14 // 15 15 16 16 #ifndef EXCEPT_TRANSLATE_H 17 17 #define EXCEPT_TRANSLATE_H 18 19 #include <list> 20 #include "SynTree/SynTree.h" 18 21 19 22 namespace ControlFlow { -
src/ControlStruct/module.mk
r62423350 ra12d5aa 10 10 ## Author : Richard C. Bilson 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 ## Last Modified By : Peter A. Buhr13 ## Last Modified On : Thu Aug 4 11:38:06 201614 ## Update Count : 312 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jun 28 16:15:00 2017 14 ## Update Count : 4 15 15 ############################################################################### 16 16 17 17 SRC += ControlStruct/LabelGenerator.cc \ 18 18 ControlStruct/LabelFixer.cc \ 19 19 ControlStruct/MLEMutator.cc \ 20 20 ControlStruct/Mutate.cc \ 21 ControlStruct/ForExprMutator.cc 22 21 ControlStruct/ForExprMutator.cc \ 22 ControlStruct/ExceptTranslate.cc -
src/Makefile.in
r62423350 ra12d5aa 119 119 ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \ 120 120 ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \ 121 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \ 121 122 GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \ 122 123 GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \ … … 143 144 Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \ 144 145 Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \ 145 Parser/driver_cfa_cpp-parse utility.$(OBJEXT) \146 Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \ 146 147 ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \ 147 148 ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \ … … 395 396 ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \ 396 397 ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \ 397 ControlStruct/ForExprMutator.cc GenPoly/Box.cc \ 398 ControlStruct/ForExprMutator.cc \ 399 ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \ 398 400 GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \ 399 401 GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \ … … 406 408 Parser/ExpressionNode.cc Parser/StatementNode.cc \ 407 409 Parser/InitializerNode.cc Parser/TypeData.cc \ 408 Parser/LinkageSpec.cc Parser/parse utility.cc \410 Parser/LinkageSpec.cc Parser/parserutility.cc \ 409 411 ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \ 410 412 ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \ … … 595 597 ControlStruct/$(am__dirstamp) \ 596 598 ControlStruct/$(DEPDIR)/$(am__dirstamp) 599 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT): \ 600 ControlStruct/$(am__dirstamp) \ 601 ControlStruct/$(DEPDIR)/$(am__dirstamp) 597 602 GenPoly/$(am__dirstamp): 598 603 @$(MKDIR_P) GenPoly … … 664 669 Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \ 665 670 Parser/$(DEPDIR)/$(am__dirstamp) 666 Parser/driver_cfa_cpp-parse utility.$(OBJEXT): Parser/$(am__dirstamp) \671 Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \ 667 672 Parser/$(DEPDIR)/$(am__dirstamp) 668 673 ResolvExpr/$(am__dirstamp): … … 857 862 -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT) 858 863 -rm -f Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT) 864 -rm -f ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) 859 865 -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) 860 866 -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) … … 886 892 -rm -f Parser/driver_cfa_cpp-lex.$(OBJEXT) 887 893 -rm -f Parser/driver_cfa_cpp-parser.$(OBJEXT) 888 -rm -f Parser/driver_cfa_cpp-parse utility.$(OBJEXT)894 -rm -f Parser/driver_cfa_cpp-parserutility.$(OBJEXT) 889 895 -rm -f ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT) 890 896 -rm -f ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) … … 970 976 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@ 971 977 @AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@ 978 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@ 972 979 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@ 973 980 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@ … … 999 1006 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@ 1000 1007 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po@am__quote@ 1001 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parse utility.Po@am__quote@1008 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@ 1002 1009 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@ 1003 1010 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@ … … 1361 1368 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi` 1362 1369 1370 ControlStruct/driver_cfa_cpp-ExceptTranslate.o: ControlStruct/ExceptTranslate.cc 1371 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc 1372 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po 1373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.o' libtool=no @AMDEPBACKSLASH@ 1374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1375 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc 1376 1377 ControlStruct/driver_cfa_cpp-ExceptTranslate.obj: ControlStruct/ExceptTranslate.cc 1378 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi` 1379 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po 1380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.obj' libtool=no @AMDEPBACKSLASH@ 1381 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1382 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi` 1383 1363 1384 GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc 1364 1385 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc … … 1697 1718 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-LinkageSpec.obj `if test -f 'Parser/LinkageSpec.cc'; then $(CYGPATH_W) 'Parser/LinkageSpec.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/LinkageSpec.cc'; fi` 1698 1719 1699 Parser/driver_cfa_cpp-parse utility.o: Parser/parseutility.cc1700 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parse utility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc1701 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parse utility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po1702 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parse utility.cc' object='Parser/driver_cfa_cpp-parseutility.o' libtool=no @AMDEPBACKSLASH@1703 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1704 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parse utility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc1705 1706 Parser/driver_cfa_cpp-parse utility.obj: Parser/parseutility.cc1707 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parse utility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`1708 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parse utility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po1709 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parse utility.cc' object='Parser/driver_cfa_cpp-parseutility.obj' libtool=no @AMDEPBACKSLASH@1710 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1711 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parse utility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`1720 Parser/driver_cfa_cpp-parserutility.o: Parser/parserutility.cc 1721 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc 1722 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po 1723 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.o' libtool=no @AMDEPBACKSLASH@ 1724 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1725 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc 1726 1727 Parser/driver_cfa_cpp-parserutility.obj: Parser/parserutility.cc 1728 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi` 1729 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po 1730 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.obj' libtool=no @AMDEPBACKSLASH@ 1731 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1732 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi` 1712 1733 1713 1734 ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc -
src/Parser/DeclarationNode.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 12:34:05 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:46:33201713 // Update Count : 101 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 2017 13 // Update Count : 1019 14 14 // 15 15 … … 1063 1063 case TypeData::Enum: 1064 1064 case TypeData::Aggregate: { 1065 ReferenceToType * ret = buildComAggInst( type, attributes );1065 ReferenceToType * ret = buildComAggInst( type, attributes, linkage ); 1066 1066 buildList( type->aggregate.actuals, ret->get_parameters() ); 1067 1067 return ret; -
src/Parser/ExpressionNode.cc
r62423350 ra12d5aa 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 2 1 16:44:46201713 // Update Count : 54 112 // Last Modified On : Wed Jun 28 21:08:15 2017 13 // Update Count : 542 14 14 // 15 15 … … 27 27 #include "SynTree/Declaration.h" 28 28 #include "Common/UnimplementedError.h" 29 #include "parse utility.h"29 #include "parserutility.h" 30 30 #include "Common/utility.h" 31 31 -
src/Parser/LinkageSpec.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:22:09 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sun Oct 2 23:16:21 201613 // Update Count : 2 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:51:00 2017 13 // Update Count : 24 14 14 // 15 15 … … 28 28 } else if ( *spec == "\"C\"" ) { 29 29 return C; 30 } else if ( *spec == "\"BuiltinC\"" ) { 31 return BuiltinC; 30 32 } else { 31 33 throw SemanticError( "Invalid linkage specifier " + *spec ); … … 36 38 assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs ); 37 39 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = { 38 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", 40 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in", 39 41 }; 40 42 return linkageKinds[linkage]; 41 43 } 42 44 43 bool LinkageSpec::is Decoratable( Spec spec ) {45 bool LinkageSpec::isMangled( Spec spec ) { 44 46 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 45 47 static bool decoratable[LinkageSpec::NoOfSpecs] = { 46 // Intrinsic, Cforall, C, AutoGen, Compiler 48 // Intrinsic, Cforall, C, AutoGen, Compiler, 47 49 true, true, false, true, false, 50 // Builtin, BuiltinC, 51 true, false, 48 52 }; 49 53 return decoratable[spec]; … … 53 57 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 54 58 static bool generatable[LinkageSpec::NoOfSpecs] = { 55 // Intrinsic, Cforall, C, AutoGen, Compiler 59 // Intrinsic, Cforall, C, AutoGen, Compiler, 56 60 true, true, true, true, false, 61 // Builtin, BuiltinC, 62 true, true, 57 63 }; 58 64 return generatable[spec]; … … 62 68 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 63 69 static bool overridable[LinkageSpec::NoOfSpecs] = { 64 // Intrinsic, Cforall, C, AutoGen, Compiler 70 // Intrinsic, Cforall, C, AutoGen, Compiler, 65 71 true, false, false, true, false, 72 // Builtin, BuiltinC, 73 false, false, 66 74 }; 67 75 return overridable[spec]; … … 71 79 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 72 80 static bool builtin[LinkageSpec::NoOfSpecs] = { 73 // Intrinsic, Cforall, C, AutoGen, Compiler 81 // Intrinsic, Cforall, C, AutoGen, Compiler, 74 82 true, false, false, false, true, 83 // Builtin, BuiltinC, 84 true, true, 75 85 }; 76 86 return builtin[spec]; -
src/Parser/LinkageSpec.h
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Oct 1 23:03:17 201613 // Update Count : 1 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:50:00 2017 13 // Update Count : 12 14 14 // 15 15 … … 26 26 AutoGen, // built by translator (struct assignment) 27 27 Compiler, // gcc internal 28 Builtin, // mangled builtins 29 BuiltinC, // non-mangled builtins 28 30 NoOfSpecs 29 31 }; … … 32 34 static std::string linkageName( Spec ); 33 35 34 static bool is Decoratable( Spec );36 static bool isMangled( Spec ); 35 37 static bool isGeneratable( Spec ); 36 38 static bool isOverridable( Spec ); -
src/Parser/StatementNode.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 14:59:41 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Jun 12 13:03:00201713 // Update Count : 3 2911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:08:37 2017 13 // Update Count : 330 14 14 // 15 15 … … 21 21 #include "SynTree/Statement.h" 22 22 #include "SynTree/Expression.h" 23 #include "parse utility.h"23 #include "parserutility.h" 24 24 #include "Common/utility.h" 25 25 -
src/Parser/TypeData.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:52:43201713 // Update Count : 56 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 2017 13 // Update Count : 564 14 14 // 15 15 … … 614 614 } // buildPointer 615 615 616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { 617 617 assert( td->kind == TypeData::Aggregate ); 618 618 AggregateDecl * at; … … 622 622 case DeclarationNode::Monitor: 623 623 case DeclarationNode::Thread: 624 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );624 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage ); 625 625 buildForall( td->aggregate.params, at->get_parameters() ); 626 626 break; … … 643 643 } // buildAggregate 644 644 645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { 646 646 switch ( type->kind ) { 647 647 case TypeData::Enum: { … … 656 656 ReferenceToType * ret; 657 657 if ( type->aggregate.body ) { 658 AggregateDecl * typedecl = buildAggregate( type, attributes );658 AggregateDecl * typedecl = buildAggregate( type, attributes, linkage ); 659 659 switch ( type->aggregate.kind ) { 660 660 case DeclarationNode::Struct: … … 803 803 return decl->set_asmName( asmName ); 804 804 } else if ( td->kind == TypeData::Aggregate ) { 805 return buildAggregate( td, attributes );805 return buildAggregate( td, attributes, linkage ); 806 806 } else if ( td->kind == TypeData::Enum ) { 807 807 return buildEnum( td, attributes ); -
src/Parser/TypeData.h
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:18:36 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 16 08:32:39201713 // Update Count : 18 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 2017 13 // Update Count : 186 14 14 // 15 15 … … 102 102 ArrayType * buildArray( const TypeData * ); 103 103 AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > ); 104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ); 105 105 ReferenceToType * buildAggInst( const TypeData * ); 106 106 TypeDecl * buildVariable( const TypeData * ); -
src/Parser/TypedefTable.h
r62423350 ra12d5aa 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 15 18:25:04 201613 // Update Count : 2812 // Last Modified On : Wed Jun 28 21:56:34 2017 13 // Update Count : 33 14 14 // 15 15 … … 22 22 #include <stack> 23 23 24 #include " lex.h"24 #include "parser.hh" 25 25 #include "parser.h" 26 26 -
src/Parser/lex.ll
r62423350 ra12d5aa 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue May 30 22:00:48201713 * Update Count : 52 712 * Last Modified On : Wed Jun 28 21:03:45 2017 13 * Update Count : 529 14 14 */ 15 15 … … 27 27 #include <cstdio> // FILENAME_MAX 28 28 29 #include "lex.h"30 #include "parser.h" // YACC generated definitions based on C++ grammar31 29 #include "ParseNode.h" 32 30 #include "TypedefTable.h" -
src/Parser/module.mk
r62423350 ra12d5aa 11 11 ## Created On : Sat May 16 15:29:09 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Tue Aug 16 17:28:34 201614 ## Update Count : 10 113 ## Last Modified On : Wed Jun 28 21:58:29 2017 14 ## Update Count : 104 15 15 ############################################################################### 16 16 … … 29 29 Parser/TypeData.cc \ 30 30 Parser/LinkageSpec.cc \ 31 Parser/parse utility.cc31 Parser/parserutility.cc 32 32 33 33 MAINTAINERCLEANFILES += Parser/parser.output -
src/Parser/parser.hh
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // lex.h --7 // parser.hh -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 22 08:58:10 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 21 11:28:47 201613 // Update Count : 34 712 // Last Modified On : Wed Jun 28 22:10:17 2017 13 // Update Count : 349 14 14 // 15 15 16 #ifndef PARSER_ LEX_H17 #define PARSER_ LEX_H16 #ifndef PARSER_HH 17 #define PARSER_HH 18 18 19 19 int yylex(); … … 42 42 }; // Token 43 43 44 #endif // PARSER_ LEX_H44 #endif // PARSER_HH 45 45 46 46 // Local Variables: // -
src/Parser/parser.yy
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // cfa.y --7 // parser.yy -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 12 12:59:00201713 // Update Count : 24 0212 // Last Modified On : Wed Jun 28 22:11:22 2017 13 // Update Count : 2414 14 14 // 15 15 … … 48 48 #include <cstdio> 49 49 #include <stack> 50 #include "lex.h"51 #include "parser.h"52 50 #include "ParseNode.h" 53 51 #include "TypedefTable.h" … … 88 86 bool forall = false; // aggregate have one or more forall qualifiers ? 89 87 %} 88 89 // Types declaration 90 %union 91 { 92 Token tok; 93 ParseNode * pn; 94 ExpressionNode * en; 95 DeclarationNode * decl; 96 DeclarationNode::Aggregate aggKey; 97 DeclarationNode::TypeClass tclass; 98 StatementNode * sn; 99 ConstantExpr * constant; 100 ForCtl * fctl; 101 LabelNode * label; 102 InitializerNode * in; 103 OperKinds op; 104 std::string * str; 105 bool flag; 106 } 90 107 91 108 //************************* TERMINAL TOKENS ******************************** … … 139 156 140 157 %token ATassign // @= 141 142 // Types declaration143 %union144 {145 Token tok;146 ParseNode * pn;147 ExpressionNode * en;148 DeclarationNode * decl;149 DeclarationNode::Aggregate aggKey;150 DeclarationNode::TypeClass tclass;151 StatementNode * sn;152 ConstantExpr * constant;153 ForCtl * fctl;154 LabelNode * label;155 InitializerNode * in;156 OperKinds op;157 std::string * str;158 bool flag;159 }160 158 161 159 %type<tok> identifier no_attr_identifier zero_one … … 959 957 960 958 handler_clause: 961 CATCH '(' push push exception_declaration pop ')' compound_statement pop 959 // TEMPORARY, TEST EXCEPTIONS 960 CATCH '(' push push INTEGERconstant pop ')' compound_statement pop 961 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); } 962 | handler_clause CATCH '(' push push INTEGERconstant pop ')' compound_statement pop 963 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 964 965 | CATCH '(' push push exception_declaration pop ')' compound_statement pop 962 966 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); } 963 967 | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop -
src/Parser/parserutility.cc
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // parse utility.cc --7 // parserutility.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:30:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 2 1 15:33:41201713 // Update Count : 512 // Last Modified On : Wed Jun 28 22:11:32 2017 13 // Update Count : 7 14 14 // 15 15 16 #include "parse utility.h"16 #include "parserutility.h" 17 17 #include "SynTree/Type.h" 18 18 #include "SynTree/Expression.h" -
src/Parser/parserutility.h
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // parse utility.h --7 // parserutility.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:31:46 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 15:32:58 201513 // Update Count : 212 // Last Modified On : Wed Jun 28 22:11:40 2017 13 // Update Count : 3 14 14 // 15 15 -
src/SymTab/Autogen.cc
r62423350 ra12d5aa 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 09:41:08201713 // Update Count : 6 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:30:00 2017 13 // Update Count : 61 14 14 // 15 15 … … 400 400 /// generates struct constructors, destructor, and assignment functions 401 401 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) { 402 // Builtins do not use autogeneration. 403 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin || 404 aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) { 405 return; 406 } 407 402 408 // Make function polymorphic in same parameters as generic struct, if applicable 403 409 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions -
src/SymTab/Mangler.cc
r62423350 ra12d5aa 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:40:29 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 09:40:01201713 // Update Count : 2 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:31:00 2017 13 // Update Count : 21 14 14 // 15 15 … … 72 72 } else { 73 73 // if we add another kind of overridable function, this has to change 74 assert( false );74 assert( false && "unknown overrideable linkage" ); 75 75 } // if 76 76 } -
src/SynTree/AggregateDecl.cc
r62423350 ra12d5aa 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 23:56:39 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T hu Mar 16 07:49:07201713 // Update Count : 2 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:30:00 2017 13 // Update Count : 21 14 14 // 15 15 … … 20 20 21 21 22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall), body( false ), attributes( attributes ) {22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes, LinkageSpec::Spec linkage ) : Parent( name, Type::StorageClasses(), linkage ), body( false ), attributes( attributes ) { 23 23 } 24 24 -
src/SynTree/Declaration.h
r62423350 ra12d5aa 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 : Fri Mar 17 16:05:08201713 // Update Count : 12 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:31:00 2017 13 // Update Count : 122 14 14 // 15 15 … … 238 238 typedef Declaration Parent; 239 239 public: 240 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() );240 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ); 241 241 AggregateDecl( const AggregateDecl &other ); 242 242 virtual ~AggregateDecl(); … … 266 266 typedef AggregateDecl Parent; 267 267 public: 268 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes), kind( kind ) {}268 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {} 269 269 StructDecl( const StructDecl &other ) : Parent( other ) {} 270 270 … … 284 284 typedef AggregateDecl Parent; 285 285 public: 286 UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes) {}286 UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {} 287 287 UnionDecl( const UnionDecl &other ) : Parent( other ) {} 288 288 … … 297 297 typedef AggregateDecl Parent; 298 298 public: 299 EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes) {}299 EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {} 300 300 EnumDecl( const EnumDecl &other ) : Parent( other ) {} 301 301 -
src/libcfa/Makefile.am
r62423350 ra12d5aa 10 10 ## Author : Peter A. Buhr 11 11 ## Created On : Sun May 31 08:54:01 2015 12 ## Last Modified By : Peter A. Buhr13 ## Last Modified On : Sun May 14 21:04:21201714 ## Update Count : 21 412 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jun 28 15:36:00 2017 14 ## Update Count : 215 15 15 ############################################################################### 16 16 … … 64 64 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 65 65 66 libcfa_a-exception.o : exception.c 67 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 68 66 69 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 70 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 71 72 libcfa_d_a-exception.o : exception.c 67 73 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 68 74 … … 72 78 libcfa_a_CFLAGS = -nodebug -O2 73 79 libcfa_d_a_SOURCES = ${libsrc} 74 libcfa_d_a_CFLAGS = -debug -O0 80 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug 75 81 76 82 stdhdr = ${shell echo stdhdr/*} -
src/libcfa/Makefile.in
r62423350 ra12d5aa 332 332 libcfa_a_CFLAGS = -nodebug -O2 333 333 libcfa_d_a_SOURCES = ${libsrc} 334 libcfa_d_a_CFLAGS = -debug -O0 334 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug 335 335 stdhdr = ${shell echo stdhdr/*} 336 336 cfa_includedir = $(CFA_INCDIR) … … 1428 1428 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1429 1429 1430 libcfa_a-exception.o : exception.c 1431 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1432 1430 1433 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 1434 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1435 1436 libcfa_d_a-exception.o : exception.c 1431 1437 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1432 1438 -
src/main.cc
r62423350 ra12d5aa 10 10 // Author : Richard C. Bilson 11 11 // Created On : Fri May 15 23:12:02 2015 12 // Last Modified By : Andrew Beach13 // Last Modified On : Wed May 10 14:45:00 201714 // Update Count : 4 3712 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu Jun 29 12:46:50 2017 14 // Update Count : 441 15 15 // 16 16 … … 25 25 using namespace std; 26 26 27 #include "Parser/lex.h" 28 #include "Parser/parser.h" 27 #include "Parser/parser.hh" 29 28 #include "Parser/TypedefTable.h" 30 29 #include "GenPoly/Lvalue.h" … … 186 185 if ( ! nopreludep ) { // include gcc builtins 187 186 // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here. 188 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" ); 189 assertf( builtins, "cannot open builtins.cf\n" ); 190 parse( builtins, LinkageSpec::Compiler ); 187 188 // Read to gcc builtins, if not generating the cfa library 189 FILE * gcc_builtins = fopen( libcfap | treep ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" ); 190 assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" ); 191 parse( gcc_builtins, LinkageSpec::Compiler ); 191 192 192 193 // read the extra prelude in, if not generating the cfa library … … 200 201 assertf( prelude, "cannot open prelude.cf\n" ); 201 202 parse( prelude, LinkageSpec::Intrinsic ); 203 204 // Read to cfa builtins, if not generating the cfa library 205 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" ); 206 assertf( builtins, "cannot open builtins.cf\n" ); 207 parse( builtins, LinkageSpec::Builtin ); 202 208 } // if 203 209 } // if … … 475 481 break; 476 482 case '?': 477 assertf( false, "Unknown option: '%c'\n", (char)optopt ); 483 if ( optopt ) { // short option ? 484 assertf( false, "Unknown option: -%c\n", (char)optopt ); 485 } else { 486 assertf( false, "Unknown option: %s\n", argv[optind - 1] ); 487 } // if 478 488 default: 479 489 abort(); -
src/prelude/Makefile.am
r62423350 ra12d5aa 20 20 # put into lib for now 21 21 cfalibdir = ${CFA_LIBDIR} 22 cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c22 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c 23 23 noinst_DATA = ../libcfa/libcfa-prelude.c 24 25 $(DEPDIR) : 26 mkdir $(DEPDIR) 27 28 $(DEPDIR)/builtins.Po : $(DEPDIR) 29 touch ${@} 24 30 25 31 # create extra forward types/declarations to reduce inclusion of library files … … 28 34 29 35 # create forward declarations for gcc builtins 30 builtins.cf :builtins.c prototypes.sed36 gcc-builtins.cf : gcc-builtins.c prototypes.sed 31 37 ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@ 32 38 33 builtins.c : builtins.def prototypes.awk39 gcc-builtins.c : builtins.def prototypes.awk 34 40 ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@ 35 41 … … 38 44 prototypes.awk : 39 45 40 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 46 # create forward declarations for cfa builtins 47 builtins.cf : builtins.c 48 ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po 49 ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po 50 51 include $(DEPDIR)/builtins.Po 52 53 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 41 54 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@ # use src/cfa-cpp as not in lib until after install 42 55 43 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp56 bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 44 57 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 45 58 46 MAINTAINERCLEANFILES = builtins.c builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} 59 maintainer-clean-local : 60 rm -rf $(DEPDIR) 61 62 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} -
src/prelude/Makefile.in
r62423350 ra12d5aa 211 211 # put into lib for now 212 212 cfalibdir = ${CFA_LIBDIR} 213 cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c213 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c 214 214 noinst_DATA = ../libcfa/libcfa-prelude.c 215 MAINTAINERCLEANFILES = builtins.cbuiltins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}215 MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}} 216 216 all: all-am 217 217 … … 390 390 maintainer-clean: maintainer-clean-am 391 391 -rm -f Makefile 392 maintainer-clean-am: distclean-am maintainer-clean-generic 392 maintainer-clean-am: distclean-am maintainer-clean-generic \ 393 maintainer-clean-local 393 394 394 395 mostlyclean: mostlyclean-am … … 416 417 install-ps install-ps-am install-strip installcheck \ 417 418 installcheck-am installdirs maintainer-clean \ 418 maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ 419 pdf-am ps ps-am uninstall uninstall-am uninstall-cfalibDATA 420 419 maintainer-clean-generic maintainer-clean-local mostlyclean \ 420 mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ 421 uninstall-cfalibDATA 422 423 424 $(DEPDIR) : 425 mkdir $(DEPDIR) 426 427 $(DEPDIR)/builtins.Po : $(DEPDIR) 428 touch ${@} 421 429 422 430 # create extra forward types/declarations to reduce inclusion of library files … … 425 433 426 434 # create forward declarations for gcc builtins 427 builtins.cf :builtins.c prototypes.sed435 gcc-builtins.cf : gcc-builtins.c prototypes.sed 428 436 ${AM_V_GEN}@BACKEND_CC@ -E -P $< | sed -f prototypes.sed > $@ 429 437 430 builtins.c : builtins.def prototypes.awk438 gcc-builtins.c : builtins.def prototypes.awk 431 439 ${AM_V_GEN}@BACKEND_CC@ -E prototypes.c | awk -f prototypes.awk > $@ 432 440 … … 435 443 prototypes.awk : 436 444 437 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 445 # create forward declarations for cfa builtins 446 builtins.cf : builtins.c 447 ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po 448 ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po 449 450 include $(DEPDIR)/builtins.Po 451 452 ../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 438 453 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -l prelude.cf $@ # use src/cfa-cpp as not in lib until after install 439 454 440 bootloader.c : bootloader.cf prelude.cf extras.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp455 bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp 441 456 ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@ # use src/cfa-cpp as not in lib until after install 457 458 maintainer-clean-local : 459 rm -rf $(DEPDIR) 442 460 443 461 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
src/tests/preempt_longrun/Makefile.am
r62423350 ra12d5aa 16 16 17 17 repeats=10 18 max_time=10 19 N=10ul 18 max_time=30 20 19 preempt=10_000ul 21 20 22 21 REPEAT = ${abs_top_srcdir}/tools/repeat -s 23 22 24 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -D N=${N} -DPREEMPTION_RATE=${preempt}23 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt} 25 24 CFLAGS = ${BUILD_FLAGS} 26 25 CC = @CFA_BINDIR@/@CFA_NAME@ 27 26 28 TESTS = create stackyield27 TESTS = barge block create disjoint processor stack wait yield 29 28 30 29 .INTERMEDIATE: ${TESTS} -
src/tests/preempt_longrun/Makefile.in
r62423350 ra12d5aa 178 178 top_srcdir = @top_srcdir@ 179 179 repeats = 10 180 max_time = 10 181 N = 10ul 180 max_time = 30 182 181 preempt = 10_000ul 183 182 REPEAT = ${abs_top_srcdir}/tools/repeat -s 184 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -D N=${N} -DPREEMPTION_RATE=${preempt}185 TESTS = create stackyield183 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt} 184 TESTS = barge block create disjoint processor stack wait yield 186 185 all: all-am 187 186 -
src/tests/sched-int-block.c
r62423350 ra12d5aa 5 5 #include <thread> 6 6 7 static const unsigned N = 100_000; 7 #ifndef N 8 #define N 100_000 9 #endif 8 10 9 11 enum state_t { WAITED, SIGNAL, BARGE }; -
src/tests/sched-int-disjoint.c
r62423350 ra12d5aa 4 4 #include <thread> 5 5 6 #ifndef N 6 7 #define N 100_000 8 #endif 7 9 8 10 enum state_t { WAIT, SIGNAL, BARGE }; -
src/tests/sched-int-wait.c
r62423350 ra12d5aa 5 5 #include <thread> 6 6 7 static const int N = 10_000; 7 #ifndef N 8 #define N 10_000 9 #endif 8 10 9 11 monitor global_t {}; -
tools/cfa.nanorc
r62423350 ra12d5aa 2 2 ## WIP 3 3 4 syntax "cfa" "\.cfa$" 5 ## No magic 4 syntax "cfa" "\.cfa" 6 5 7 6 # Macros … … 19 18 # Control Flow Structures 20 19 color brightyellow "\<(if|else|while|do|for|switch|choose|case|default)\>" 21 ##color brightyellow "\<(try|catch|catchResume|finally)\>"20 color brightyellow "\<(try|catch|catchResume|finally)\>" 22 21 23 22 # Control Flow Statements 24 color magenta "\<(return|break|continue|fallthru|throw )\>"23 color magenta "\<(return|break|continue|fallthru|throw|throwResume)\>" 25 24 26 25 # Operator Names … … 46 45 color brightmagenta "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'" 47 46 # Strings and Angle Strings 48 color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"47 color yellow ""([^"]|\\")*"" "<[^[:blank:]=]*>" 49 48 # Multiline Strings: This regex is VERY expencive and often too strong. 50 49 ###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*"" -
tools/repeat
r62423350 ra12d5aa 20 20 for (( i = 0; i < ITERATION; i ++ )); do 21 21 echo -ne "\r$i / $ITERATION" 22 $@ &22 $@ > /dev/null & 23 23 child=$! 24 24 wait "$child"
Note: See TracChangeset
for help on using the changeset viewer.