Changeset adc73a5
- Timestamp:
- Jun 20, 2023, 2:20:56 PM (20 months ago)
- Branches:
- master
- Children:
- 48ec19a
- Parents:
- b7b3e41 (diff), d10e391 (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:
-
- 12 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/actor.hfa
rb7b3e41 radc73a5 46 46 enum allocation { Nodelete, Delete, Destroy, Finished }; // allocation status 47 47 48 typedef allocation (*__receive_fn)(actor &, message & );48 typedef allocation (*__receive_fn)(actor &, message &, actor **, message **); 49 49 struct request { 50 actor * base_receiver;51 50 actor * receiver; 52 message * base_msg;53 51 message * msg; 54 52 __receive_fn fn; … … 59 57 }; 60 58 static inline void ?{}( request & this ) {} 61 static inline void ?{}( request & this, actor * base_receiver, actor * receiver, message * base_msg, message * msg, __receive_fn fn ) { 62 this.base_receiver = base_receiver; 59 static inline void ?{}( request & this, actor * receiver, message * msg, __receive_fn fn ) { 63 60 this.receiver = receiver; 64 this.base_msg = base_msg;65 61 this.msg = msg; 66 62 this.fn = fn; … … 460 456 static inline void deliver_request( request & this ) { 461 457 DEBUG_ABORT( this.receiver->ticket == (unsigned long int)MAX, "Attempted to send message to deleted/dead actor\n" ); 462 this.base_receiver->allocation_ = this.fn( *this.receiver, *this.msg ); 463 check_message( *this.base_msg ); 464 check_actor( *this.base_receiver ); 458 actor * base_actor; 459 message * base_msg; 460 allocation temp = this.fn( *this.receiver, *this.msg, &base_actor, &base_msg ); 461 base_actor->allocation_ = temp; 462 check_message( *base_msg ); 463 check_actor( *base_actor ); 465 464 } 466 465 -
libcfa/src/concurrency/locks.hfa
rb7b3e41 radc73a5 35 35 #include <linux/futex.h> /* Definition of FUTEX_* constants */ 36 36 #include <sys/syscall.h> /* Definition of SYS_* constants */ 37 #include <unistd.h> 37 #include <unistd.h> /* Definition of syscall routine */ 38 38 39 39 typedef void (*__cfa_pre_park)( void * ); -
src/Concurrency/Actors.cpp
rb7b3e41 radc73a5 223 223 if ( actorIter != actorStructDecls.end() && messageIter != messageStructDecls.end() ) { 224 224 ////////////////////////////////////////////////////////////////////// 225 // The following generates this wrapper for all receive(derived_actor &, derived_msg &) functions 226 /* base_actor and base_msg are output params 227 static inline allocation __CFA_receive_wrap( derived_actor & receiver, derived_msg & msg, actor ** base_actor, message ** base_msg ) { 228 base_actor = &receiver; 229 base_msg = &msg; 230 return receive( receiver, msg ); 231 } 232 */ 233 CompoundStmt * wrapBody = new CompoundStmt( decl->location ); 234 235 // generates: base_actor = &receiver; 236 wrapBody->push_back( new ExprStmt( decl->location, 237 UntypedExpr::createAssign( decl->location, 238 UntypedExpr::createDeref( decl->location, new NameExpr( decl->location, "base_actor" ) ), 239 new AddressExpr( decl->location, new NameExpr( decl->location, "receiver" ) ) 240 ) 241 )); 242 243 // generates: base_msg = &msg; 244 wrapBody->push_back( new ExprStmt( decl->location, 245 UntypedExpr::createAssign( decl->location, 246 UntypedExpr::createDeref( decl->location, new NameExpr( decl->location, "base_msg" ) ), 247 new AddressExpr( decl->location, new NameExpr( decl->location, "msg" ) ) 248 ) 249 )); 250 251 // generates: return receive( receiver, msg ); 252 wrapBody->push_back( new ReturnStmt( decl->location, 253 new UntypedExpr ( decl->location, 254 new NameExpr( decl->location, "receive" ), 255 { 256 new NameExpr( decl->location, "receiver" ), 257 new NameExpr( decl->location, "msg" ) 258 } 259 ) 260 )); 261 262 // create receive wrapper to extract base message and actor pointer 263 // put it all together into the complete function decl from above 264 FunctionDecl * receiveWrapper = new FunctionDecl( 265 decl->location, 266 "__CFA_receive_wrap", 267 {}, // forall 268 { 269 new ObjectDecl( 270 decl->location, 271 "receiver", 272 ast::deepCopy( derivedActorRef ) 273 ), 274 new ObjectDecl( 275 decl->location, 276 "msg", 277 ast::deepCopy( derivedMsgRef ) 278 ), 279 new ObjectDecl( 280 decl->location, 281 "base_actor", 282 new PointerType( new PointerType( new StructInstType( *actorDecl ) ) ) 283 ), 284 new ObjectDecl( 285 decl->location, 286 "base_msg", 287 new PointerType( new PointerType( new StructInstType( *msgDecl ) ) ) 288 ) 289 }, // params 290 { 291 new ObjectDecl( 292 decl->location, 293 "__CFA_receive_wrap_ret", 294 new EnumInstType( *allocationDecl ) 295 ) 296 }, 297 wrapBody, // body 298 { Storage::Static }, // storage 299 Linkage::Cforall, // linkage 300 {}, // attributes 301 { Function::Inline } 302 ); 303 304 declsToAddAfter.push_back( receiveWrapper ); 305 306 ////////////////////////////////////////////////////////////////////// 225 307 // The following generates this send message operator routine for all receive(derived_actor &, derived_msg &) functions 226 308 /* … … 246 328 )); 247 329 248 // Function type is: allocation (*)( derived_actor &, derived_msg & )330 // Function type is: allocation (*)( derived_actor &, derived_msg &, actor **, message ** ) 249 331 FunctionType * derivedReceive = new FunctionType(); 250 332 derivedReceive->params.push_back( ast::deepCopy( derivedActorRef ) ); 251 333 derivedReceive->params.push_back( ast::deepCopy( derivedMsgRef ) ); 334 derivedReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *actorDecl ) ) ) ); 335 derivedReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *msgDecl ) ) ) ); 252 336 derivedReceive->returns.push_back( new EnumInstType( *allocationDecl ) ); 253 337 254 // Generates: allocation (*my_work_fn)( derived_actor &, derived_msg & ) = receive;338 // Generates: allocation (*my_work_fn)( derived_actor &, derived_msg &, actor **, message ** ) = receive; 255 339 sendBody->push_back( new DeclStmt( 256 340 decl->location, … … 259 343 "my_work_fn", 260 344 new PointerType( derivedReceive ), 261 new SingleInit( decl->location, new NameExpr( decl->location, " receive" ) )345 new SingleInit( decl->location, new NameExpr( decl->location, "__CFA_receive_wrap" ) ) 262 346 ) 263 347 )); … … 267 351 genericReceive->params.push_back( new ReferenceType( new StructInstType( *actorDecl ) ) ); 268 352 genericReceive->params.push_back( new ReferenceType( new StructInstType( *msgDecl ) ) ); 353 genericReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *actorDecl ) ) ) ); 354 genericReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *msgDecl ) ) ) ); 269 355 genericReceive->returns.push_back( new EnumInstType( *allocationDecl ) ); 270 356 … … 285 371 )); 286 372 287 // Generates: new_req{ &receiver, (actor *)&receiver, &msg, (message *)&msg, fn };373 // Generates: new_req{ (actor *)&receiver, (message *)&msg, fn }; 288 374 sendBody->push_back( new ExprStmt( 289 375 decl->location, … … 293 379 { 294 380 new NameExpr( decl->location, "new_req" ), 295 new AddressExpr( new NameExpr( decl->location, "receiver" ) ),296 381 new CastExpr( decl->location, new AddressExpr( new NameExpr( decl->location, "receiver" ) ), new PointerType( new StructInstType( *actorDecl ) ), ExplicitCast ), 297 new AddressExpr( new NameExpr( decl->location, "msg" ) ),298 382 new CastExpr( decl->location, new AddressExpr( new NameExpr( decl->location, "msg" ) ), new PointerType( new StructInstType( *msgDecl ) ), ExplicitCast ), 299 383 new NameExpr( decl->location, "fn" ) -
tests/Makefile.am
rb7b3e41 radc73a5 225 225 -cp ${test} ${abspath ${@}} 226 226 227 array-container/dimexpr-match-c-ERRS : array-container/dimexpr-match-c.cfa 228 ${CFACOMPILE_SYNTAX} -DERRS 229 -cp ${test} ${abspath ${@}} 230 231 array-container/dimexpr-match-cfa-ERRS : array-container/dimexpr-match-cfa.cfa 232 ${CFACOMPILE_SYNTAX} -DERRS 233 -cp ${test} ${abspath ${@}} 234 227 235 alloc-ERROR : alloc.cfa ${CFACCBIN} 228 236 ${CFACOMPILE_SYNTAX} -DERR1 -
tests/test.py
rb7b3e41 radc73a5 115 115 parser.add_argument('--continue', help='When multiple specifications are passed (debug/install/arch), sets whether or not to continue if the last specification failed', type=yes_no, default='yes', dest='continue_') 116 116 parser.add_argument('--invariant', help='Tell the compiler to check invariants.', action='store_true') 117 parser.add_argument('--no-invariant', help='Tell the compiler not to check invariant .', action='store_false')117 parser.add_argument('--no-invariant', help='Tell the compiler not to check invariants.', action='store_false') 118 118 parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=180) 119 119 parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
Note: See TracChangeset
for help on using the changeset viewer.