Skip to content

Commit 47afd21

Browse files
committed
[Concurrency] Remove ActorIsolation::GlobalActorUnsafe.
1 parent f581eb7 commit 47afd21

16 files changed

+10
-63
lines changed

include/swift/AST/ActorIsolation.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ class ActorIsolation {
6666
/// The declaration is isolated to a global actor. It can refer to other
6767
/// entities with the same global actor.
6868
GlobalActor,
69-
/// The declaration is isolated to a global actor but with the "unsafe"
70-
/// annotation, which means that we only enforce the isolation if we're
71-
/// coming from something with specific isolation.
72-
GlobalActorUnsafe,
7369
};
7470

7571
private:
@@ -139,7 +135,7 @@ class ActorIsolation {
139135
.Case("global_actor",
140136
std::optional<ActorIsolation>(ActorIsolation::GlobalActor))
141137
.Case("global_actor_unsafe", std::optional<ActorIsolation>(
142-
ActorIsolation::GlobalActorUnsafe))
138+
ActorIsolation::GlobalActor))
143139
.Default(std::nullopt);
144140
if (kind == std::nullopt)
145141
return std::nullopt;
@@ -170,7 +166,6 @@ class ActorIsolation {
170166
switch (getKind()) {
171167
case ActorInstance:
172168
case GlobalActor:
173-
case GlobalActorUnsafe:
174169
return true;
175170

176171
case Unspecified:
@@ -185,7 +180,7 @@ class ActorIsolation {
185180
VarDecl *getActorInstance() const;
186181

187182
bool isGlobalActor() const {
188-
return getKind() == GlobalActor || getKind() == GlobalActorUnsafe;
183+
return getKind() == GlobalActor;
189184
}
190185

191186
bool isMainActor() const;
@@ -237,7 +232,6 @@ class ActorIsolation {
237232
lhs.parameterIndex == rhs.parameterIndex);
238233

239234
case GlobalActor:
240-
case GlobalActorUnsafe:
241235
llvm_unreachable("Global actors handled above");
242236
}
243237
}
@@ -270,9 +264,6 @@ class ActorIsolation {
270264
case GlobalActor:
271265
os << "global_actor";
272266
return;
273-
case GlobalActorUnsafe:
274-
os << "global_actor_unsafe";
275-
return;
276267
}
277268
llvm_unreachable("Covered switch isn't covered?!");
278269
}

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2789,7 +2789,6 @@ class PrintExpr : public ExprVisitor<PrintExpr, void, StringRef>,
27892789
break;
27902790

27912791
case ActorIsolation::GlobalActor:
2792-
case ActorIsolation::GlobalActorUnsafe:
27932792
printFieldQuoted(isolation.getGlobalActor().getString(),
27942793
"global_actor_isolated", CapturesColor);
27952794
break;

