Changes in src/Concurrency/Actors.cpp [2d028039:ccf1d99]
- File:
-
- 1 edited
-
src/Concurrency/Actors.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Actors.cpp
r2d028039 rccf1d99 180 180 }; 181 181 182 #define __ALLOC 0 // C_TODO: complete swap to no-alloc version 183 182 184 struct GenReceiveDecls : public ast::WithDeclsToAdd<> { 183 185 unordered_set<const StructDecl *> & actorStructDecls; … … 216 218 /* 217 219 static inline derived_actor & ?|?( derived_actor & receiver, derived_msg & msg ) { 218 request new_req;220 request * new_req = alloc(); 219 221 Allocation (*my_work_fn)( derived_actor &, derived_msg & ) = receive; 220 222 __receive_fn fn = (__receive_fn)my_work_fn; 221 new_req{ &receiver, &msg, fn };222 send( receiver, new_req );223 (*new_req){ &receiver, &msg, fn }; 224 send( receiver, *new_req ); 223 225 return receiver; 224 226 } … … 226 228 CompoundStmt * sendBody = new CompoundStmt( decl->location ); 227 229 230 #if __ALLOC 231 // 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 #else 228 242 // Generates: request new_req; 229 243 sendBody->push_back( new DeclStmt( … … 235 249 ) 236 250 )); 251 #endif 237 252 238 253 // Function type is: Allocation (*)( derived_actor &, derived_msg & ) … … 275 290 )); 276 291 292 #if __ALLOC 293 // 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 #else 277 323 // Generates: new_req{ &receiver, &msg, fn }; 278 324 sendBody->push_back( new ExprStmt( … … 304 350 ) 305 351 )); 352 #endif 306 353 307 354 // Generates: return receiver;
Note:
See TracChangeset
for help on using the changeset viewer.