Skip to content

Commit 8255539

Browse files
Added checks for mangled names for isolated deinits
1 parent 952d4af commit 8255539

File tree

3 files changed

+156
-10
lines changed

3 files changed

+156
-10
lines changed

lib/SILGen/SILGen.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -729,11 +729,18 @@ SILFunction *SILGenModule::getFunction(SILDeclRef constant,
729729
return IGM.getFunction(constant, NotForDefinition);
730730
});
731731

732-
// If we have global actor isolation for our constant, put the isolation onto
733-
// the function.
734-
if (auto isolation =
735-
getActorIsolationOfContext(constant.getInnermostDeclContext())) {
736-
F->setActorIsolation(isolation);
732+
if (constant.kind == SILDeclRef::Kind::Deallocator) {
733+
// Deallocating destructor is always nonisolated.
734+
// Isolation of the deinit applies only to isolated deallocator and
735+
// destroyer.
736+
F->setActorIsolation(ActorIsolation::forNonisolated(false));
737+
} else {
738+
// If we have global actor isolation for our constant, put the isolation
739+
// onto the function.
740+
if (auto isolation =
741+
getActorIsolationOfContext(constant.getInnermostDeclContext())) {
742+
F->setActorIsolation(isolation);
743+
}
737744
}
738745

739746
assert(F && "SILFunction should have been defined");
@@ -1231,11 +1238,18 @@ void SILGenModule::preEmitFunction(SILDeclRef constant, SILFunction *F,
12311238
F->setGenericEnvironment(genericEnv, capturedEnvs, forwardingSubs);
12321239
}
12331240

1234-
// If we have global actor isolation for our constant, put the isolation onto
1235-
// the function.
1236-
if (auto isolation =
1237-
getActorIsolationOfContext(constant.getInnermostDeclContext())) {
1238-
F->setActorIsolation(isolation);
1241+
if (constant.kind == SILDeclRef::Kind::Deallocator) {
1242+
// Deallocating destructor is always nonisolated.
1243+
// Isolation of the deinit applies only to isolated deallocator and
1244+
// destroyer.
1245+
F->setActorIsolation(ActorIsolation::forNonisolated(false));
1246+
} else {
1247+
// If we have global actor isolation for our constant, put the isolation
1248+
// onto the function.
1249+
if (auto isolation =
1250+
getActorIsolationOfContext(constant.getInnermostDeclContext())) {
1251+
F->setActorIsolation(isolation);
1252+
}
12391253
}
12401254

12411255
// Create a debug scope for the function using astNode as source location.

0 commit comments

Comments
 (0)