lib/AST/Decl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,6 @@ static bool deferMatchesEnclosingAccess(const FuncDecl *defer) {
25182518
case ActorIsolation::NonisolatedUnsafe:
25192519
break;
25202520

2521-
case ActorIsolation::GlobalActorUnsafe:
25222521
case ActorIsolation::GlobalActor:
25232522
if (isolation.preconcurrency())
25242523
break;
@@ -10903,7 +10902,6 @@ bool VarDecl::isSelfParamCaptureIsolated() const {
1090310902
case ActorIsolation::Nonisolated:
1090410903
case ActorIsolation::NonisolatedUnsafe:
1090510904
case ActorIsolation::GlobalActor:
10906-
case ActorIsolation::GlobalActorUnsafe:
1090710905
return false;
1090810906

1090910907
case ActorIsolation::ActorInstance:

lib/AST/DiagnosticEngine.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,7 @@ static void formatDiagnosticArgument(StringRef Modifier,
910910
Out << "actor-isolated";
911911
break;
912912

913-
case ActorIsolation::GlobalActor:
914-
case ActorIsolation::GlobalActorUnsafe: {
913+
case ActorIsolation::GlobalActor: {
915914
if (isolation.isMainActor()) {
916915
Out << "main actor-isolated";
917916
} else {

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,6 @@ bool ActorIsolation::requiresSubstitution() const {
16631663
return false;
16641664

16651665
case GlobalActor:
1666-
case GlobalActorUnsafe:
16671666
return getGlobalActor()->hasTypeParameter();
16681667
}
16691668
llvm_unreachable("unhandled actor isolation kind!");
@@ -1678,7 +1677,6 @@ ActorIsolation ActorIsolation::subst(SubstitutionMap subs) const {
16781677
return *this;
16791678

16801679
case GlobalActor:
1681-
case GlobalActorUnsafe:
16821680
return forGlobalActor(getGlobalActor().subst(subs))
16831681
.withPreconcurrency(preconcurrency());
16841682
}
@@ -1717,7 +1715,6 @@ void swift::simple_display(
17171715
break;
17181716

17191717
case ActorIsolation::GlobalActor:
1720-
case ActorIsolation::GlobalActorUnsafe:
17211718
out << "actor-isolated to global actor ";
17221719
if (state.isSILParsed()) {
17231720
out << "SILPARSED";

lib/IDE/CompletionLookup.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ void CompletionLookup::analyzeActorIsolation(
767767
}
768768
break;
769769
}
770-
case ActorIsolation::GlobalActorUnsafe:
771770
case ActorIsolation::GlobalActor: {
772771
// For "preconcurrency" global actor isolation, automatic 'async' only happens
773772
// if the context has adopted concurrency.

lib/SILGen/SILGenApply.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3051,7 +3051,6 @@ static void emitDelayedArguments(SILGenFunction &SGF,
30513051
SILValue executor;
30523052
switch (*defaultArgIsolation) {
30533053
case ActorIsolation::GlobalActor:
3054-
case ActorIsolation::GlobalActorUnsafe:
30553054
executor = SGF.emitLoadGlobalActorExecutor(
30563055
defaultArgIsolation->getGlobalActor());
30573056
break;
@@ -5630,7 +5629,6 @@ RValue SILGenFunction::emitApply(
56305629
break;
56315630

56325631
case ActorIsolation::GlobalActor:
5633-
case ActorIsolation::GlobalActorUnsafe:
56345632
executor = emitLoadGlobalActorExecutor(
56355633
implicitActorHopTarget->getGlobalActor());
56365634
break;

lib/SILGen/SILGenConstructor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ static bool ctorHopsInjectedByDefiniteInit(ConstructorDecl *ctor,
611611
case ActorIsolation::Nonisolated:
612612
case ActorIsolation::NonisolatedUnsafe:
613613
case ActorIsolation::GlobalActor:
614-
case ActorIsolation::GlobalActorUnsafe:
615614
return false;
616615
}
617616
}
@@ -1582,7 +1581,6 @@ void SILGenFunction::emitMemberInitializer(DeclContext *dc, VarDecl *selfDecl,
15821581
break;
15831582

15841583
case ActorIsolation::GlobalActor:
1585-
case ActorIsolation::GlobalActorUnsafe:
15861584
case ActorIsolation::ActorInstance: {
15871585
if (requiredIsolation != contextIsolation) {
15881586
// Implicit initializers diagnose actor isolation violations

lib/SILGen/SILGenProlog.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,6 @@ void SILGenFunction::emitProlog(
12741274
return true;
12751275

12761276
case ActorIsolation::GlobalActor:
1277-
case ActorIsolation::GlobalActorUnsafe:
12781277
// Global-actor-isolated types should likely have deinits that
12791278
// are not themselves actor-isolated, yet still have access to
12801279
// the instance properties of the class.
@@ -1373,7 +1372,6 @@ void SILGenFunction::emitProlog(
13731372
}
13741373

13751374
case ActorIsolation::GlobalActor:
1376-
case ActorIsolation::GlobalActorUnsafe:
13771375
if (F.isAsync() || wantDataRaceChecks) {
13781376
ExpectedExecutor =
13791377
emitLoadGlobalActorExecutor(actorIsolation.getGlobalActor());
@@ -1397,7 +1395,6 @@ void SILGenFunction::emitProlog(
13971395
}
13981396

13991397
case ActorIsolation::GlobalActor:
1400-
case ActorIsolation::GlobalActorUnsafe:
14011398
if (wantExecutor) {
14021399
ExpectedExecutor =
14031400
emitLoadGlobalActorExecutor(actorIsolation.getGlobalActor());
@@ -1553,7 +1550,6 @@ SILGenFunction::emitExecutor(SILLocation loc, ActorIsolation isolation,
15531550
}
15541551

15551552
case ActorIsolation::GlobalActor:
1556-
case ActorIsolation::GlobalActorUnsafe:
15571553
return emitLoadGlobalActorExecutor(isolation.getGlobalActor());
15581554
}
15591555
llvm_unreachable("covered switch");

lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,6 @@ void LifetimeChecker::injectActorHops() {
10471047
case ActorIsolation::Unspecified:
10481048
case ActorIsolation::Nonisolated:
10491049
case ActorIsolation::NonisolatedUnsafe:
1050-
case ActorIsolation::GlobalActorUnsafe:
10511050
case ActorIsolation::GlobalActor:
10521051
return;
10531052
}

0 commit comments

Comments
 (0)