Changeset a64137f for src


Ignore:
Timestamp:
Feb 1, 2023, 4:32:29 PM (15 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
ccf1d99
Parents:
1f35220
Message:

added support for copying envelopes in generated | routine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Actors.cpp

    r1f35220 ra64137f  
    180180};
    181181
     182#define __ALLOC 0
     183
    182184struct GenReceiveDecls : public ast::WithDeclsToAdd<> {
    183185    unordered_set<const StructDecl *> & actorStructDecls;
     
    226228            CompoundStmt * sendBody = new CompoundStmt( decl->location );
    227229
     230            #if __ALLOC
    228231            // Generates: request * new_req = alloc();
    229232            sendBody->push_back( new DeclStmt(
     
    236239                )
    237240            ));
     241            #else
     242            // Generates: request new_req;
     243            sendBody->push_back( new DeclStmt(
     244                decl->location,
     245                new ObjectDecl(
     246                    decl->location,
     247                    "new_req",
     248                    new StructInstType( *requestDecl )
     249                )
     250            ));
     251            #endif
    238252           
    239253            // Function type is: Allocation (*)( derived_actor &, derived_msg & )
     
    276290            ));
    277291
     292            #if __ALLOC
    278293            // Generates: (*new_req){ &receiver, &msg, fn };
    279294            sendBody->push_back( new ExprStmt(
     
    305320                                )
    306321                        ));
     322            #else
     323            // Generates: new_req{ &receiver, &msg, fn };
     324            sendBody->push_back( new ExprStmt(
     325                decl->location,
     326                                new UntypedExpr (
     327                    decl->location,
     328                                        new NameExpr( decl->location, "?{}" ),
     329                                        {
     330                                                new NameExpr( decl->location, "new_req" ),
     331                        new AddressExpr( new NameExpr( decl->location, "receiver" ) ),
     332                        new AddressExpr( new NameExpr( decl->location, "msg" ) ),
     333                        new NameExpr( decl->location, "fn" )
     334                                        }
     335                                )
     336                        ));
     337
     338            // Generates: send( receiver, new_req );
     339            sendBody->push_back( new ExprStmt(
     340                decl->location,
     341                                new UntypedExpr (
     342                    decl->location,
     343                                        new NameExpr( decl->location, "send" ),
     344                                        {
     345                                                {
     346                            new NameExpr( decl->location, "receiver" ),
     347                            new NameExpr( decl->location, "new_req" )
     348                        }
     349                                        }
     350                                )
     351                        ));
     352            #endif
    307353           
    308354            // Generates: return receiver;
Note: See TracChangeset for help on using the changeset viewer.