Skip to content

Commit a5bd7a2

Browse files
committed
[region-isolation] Use SILRegionInfo::get to compute actor isolation of non-isolation crossing apply.
1 parent dd0dd04 commit a5bd7a2

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,21 +1827,6 @@ class PartitionOpTranslator {
18271827
}
18281828

18291829
void translateNonIsolationCrossingSILApply(FullApplySite fas) {
1830-
SILIsolationInfo isolationInfo;
1831-
1832-
// If self is an actor and we are isolated to it, propagate actor self.
1833-
if (fas.hasSelfArgument()) {
1834-
auto &self = fas.getSelfArgumentOperand();
1835-
if (fas.getArgumentParameterInfo(self).hasOption(
1836-
SILParameterInfo::Isolated)) {
1837-
if (auto *nomDecl =
1838-
self.get()->getType().getNominalOrBoundGenericNominal()) {
1839-
// First try to see if this nom decl is isolated to an actor.
1840-
isolationInfo = SILIsolationInfo::getActorIsolated(nomDecl);
1841-
}
1842-
}
1843-
}
1844-
18451830
// For non-self parameters, gather all of the transferring parameters and
18461831
// gather our non-transferring parameters.
18471832
SmallVector<SILValue, 8> nonTransferringParameters;
@@ -1883,6 +1868,7 @@ class PartitionOpTranslator {
18831868
getApplyResults(*fas, applyResults);
18841869

18851870
auto type = fas.getSubstCalleeSILType().castTo<SILFunctionType>();
1871+
auto isolationInfo = SILIsolationInfo::get(*fas);
18861872

18871873
// If our result is not transferring, just do the normal multi-assign.
18881874
if (!type->hasTransferringResult()) {

lib/SILOptimizer/Utils/PartitionUtils.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ SILIsolationInfo SILIsolationInfo::get(SILInstruction *inst) {
4848
if (auto fas = FullApplySite::isa(inst)) {
4949
if (auto crossing = fas.getIsolationCrossing())
5050
return SILIsolationInfo::getActorIsolated(crossing->getCalleeIsolation());
51+
52+
if (fas.hasSelfArgument()) {
53+
auto &self = fas.getSelfArgumentOperand();
54+
if (fas.getArgumentParameterInfo(self).hasOption(
55+
SILParameterInfo::Isolated)) {
56+
if (auto *nomDecl =
57+
self.get()->getType().getNominalOrBoundGenericNominal()) {
58+
// TODO: We should be doing this off of the instance... what if we
59+
// have two instances of the same class?
60+
return SILIsolationInfo::getActorIsolated(nomDecl);
61+
}
62+
}
63+
}
5164
}
5265

5366
if (auto *pai = dyn_cast<PartialApplyInst>(inst)) {

0 commit comments

Comments
 (0)