@@ -53,10 +53,16 @@ class ActorInstance {
5353 // / function)... so we just use an artificial ActorInstance to represent
5454 // / self in this case.
5555 CapturedActorSelf = 0x2 ,
56+
57+ // / An actor instance in an async allocating init where we are going to
58+ // / allocate the actual actor internally. This is considered to be isolated
59+ // / to the actor instance.
60+ ActorAsyncAllocatingInit = 0x3 ,
5661 };
5762
58- // / Set to (SILValue(), $KIND) if we have an ActorAccessorInit|CapturedSelf.
59- // / Is null if we have (SILValue(), Kind::Value).
63+ // / Set to (SILValue(), $KIND) if we have an
64+ // / ActorAccessorInit|CapturedSelf|ActorAsyncAllocatingInit. Is null if we
65+ // / have (SILValue(), Kind::Value).
6066 llvm::PointerIntPair<SILValue, 2 > value;
6167
6268 ActorInstance (SILValue value, Kind kind)
@@ -94,6 +100,12 @@ class ActorInstance {
94100 return ActorInstance (SILValue (), Kind::CapturedActorSelf);
95101 }
96102
103+ // / See Kind::ActorAsyncAllocatingInit for explanation on what a
104+ // / ActorAsyncAllocatingInit is.
105+ static ActorInstance getForActorAsyncAllocatingInit () {
106+ return ActorInstance (SILValue (), Kind::ActorAsyncAllocatingInit);
107+ }
108+
97109 explicit operator bool () const { return bool (value.getOpaqueValue ()); }
98110
99111 Kind getKind () const { return Kind (value.getInt ()); }
@@ -117,6 +129,10 @@ class ActorInstance {
117129 return getKind () == Kind::CapturedActorSelf;
118130 }
119131
132+ bool isActorAsyncAllocatingInit () const {
133+ return getKind () == Kind::ActorAsyncAllocatingInit;
134+ }
135+
120136 bool operator ==(const ActorInstance &other) const {
121137 // If both are null, return true.
122138 if (!bool (*this ) && !bool (other))
@@ -132,6 +148,7 @@ class ActorInstance {
132148 return getValue () == other.getValue ();
133149 case Kind::ActorAccessorInit:
134150 case Kind::CapturedActorSelf:
151+ case Kind::ActorAsyncAllocatingInit:
135152 return true ;
136153 }
137154 }
0 commit comments