Skip to content

Commit 3c29997

Browse files
committed
[region-isolation] Out of an abundance of caution convert isActor -> isAnyActor().
1 parent fa20e52 commit 3c29997

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
@@ -917,8 +917,16 @@ class SILType {
917917

918918
bool isMarkedAsImmortal() const;
919919

920+
/// Returns true if this type is an actor type. Returns false if this is any
921+
/// other type. This includes distributed actors. To check for distributed
922+
/// actors and actors, use isAnyActor().
920923
bool isActor() const { return getASTType()->isActorType(); }
921924

925+
bool isDistributedActor() const { return getASTType()->isDistributedActor(); }
926+
927+
/// Returns true if this type is an actor or a distributed actor.
928+
bool isAnyActor() const { return getASTType()->isAnyActorType(); }
929+
922930
/// Returns true if this function conforms to the Sendable protocol.
923931
bool isSendable(SILFunction *fn) const;
924932

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)