Skip to content

Commit 65fb35c

Browse files
committed
Revert "Convert ActorIsolationRequest to use split caching"
There are a few spots in `ActorIsolationRequest` that produce `unspecified` isolation with `preconcurrency` bit set and diagnostics rely on that to make downgrade decisions in Swift 5 mode. This reverts commit 0097ef6.
1 parent f7d3230 commit 65fb35c

File tree

4 files changed

+4
-32
lines changed

4 files changed

+4
-32
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2828,10 +2828,6 @@ class ValueDecl : public Decl {
28282828
/// optional result.
28292829
unsigned isIUO : 1;
28302830

2831-
/// Whether we're in the common case where the ActorIsolationRequest
2832-
/// request returned ActorIsolation::forUnspecified().
2833-
unsigned noActorIsolation : 1;
2834-
28352831
/// Whether we've evaluated the ApplyAccessNoteRequest.
28362832
unsigned accessNoteApplied : 1;
28372833
} LazySemanticInfo = { };
@@ -2847,6 +2843,7 @@ class ValueDecl : public Decl {
28472843
friend class ActorIsolationRequest;
28482844
friend class DynamicallyReplacedDeclRequest;
28492845
friend class ApplyAccessNoteRequest;
2846+
28502847
friend class Decl;
28512848
SourceLoc getLocFromSource() const { return NameLoc; }
28522849
protected:

include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,8 +1537,7 @@ class GlobalActorAttributeRequest
15371537
class ActorIsolationRequest :
15381538
public SimpleRequest<ActorIsolationRequest,
15391539
ActorIsolation(ValueDecl *),
1540-
RequestFlags::SeparatelyCached |
1541-
RequestFlags::SplitCached> {
1540+
RequestFlags::Cached> {
15421541
public:
15431542
using SimpleRequest::SimpleRequest;
15441543

@@ -1548,10 +1547,8 @@ class ActorIsolationRequest :
15481547
ActorIsolation evaluate(Evaluator &evaluator, ValueDecl *value) const;
15491548

15501549
public:
1551-
// Separate.
1550+
// Caching
15521551
bool isCached() const { return true; }
1553-
std::optional<ActorIsolation> getCachedResult() const;
1554-
void cacheResult(ActorIsolation value) const;
15551552
};
15561553

15571554
/// Determine whether the given function should have an isolated 'self'.

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ SWIFT_REQUEST(TypeChecker, GlobalActorAttributeRequest,
178178
SeparatelyCached | SplitCached, NoLocationInfo)
179179
SWIFT_REQUEST(TypeChecker, ActorIsolationRequest,
180180
ActorIsolationState(ValueDecl *),
181-
SeparatelyCached | SplitCached, NoLocationInfo)
181+
Cached, NoLocationInfo)
182182
SWIFT_REQUEST(TypeChecker, HasIsolatedSelfRequest,
183183
bool(ValueDecl *),
184184
Uncached, NoLocationInfo)

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,28 +2013,6 @@ GlobalActorAttributeRequest::cacheResult(std::optional<CustomAttrNominalPair> va
20132013
}
20142014
}
20152015

2016-
//----------------------------------------------------------------------------//
2017-
// ActorIsolationRequest computation.
2018-
//----------------------------------------------------------------------------//
2019-
2020-
std::optional<ActorIsolation> ActorIsolationRequest::getCachedResult() const {
2021-
auto *decl = std::get<0>(getStorage());
2022-
if (decl->LazySemanticInfo.noActorIsolation)
2023-
return ActorIsolation::forUnspecified();
2024-
2025-
return decl->getASTContext().evaluator.getCachedNonEmptyOutput(*this);
2026-
}
2027-
2028-
void ActorIsolationRequest::cacheResult(ActorIsolation value) const {
2029-
auto *decl = std::get<0>(getStorage());
2030-
if (value.isUnspecified()) {
2031-
decl->LazySemanticInfo.noActorIsolation = 1;
2032-
return;
2033-
}
2034-
2035-
decl->getASTContext().evaluator.cacheNonEmptyOutput(*this, std::move(value));
2036-
}
2037-
20382016
//----------------------------------------------------------------------------//
20392017
// ResolveMacroRequest computation.
20402018
//----------------------------------------------------------------------------//

0 commit comments

Comments
 (0)