Skip to content

Commit 44e1e54

Browse files
authored
Merge pull request #69787 from gottesmm/region-isolation-track-consumption-separately
[region-isolation] Track elements -> regions and regions -> consuming separately.
2 parents cf73629 + c5259ad commit 44e1e54

File tree

9 files changed

+512
-353
lines changed

9 files changed

+512
-353
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ WARNING(transfer_yields_race, none,
883883
"non-sendable value sent across isolation domains that could be concurrently accessed later in this function (%0 access site%select{|s}1 displayed%select{|, %3 more hidden}2)",
884884
(unsigned, bool, bool, unsigned))
885885
WARNING(call_site_transfer_yields_race, none,
886-
"passing argument of non-sendable type %0 from %1 context to %2 context at this call site could yield a race with accesses later in this function (%3 access site%select{|s}4 displayed%select{|, %6 more hidden}5)",
887-
(Type, ActorIsolation, ActorIsolation, unsigned, bool, bool, unsigned))
886+
"passing argument of non-sendable type %0 from %1 context to %2 context at this call site could yield a race with accesses later in this function",
887+
(Type, ActorIsolation, ActorIsolation))
888888
NOTE(possible_racy_access_site, none,
889889
"access here could race", ())
890890

include/swift/SIL/ApplySite.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,21 @@ class ApplySite {
485485
llvm_unreachable("covered switch");
486486
}
487487

488+
/// Return a list of applied operands of the apply without self.
489+
ArrayRef<Operand> getOperandsWithoutSelf() const {
490+
switch (ApplySiteKind(Inst->getKind())) {
491+
case ApplySiteKind::ApplyInst:
492+
return cast<ApplyInst>(Inst)->getOperandsWithoutSelf();
493+
case ApplySiteKind::BeginApplyInst:
494+
return cast<BeginApplyInst>(Inst)->getOperandsWithoutSelf();
495+
case ApplySiteKind::TryApplyInst:
496+
return cast<TryApplyInst>(Inst)->getOperandsWithoutSelf();
497+
case ApplySiteKind::PartialApplyInst:
498+
llvm_unreachable("Unhandled case");
499+
}
500+
llvm_unreachable("covered switch");
501+
}
502+
488503
/// Returns true if \p op is an operand that passes an indirect
489504
/// result argument to the apply site.
490505
bool isIndirectResultOperand(const Operand &op) const;

include/swift/SIL/SILInstruction.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,20 +2877,30 @@ class ApplyInstBase<Impl, Base, true>
28772877
void setSelfArgument(SILValue V) {
28782878
assert(hasSelfArgument() && "Must have a self argument");
28792879
assert(getNumArguments() && "Should only be called when Callee has "
2880-
"arguments.");
2880+
"arguments.");
28812881
getArgumentOperands()[getNumArguments() - 1].set(V);
28822882
}
28832883

28842884
OperandValueArrayRef getArgumentsWithoutSelf() const {
2885-
assert(hasSelfArgument() && "Must have a self argument");
28862885
assert(getNumArguments() && "Should only be called when Callee has "
2887-
"at least a self parameter.");
2886+
"at least a self parameter.");
28882887
ArrayRef<Operand> ops = this->getArgumentOperands();
2889-
ArrayRef<Operand> opsWithoutSelf = ArrayRef<Operand>(&ops[0],
2890-
ops.size()-1);
2888+
if (!hasSelfArgument())
2889+
return ops;
2890+
auto opsWithoutSelf = ArrayRef<Operand>(&ops[0], ops.size() - 1);
28912891
return OperandValueArrayRef(opsWithoutSelf);
28922892
}
28932893

2894+
ArrayRef<Operand> getOperandsWithoutSelf() const {
2895+
assert(getNumArguments() && "Should only be called when Callee has "
2896+
"at least a self parameter.");
2897+
ArrayRef<Operand> ops = this->getArgumentOperands();
2898+
if (!hasSelfArgument())
2899+
return ops;
2900+
auto opsWithoutSelf = ArrayRef<Operand>(&ops[0], ops.size() - 1);
2901+
return opsWithoutSelf;
2902+
}
2903+
28942904
llvm::Optional<SILResultInfo> getSingleResult() const {
28952905
auto SubstCallee = getSubstCalleeType();
28962906
if (SubstCallee->getNumResults() != 1)

0 commit comments

Comments
 (0)