@@ -124,7 +124,8 @@ struct UseDefChainVisitor
124
124
// If this is a type case, see if the result of the cast is sendable. In
125
125
// such a case, we do not want to look through this cast.
126
126
if (castType == AccessStorageCast::Type &&
127
- !isNonSendableType (cast->getType (), cast->getFunction ()))
127
+ !SILIsolationInfo::isNonSendableType (cast->getType (),
128
+ cast->getFunction ()))
128
129
return SILValue ();
129
130
130
131
// If we do not have an identity cast, mark this as a merge.
@@ -160,7 +161,8 @@ struct UseDefChainVisitor
160
161
161
162
// See if our operand type is a sendable type. In such a case, we do not
162
163
// want to look through our operand.
163
- if (!isNonSendableType (op->getType (), op->getFunction ()))
164
+ if (!SILIsolationInfo::isNonSendableType (op->getType (),
165
+ op->getFunction ()))
164
166
return SILValue ();
165
167
166
168
break ;
@@ -169,7 +171,8 @@ struct UseDefChainVisitor
169
171
// These are merges if we have multiple fields.
170
172
auto op = cast<TupleElementAddrInst>(inst)->getOperand ();
171
173
172
- if (!isNonSendableType (op->getType (), op->getFunction ()))
174
+ if (!SILIsolationInfo::isNonSendableType (op->getType (),
175
+ op->getFunction ()))
173
176
return SILValue ();
174
177
175
178
isMerge |= op->getType ().getNumTupleElements () > 1 ;
@@ -183,7 +186,8 @@ struct UseDefChainVisitor
183
186
// identify the sendable type with the non-sendable operand. These we
184
187
// are always going to ignore anyways since a sendable let/var field of
185
188
// a struct can always be used.
186
- if (!isNonSendableType (op->getType (), op->getFunction ()))
189
+ if (!SILIsolationInfo::isNonSendableType (op->getType (),
190
+ op->getFunction ()))
187
191
return SILValue ();
188
192
189
193
// These are merges if we have multiple fields.
@@ -314,21 +318,23 @@ static SILValue getUnderlyingTrackedObjectValue(SILValue value) {
314
318
// If we have a cast and our operand and result are non-Sendable, treat it
315
319
// as a look through.
316
320
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)) {
319
324
temp = svi->getOperand (0 );
320
325
}
321
326
}
322
327
323
328
if (isLookThroughIfResultNonSendable (svi)) {
324
- if (isNonSendableType (svi->getType (), fn)) {
329
+ if (SILIsolationInfo:: isNonSendableType (svi->getType (), fn)) {
325
330
temp = svi->getOperand (0 );
326
331
}
327
332
}
328
333
329
334
if (isLookThroughIfOperandNonSendable (svi)) {
330
335
// 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)) {
332
338
temp = svi->getOperand (0 );
333
339
}
334
340
}
@@ -1464,7 +1470,7 @@ class PartitionOpTranslator {
1464
1470
// / NOTE: We special case RawPointer and NativeObject to ensure they are
1465
1471
// / treated as non-Sendable and strict checking is applied to it.
1466
1472
bool isNonSendableType (SILType type) const {
1467
- return ::isNonSendableType (type, function);
1473
+ return SILIsolationInfo ::isNonSendableType (type, function);
1468
1474
}
1469
1475
1470
1476
TrackableValue
@@ -2221,7 +2227,8 @@ class PartitionOpTranslator {
2221
2227
case TranslationSemantics::AssertingIfNonSendable:
2222
2228
// Do not error if all of our operands are sendable.
2223
2229
if (llvm::none_of (inst->getOperandValues (), [&](SILValue value) {
2224
- return ::isNonSendableType (value->getType (), inst->getFunction ());
2230
+ return ::SILIsolationInfo::isNonSendableType (value->getType (),
2231
+ inst->getFunction ());
2225
2232
}))
2226
2233
return ;
2227
2234
llvm::errs () << " BadInst: " << *inst;
@@ -3241,11 +3248,18 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
3241
3248
// If we were able to find this was actor isolated from finding our
3242
3249
// underlying object, use that. It is never wrong.
3243
3250
if (info.actorIsolation ) {
3244
- SILValue actorInstance =
3245
- info.value ->getType ().isAnyActor () ? info.value : SILValue ();
3246
- iter.first ->getSecond ().mergeIsolationRegionInfo (
3247
- SILIsolationInfo::getActorIsolated (value, actorInstance,
3248
- *info.actorIsolation ));
3251
+ SILIsolationInfo isolation;
3252
+ if (info.value ->getType ().isAnyActor ()) {
3253
+ isolation = SILIsolationInfo::getActorInstanceIsolated (
3254
+ value, info.value , info.actorIsolation ->getActor ());
3255
+ } else if (info.actorIsolation ->isGlobalActor ()) {
3256
+ isolation = SILIsolationInfo::getGlobalActorIsolated (
3257
+ value, info.actorIsolation ->getGlobalActor ());
3258
+ }
3259
+
3260
+ if (isolation) {
3261
+ iter.first ->getSecond ().mergeIsolationRegionInfo (isolation);
3262
+ }
3249
3263
}
3250
3264
3251
3265
auto storage = AccessStorageWithBase::compute (value);
@@ -3277,7 +3291,7 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
3277
3291
}
3278
3292
3279
3293
// Otherwise refer to the oracle. If we have a Sendable value, just return.
3280
- if (!isNonSendableType (value->getType (), fn)) {
3294
+ if (!SILIsolationInfo:: isNonSendableType (value->getType (), fn)) {
3281
3295
iter.first ->getSecond ().addFlag (TrackableValueFlag::isSendable);
3282
3296
return {iter.first ->first , iter.first ->second };
3283
3297
}
@@ -3295,8 +3309,9 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
3295
3309
auto parentAddrInfo = getUnderlyingTrackedValue (svi);
3296
3310
if (parentAddrInfo.actorIsolation ) {
3297
3311
iter.first ->getSecond ().mergeIsolationRegionInfo (
3298
- SILIsolationInfo::getActorIsolated (svi, parentAddrInfo.value ,
3299
- *parentAddrInfo.actorIsolation ));
3312
+ SILIsolationInfo::getActorInstanceIsolated (
3313
+ svi, parentAddrInfo.value ,
3314
+ parentAddrInfo.actorIsolation ->getActor ()));
3300
3315
}
3301
3316
3302
3317
auto storage = AccessStorageWithBase::compute (svi->getOperand (0 ));
0 commit comments