@@ -124,7 +124,8 @@ struct UseDefChainVisitor
124124 // If this is a type case, see if the result of the cast is sendable. In
125125 // such a case, we do not want to look through this cast.
126126 if (castType == AccessStorageCast::Type &&
127- !isNonSendableType (cast->getType (), cast->getFunction ()))
127+ !SILIsolationInfo::isNonSendableType (cast->getType (),
128+ cast->getFunction ()))
128129 return SILValue ();
129130
130131 // If we do not have an identity cast, mark this as a merge.
@@ -160,7 +161,8 @@ struct UseDefChainVisitor
160161
161162 // See if our operand type is a sendable type. In such a case, we do not
162163 // want to look through our operand.
163- if (!isNonSendableType (op->getType (), op->getFunction ()))
164+ if (!SILIsolationInfo::isNonSendableType (op->getType (),
165+ op->getFunction ()))
164166 return SILValue ();
165167
166168 break ;
@@ -169,7 +171,8 @@ struct UseDefChainVisitor
169171 // These are merges if we have multiple fields.
170172 auto op = cast<TupleElementAddrInst>(inst)->getOperand ();
171173
172- if (!isNonSendableType (op->getType (), op->getFunction ()))
174+ if (!SILIsolationInfo::isNonSendableType (op->getType (),
175+ op->getFunction ()))
173176 return SILValue ();
174177
175178 isMerge |= op->getType ().getNumTupleElements () > 1 ;
@@ -183,7 +186,8 @@ struct UseDefChainVisitor
183186 // identify the sendable type with the non-sendable operand. These we
184187 // are always going to ignore anyways since a sendable let/var field of
185188 // a struct can always be used.
186- if (!isNonSendableType (op->getType (), op->getFunction ()))
189+ if (!SILIsolationInfo::isNonSendableType (op->getType (),
190+ op->getFunction ()))
187191 return SILValue ();
188192
189193 // These are merges if we have multiple fields.
@@ -314,21 +318,23 @@ static SILValue getUnderlyingTrackedObjectValue(SILValue value) {
314318 // If we have a cast and our operand and result are non-Sendable, treat it
315319 // as a look through.
316320 if (isLookThroughIfOperandAndResultNonSendable (svi)) {
317- if (isNonSendableType (svi->getType (), fn) &&
318- isNonSendableType (svi->getOperand (0 )->getType (), fn)) {
321+ if (SILIsolationInfo::isNonSendableType (svi->getType (), fn) &&
322+ SILIsolationInfo::isNonSendableType (svi->getOperand (0 )->getType (),
323+ fn)) {
319324 temp = svi->getOperand (0 );
320325 }
321326 }
322327
323328 if (isLookThroughIfResultNonSendable (svi)) {
324- if (isNonSendableType (svi->getType (), fn)) {
329+ if (SILIsolationInfo:: isNonSendableType (svi->getType (), fn)) {
325330 temp = svi->getOperand (0 );
326331 }
327332 }
328333
329334 if (isLookThroughIfOperandNonSendable (svi)) {
330335 // If our operand is a non-Sendable type, look through this instruction.
331- if (isNonSendableType (svi->getOperand (0 )->getType (), fn)) {
336+ if (SILIsolationInfo::isNonSendableType (svi->getOperand (0 )->getType (),
337+ fn)) {
332338 temp = svi->getOperand (0 );
333339 }
334340 }
@@ -1464,7 +1470,7 @@ class PartitionOpTranslator {
14641470 // / NOTE: We special case RawPointer and NativeObject to ensure they are
14651471 // / treated as non-Sendable and strict checking is applied to it.
14661472 bool isNonSendableType (SILType type) const {
1467- return ::isNonSendableType (type, function);
1473+ return SILIsolationInfo ::isNonSendableType (type, function);
14681474 }
14691475
14701476 TrackableValue
@@ -2221,7 +2227,8 @@ class PartitionOpTranslator {
22212227 case TranslationSemantics::AssertingIfNonSendable:
22222228 // Do not error if all of our operands are sendable.
22232229 if (llvm::none_of (inst->getOperandValues (), [&](SILValue value) {
2224- return ::isNonSendableType (value->getType (), inst->getFunction ());
2230+ return ::SILIsolationInfo::isNonSendableType (value->getType (),
2231+ inst->getFunction ());
22252232 }))
22262233 return ;
22272234 llvm::errs () << " BadInst: " << *inst;
@@ -3242,11 +3249,18 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
32423249 // If we were able to find this was actor isolated from finding our
32433250 // underlying object, use that. It is never wrong.
32443251 if (info.actorIsolation ) {
3245- SILValue actorInstance =
3246- info.value ->getType ().isAnyActor () ? info.value : SILValue ();
3247- iter.first ->getSecond ().mergeIsolationRegionInfo (
3248- SILIsolationInfo::getActorIsolated (value, actorInstance,
3249- *info.actorIsolation ));
3252+ SILIsolationInfo isolation;
3253+ if (info.value ->getType ().isAnyActor ()) {
3254+ isolation = SILIsolationInfo::getActorInstanceIsolated (
3255+ value, info.value , info.actorIsolation ->getActor ());
3256+ } else if (info.actorIsolation ->isGlobalActor ()) {
3257+ isolation = SILIsolationInfo::getGlobalActorIsolated (
3258+ value, info.actorIsolation ->getGlobalActor ());
3259+ }
3260+
3261+ if (isolation) {
3262+ iter.first ->getSecond ().mergeIsolationRegionInfo (isolation);
3263+ }
32503264 }
32513265
32523266 auto storage = AccessStorageWithBase::compute (value);
@@ -3278,7 +3292,7 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
32783292 }
32793293
32803294 // Otherwise refer to the oracle. If we have a Sendable value, just return.
3281- if (!isNonSendableType (value->getType (), fn)) {
3295+ if (!SILIsolationInfo:: isNonSendableType (value->getType (), fn)) {
32823296 iter.first ->getSecond ().addFlag (TrackableValueFlag::isSendable);
32833297 return {iter.first ->first , iter.first ->second };
32843298 }
@@ -3296,8 +3310,9 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
32963310 auto parentAddrInfo = getUnderlyingTrackedValue (svi);
32973311 if (parentAddrInfo.actorIsolation ) {
32983312 iter.first ->getSecond ().mergeIsolationRegionInfo (
3299- SILIsolationInfo::getActorIsolated (svi, parentAddrInfo.value ,
3300- *parentAddrInfo.actorIsolation ));
3313+ SILIsolationInfo::getActorInstanceIsolated (
3314+ svi, parentAddrInfo.value ,
3315+ parentAddrInfo.actorIsolation ->getActor ()));
33013316 }
33023317
33033318 auto storage = AccessStorageWithBase::compute (svi->getOperand (0 ));
0 commit comments