- Timestamp:
- Feb 8, 2023, 3:07:52 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 4616622
- Parents:
- ccf1d99
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Actors.cpp
rccf1d99 r2d028039 180 180 }; 181 181 182 #define __ALLOC 0 // C_TODO: complete swap to no-alloc version183 184 182 struct GenReceiveDecls : public ast::WithDeclsToAdd<> { 185 183 unordered_set<const StructDecl *> & actorStructDecls; … … 218 216 /* 219 217 static inline derived_actor & ?|?( derived_actor & receiver, derived_msg & msg ) { 220 request * new_req = alloc();218 request new_req; 221 219 Allocation (*my_work_fn)( derived_actor &, derived_msg & ) = receive; 222 220 __receive_fn fn = (__receive_fn)my_work_fn; 223 (*new_req){ &receiver, &msg, fn };224 send( receiver, *new_req );221 new_req{ &receiver, &msg, fn }; 222 send( receiver, new_req ); 225 223 return receiver; 226 224 } … … 228 226 CompoundStmt * sendBody = new CompoundStmt( decl->location ); 229 227 230 #if __ALLOC231 // Generates: request * new_req = alloc();232 sendBody->push_back( new DeclStmt(233 decl->location,234 new ObjectDecl(235 decl->location,236 "new_req",237 new PointerType( new StructInstType( *requestDecl ) ),238 new SingleInit( decl->location, new UntypedExpr( decl->location, new NameExpr( decl->location, "alloc" ), {} ) )239 )240 ));241 #else242 228 // Generates: request new_req; 243 229 sendBody->push_back( new DeclStmt( … … 249 235 ) 250 236 )); 251 #endif252 237 253 238 // Function type is: Allocation (*)( derived_actor &, derived_msg & ) … … 290 275 )); 291 276 292 #if __ALLOC293 // Generates: (*new_req){ &receiver, &msg, fn };294 sendBody->push_back( new ExprStmt(295 decl->location,296 new UntypedExpr (297 decl->location,298 new NameExpr( decl->location, "?{}" ),299 {300 new UntypedExpr( decl->location, new NameExpr( decl->location, "*?" ), { new NameExpr( decl->location, "new_req" ) } ),301 new AddressExpr( new NameExpr( decl->location, "receiver" ) ),302 new AddressExpr( new NameExpr( decl->location, "msg" ) ),303 new NameExpr( decl->location, "fn" )304 }305 )306 ));307 308 // Generates: send( receiver, *new_req );309 sendBody->push_back( new ExprStmt(310 decl->location,311 new UntypedExpr (312 decl->location,313 new NameExpr( decl->location, "send" ),314 {315 {316 new NameExpr( decl->location, "receiver" ),317 new UntypedExpr( decl->location, new NameExpr( decl->location, "*?" ), { new NameExpr( decl->location, "new_req" ) } )318 }319 }320 )321 ));322 #else323 277 // Generates: new_req{ &receiver, &msg, fn }; 324 278 sendBody->push_back( new ExprStmt( … … 350 304 ) 351 305 )); 352 #endif353 306 354 307 // Generates: return receiver;
Note: See TracChangeset
for help on using the changeset viewer.