@@ -54,18 +54,19 @@ static SILValue emitActorPropertyReference(
5454// / \param value the value to use when initializing the property.
5555static void initializeProperty (SILGenFunction &SGF, SILLocation loc,
5656 SILValue actorSelf,
57- VarDecl* prop, SILValue value) {
57+ VarDecl* prop, SILValue value,
58+ IsTake_t isTake) {
5859 Type formalType = SGF.F .mapTypeIntoContext (prop->getInterfaceType ());
5960 SILType loweredType = SGF.getLoweredType (formalType);
6061
6162 auto fieldAddr = emitActorPropertyReference (SGF, loc, actorSelf, prop);
6263
6364 if (loweredType.isAddressOnly (SGF.F )) {
64- SGF.B .createCopyAddr (loc, value, fieldAddr, IsNotTake , IsInitialization);
65+ SGF.B .createCopyAddr (loc, value, fieldAddr, isTake , IsInitialization);
6566 } else {
6667 if (value->getType ().isAddress ()) {
6768 SGF.emitSemanticLoadInto (loc, value, SGF.F .getTypeLowering (value->getType ()),
68- fieldAddr, SGF.getTypeLowering (loweredType), IsTake , IsInitialization);
69+ fieldAddr, SGF.getTypeLowering (loweredType), isTake , IsInitialization);
6970 } else {
7071 value = SGF.B .emitCopyValueOperation (loc, value);
7172 SGF.B .emitStoreValueOperation (
@@ -152,10 +153,10 @@ static SILArgument *findFirstDistributedActorSystemArg(SILFunction &F) {
152153// / For the initialization of a local distributed actor instance, emits code to
153154// / initialize the instance's stored property corresponding to the system.
154155static void emitActorSystemInit (SILGenFunction &SGF,
155- ConstructorDecl *ctor,
156- SILLocation loc,
157- ManagedValue actorSelf,
158- SILValue systemValue) {
156+ ConstructorDecl *ctor,
157+ SILLocation loc,
158+ ManagedValue actorSelf,
159+ SILValue systemValue) {
159160 assert (ctor->isImplicit () && " unexpected explicit dist actor init" );
160161 assert (ctor->isDesignatedInit ());
161162
@@ -166,9 +167,8 @@ static void emitActorSystemInit(SILGenFunction &SGF,
166167 // exactly one ActorSystem-conforming argument to the constructor,
167168 // so we grab the first one from the params.
168169 VarDecl *var = classDecl->getDistributedActorSystemProperty ();
169- assert (var);
170-
171- initializeProperty (SGF, loc, actorSelf.getValue (), var, systemValue);
170+
171+ initializeProperty (SGF, loc, actorSelf.getValue (), var, systemValue, IsNotTake);
172172}
173173
174174// / Emits the distributed actor's identity (`id`) initialization.
@@ -209,7 +209,7 @@ void SILGenFunction::emitDistActorIdentityInit(ConstructorDecl *ctor,
209209 { temp, selfMetatypeValue });
210210
211211 // --- initialize the property.
212- initializeProperty (*this , loc, borrowedSelfArg, var, temp);
212+ initializeProperty (*this , loc, borrowedSelfArg, var, temp, IsTake );
213213}
214214
215215// TODO(distributed): rename to DistributedActorID
@@ -443,14 +443,16 @@ void SILGenFunction::emitDistributedActorFactory(FuncDecl *fd) { // TODO(distrib
443443 loc.markAutoGenerated ();
444444 auto *dc = fd->getDeclContext ();
445445 auto classDecl = dc->getSelfClassDecl ();
446-
446+
447447 initializeProperty (*this , loc, remote,
448448 classDecl->getDistributedActorIDProperty (),
449- idArg);
449+ idArg,
450+ IsNotTake);
450451
451452 initializeProperty (*this , loc, remote,
452453 classDecl->getDistributedActorSystemProperty (),
453- actorSystemArg);
454+ actorSystemArg,
455+ IsNotTake);
454456
455457 // ==== Branch to return the fully initialized remote instance
456458 B.createBranch (loc, returnBB, {remote});
0 commit comments