Skip to content

Commit de871af

Browse files
committed
[region-isolation] Out of an abundance of caution convert isActor -> isAnyActor().
(cherry picked from commit 3c29997)
1 parent 99af2d7 commit de871af

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

include/swift/SIL/SILType.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,16 @@ class SILType {
911911

912912
bool isMarkedAsImmortal() const;
913913

914+
/// Returns true if this type is an actor type. Returns false if this is any
915+
/// other type. This includes distributed actors. To check for distributed
916+
/// actors and actors, use isAnyActor().
914917
bool isActor() const { return getASTType()->isActorType(); }
915918

919+
bool isDistributedActor() const { return getASTType()->isDistributedActor(); }
920+
921+
/// Returns true if this type is an actor or a distributed actor.
922+
bool isAnyActor() const { return getASTType()->isAnyActorType(); }
923+
916924
/// Returns true if this function conforms to the Sendable protocol.
917925
bool isSendable(SILFunction *fn) const;
918926

include/swift/SILOptimizer/Utils/PartitionUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class SILIsolationInfo {
130130
isolatedValue(isolatedValue), actorInstance(actorInstance) {
131131
assert((!actorInstance ||
132132
(actorIsolation.getKind() == ActorIsolation::ActorInstance &&
133-
actorInstance->getType().isActor())) &&
133+
actorInstance->getType().isAnyActor())) &&
134134
"actorInstance must be an actor if it is non-empty");
135135
}
136136

@@ -211,7 +211,7 @@ class SILIsolationInfo {
211211
static SILIsolationInfo getActorIsolated(SILValue isolatedValue,
212212
SILValue actorInstance,
213213
NominalTypeDecl *typeDecl) {
214-
if (typeDecl->isActor())
214+
if (typeDecl->isAnyActor())
215215
return {ActorIsolation::forActorInstanceSelf(typeDecl), isolatedValue,
216216
actorInstance};
217217
auto isolation = swift::getActorIsolation(typeDecl);

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3262,7 +3262,7 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
32623262
// underlying object, use that. It is never wrong.
32633263
if (info.actorIsolation) {
32643264
SILValue actorInstance =
3265-
info.value->getType().isActor() ? info.value : SILValue();
3265+
info.value->getType().isAnyActor() ? info.value : SILValue();
32663266
iter.first->getSecond().mergeIsolationRegionInfo(
32673267
SILIsolationInfo::getActorIsolated(value, actorInstance,
32683268
*info.actorIsolation));

lib/SILOptimizer/Utils/PartitionUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ SILIsolationInfo SILIsolationInfo::get(SILInstruction *inst) {
122122
auto *nomDecl =
123123
rei->getOperand()->getType().getNominalOrBoundGenericNominal();
124124
SILValue actorInstance =
125-
nomDecl->isActor() ? rei->getOperand() : SILValue();
125+
nomDecl->isAnyActor() ? rei->getOperand() : SILValue();
126126
return SILIsolationInfo::getActorIsolated(rei, actorInstance, nomDecl);
127127
}
128128

@@ -181,7 +181,7 @@ SILIsolationInfo SILIsolationInfo::get(SILInstruction *inst) {
181181
if (isolation.isActorIsolated() &&
182182
(isolation.getKind() != ActorIsolation::ActorInstance ||
183183
isolation.getActorInstanceParameter() == 0)) {
184-
auto actor = cmi->getOperand()->getType().isActor()
184+
auto actor = cmi->getOperand()->getType().isAnyActor()
185185
? cmi->getOperand()
186186
: SILValue();
187187
return SILIsolationInfo::getActorIsolated(cmi, actor, isolation);

0 commit comments

Comments
 (0)