Skip to content

Commit 4145ef7

Browse files
committed
Revert "[SIL] Add flag to SILFunction to indicate async."
This reverts commit 6b28c2f.
1 parent 40ec380 commit 4145ef7

File tree

9 files changed

+17
-60
lines changed

9 files changed

+17
-60
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ class SILFunction
274274
/// that it may have unboxed capture (i.e. @inout_aliasable parameters).
275275
unsigned IsWithoutActuallyEscapingThunk : 1;
276276

277-
/// True if this function is an async function.
278-
unsigned IsAsync : 1;
279-
280277
/// If != OptimizationMode::NotSet, the optimization mode specified with an
281278
/// function attribute.
282279
unsigned OptMode : NumOptimizationModeBits;
@@ -504,10 +501,6 @@ class SILFunction
504501
IsWithoutActuallyEscapingThunk = val;
505502
}
506503

507-
bool isAsync() const { return IsAsync; }
508-
509-
void setAsync(bool val = true) { IsAsync = val; }
510-
511504
/// Returns the calling convention used by this entry point.
512505
SILFunctionTypeRepresentation getRepresentation() const {
513506
return getLoweredFunctionType()->getRepresentation();

lib/SIL/IR/SILFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ SILFunction::SILFunction(SILModule &Module, SILLinkage Linkage, StringRef Name,
107107
ExactSelfClass(isExactSelfClass),
108108
Inlined(false), Zombie(false), HasOwnership(true),
109109
WasDeserializedCanonical(false), IsWithoutActuallyEscapingThunk(false),
110-
IsAsync(false), OptMode(unsigned(OptimizationMode::NotSet)),
110+
OptMode(unsigned(OptimizationMode::NotSet)),
111111
EffectsKindAttr(unsigned(E)) {
112112
assert(!Transparent || !IsDynamicReplaceable);
113113
validateSubclassScope(classSubclassScope, isThunk, nullptr);

lib/SIL/IR/SILFunctionBuilder.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,6 @@ SILFunction *SILFunctionBuilder::getOrCreateFunction(
217217
}
218218
addFunctionAttributes(F, decl->getAttrs(), mod, getOrCreateDeclaration,
219219
constant);
220-
221-
if (auto *funcDecl = dyn_cast<AbstractFunctionDecl>(decl)) {
222-
F->setAsync(funcDecl->hasAsync());
223-
}
224220
}
225221

226222
return F;

lib/SIL/IR/SILPrinter.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,9 +2598,6 @@ void SILFunction::print(SILPrintContext &PrintCtx) const {
25982598
if (isWithoutActuallyEscapingThunk())
25992599
OS << "[without_actually_escaping] ";
26002600

2601-
if (isAsync())
2602-
OS << "[async] ";
2603-
26042601
switch (getSpecialPurpose()) {
26052602
case SILFunction::Purpose::None:
26062603
break;

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ static bool parseDeclSILOptional(bool *isTransparent,
919919
bool *isWeakImported,
920920
AvailabilityContext *availability,
921921
bool *isWithoutActuallyEscapingThunk,
922-
bool *isAsync,
923922
SmallVectorImpl<std::string> *Semantics,
924923
SmallVectorImpl<ParsedSpecAttr> *SpecAttrs,
925924
ValueDecl **ClangDecl,
@@ -958,8 +957,6 @@ static bool parseDeclSILOptional(bool *isTransparent,
958957
else if (isWithoutActuallyEscapingThunk
959958
&& SP.P.Tok.getText() == "without_actually_escaping")
960959
*isWithoutActuallyEscapingThunk = true;
961-
else if (isAsync && SP.P.Tok.getText() == "async")
962-
*isAsync = true;
963960
else if (specialPurpose && SP.P.Tok.getText() == "global_init")
964961
*specialPurpose = SILFunction::Purpose::GlobalInit;
965962
else if (specialPurpose && SP.P.Tok.getText() == "lazy_getter")
@@ -5682,7 +5679,6 @@ bool SILParserState::parseDeclSIL(Parser &P) {
56825679
bool isWeakImported = false;
56835680
AvailabilityContext availability = AvailabilityContext::alwaysAvailable();
56845681
bool isWithoutActuallyEscapingThunk = false;
5685-
bool isAsync = false;
56865682
Inline_t inlineStrategy = InlineDefault;
56875683
OptimizationMode optimizationMode = OptimizationMode::NotSet;
56885684
SmallVector<std::string, 1> Semantics;
@@ -5697,8 +5693,8 @@ bool SILParserState::parseDeclSIL(Parser &P) {
56975693
&isThunk, &isDynamic, &isExactSelfClass, &DynamicallyReplacedFunction,
56985694
&objCReplacementFor, &specialPurpose, &inlineStrategy,
56995695
&optimizationMode, nullptr, &isWeakImported, &availability,
5700-
&isWithoutActuallyEscapingThunk, &isAsync, &Semantics, &SpecAttrs,
5701-
&ClangDecl, &MRK, FunctionState, M) ||
5696+
&isWithoutActuallyEscapingThunk, &Semantics,
5697+
&SpecAttrs, &ClangDecl, &MRK, FunctionState, M) ||
57025698
P.parseToken(tok::at_sign, diag::expected_sil_function_name) ||
57035699
P.parseIdentifier(FnName, FnNameLoc, diag::expected_sil_function_name) ||
57045700
P.parseToken(tok::colon, diag::expected_sil_type))
@@ -5736,7 +5732,6 @@ bool SILParserState::parseDeclSIL(Parser &P) {
57365732
FunctionState.F->setAvailabilityForLinkage(availability);
57375733
FunctionState.F->setWithoutActuallyEscapingThunk(
57385734
isWithoutActuallyEscapingThunk);
5739-
FunctionState.F->setAsync(isAsync);
57405735
FunctionState.F->setInlineStrategy(inlineStrategy);
57415736
FunctionState.F->setOptimizationMode(optimizationMode);
57425737
FunctionState.F->setEffectsKind(MRK);
@@ -5922,9 +5917,10 @@ bool SILParserState::parseSILGlobal(Parser &P) {
59225917
SILParser State(P);
59235918
if (parseSILLinkage(GlobalLinkage, P) ||
59245919
parseDeclSILOptional(nullptr, &isSerialized, nullptr, nullptr, nullptr,
5925-
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
5926-
nullptr, &isLet, nullptr, nullptr, nullptr, nullptr,
5927-
nullptr, nullptr, nullptr, nullptr, State, M) ||
5920+
nullptr, nullptr, nullptr, nullptr, nullptr,
5921+
nullptr, nullptr,
5922+
&isLet, nullptr, nullptr, nullptr, nullptr, nullptr,
5923+
nullptr, nullptr, State, M) ||
59285924
P.parseToken(tok::at_sign, diag::expected_sil_value_name) ||
59295925
P.parseIdentifier(GlobalName, NameLoc, diag::expected_sil_value_name) ||
59305926
P.parseToken(tok::colon, diag::expected_sil_type))
@@ -5973,7 +5969,7 @@ bool SILParserState::parseSILProperty(Parser &P) {
59735969
if (parseDeclSILOptional(nullptr, &Serialized, nullptr, nullptr, nullptr,
59745970
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
59755971
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
5976-
nullptr, nullptr, nullptr, nullptr, SP, M))
5972+
nullptr, nullptr, nullptr, SP, M))
59775973
return true;
59785974

59795975
ValueDecl *VD;
@@ -6043,7 +6039,8 @@ bool SILParserState::parseSILVTable(Parser &P) {
60436039
if (parseDeclSILOptional(nullptr, &Serialized, nullptr, nullptr, nullptr,
60446040
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
60456041
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
6046-
nullptr, nullptr, nullptr, nullptr, VTableState, M))
6042+
nullptr, nullptr, nullptr,
6043+
VTableState, M))
60476044
return true;
60486045

60496046
// Parse the class name.
@@ -6579,7 +6576,8 @@ bool SILParserState::parseSILWitnessTable(Parser &P) {
65796576
if (parseDeclSILOptional(nullptr, &isSerialized, nullptr, nullptr, nullptr,
65806577
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
65816578
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
6582-
nullptr, nullptr, nullptr, nullptr, WitnessState, M))
6579+
nullptr, nullptr, nullptr,
6580+
WitnessState, M))
65836581
return true;
65846582

65856583
Scope S(&P, ScopeKind::TopLevel);

lib/Serialization/DeserializeSIL.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,14 @@ SILDeserializer::readSILFunctionChecked(DeclID FID, SILFunction *existingFn,
510510
IdentifierID replacedFunctionID;
511511
GenericSignatureID genericSigID;
512512
unsigned rawLinkage, isTransparent, isSerialized, isThunk,
513-
isWithoutactuallyEscapingThunk, isAsync, specialPurpose, inlineStrategy,
513+
isWithoutactuallyEscapingThunk, specialPurpose, inlineStrategy,
514514
optimizationMode, subclassScope, effect, numSpecAttrs,
515515
hasQualifiedOwnership, isWeakImported, LIST_VER_TUPLE_PIECES(available),
516516
isDynamic, isExactSelfClass;
517517
ArrayRef<uint64_t> SemanticsIDs;
518518
SILFunctionLayout::readRecord(
519519
scratch, rawLinkage, isTransparent, isSerialized, isThunk,
520-
isWithoutactuallyEscapingThunk, isAsync, specialPurpose, inlineStrategy,
520+
isWithoutactuallyEscapingThunk, specialPurpose, inlineStrategy,
521521
optimizationMode, subclassScope, effect, numSpecAttrs,
522522
hasQualifiedOwnership, isWeakImported, LIST_VER_TUPLE_PIECES(available),
523523
isDynamic, isExactSelfClass, funcTyID, replacedFunctionID, genericSigID,
@@ -625,11 +625,6 @@ SILDeserializer::readSILFunctionChecked(DeclID FID, SILFunction *existingFn,
625625
MF->fatal();
626626
}
627627

628-
if (fn->isAsync() != isAsync) {
629-
LLVM_DEBUG(llvm::dbgs() << "SILFunction type mismatch.\n");
630-
MF->fatal();
631-
}
632-
633628
} else {
634629
// Otherwise, create a new function.
635630
fn = builder.createDeclaration(name, ty, loc);
@@ -638,7 +633,6 @@ SILDeserializer::readSILFunctionChecked(DeclID FID, SILFunction *existingFn,
638633
fn->setSerialized(IsSerialized_t(isSerialized));
639634
fn->setThunk(IsThunk_t(isThunk));
640635
fn->setWithoutActuallyEscapingThunk(bool(isWithoutactuallyEscapingThunk));
641-
fn->setAsync((bool)isAsync);
642636
fn->setInlineStrategy(Inline_t(inlineStrategy));
643637
fn->setSpecialPurpose(SILFunction::Purpose(specialPurpose));
644638
fn->setEffectsKind(EffectsKind(effect));
@@ -2829,14 +2823,14 @@ bool SILDeserializer::hasSILFunction(StringRef Name,
28292823
IdentifierID replacedFunctionID;
28302824
GenericSignatureID genericSigID;
28312825
unsigned rawLinkage, isTransparent, isSerialized, isThunk,
2832-
isWithoutactuallyEscapingThunk, isAsync, isGlobal, inlineStrategy,
2826+
isWithoutactuallyEscapingThunk, isGlobal, inlineStrategy,
28332827
optimizationMode, subclassScope, effect, numSpecAttrs,
28342828
hasQualifiedOwnership, isWeakImported, LIST_VER_TUPLE_PIECES(available),
28352829
isDynamic, isExactSelfClass;
28362830
ArrayRef<uint64_t> SemanticsIDs;
28372831
SILFunctionLayout::readRecord(
28382832
scratch, rawLinkage, isTransparent, isSerialized, isThunk,
2839-
isWithoutactuallyEscapingThunk, isAsync, isGlobal, inlineStrategy,
2833+
isWithoutactuallyEscapingThunk, isGlobal, inlineStrategy,
28402834
optimizationMode, subclassScope, effect, numSpecAttrs,
28412835
hasQualifiedOwnership, isWeakImported, LIST_VER_TUPLE_PIECES(available),
28422836
isDynamic, isExactSelfClass, funcTyID, replacedFunctionID, genericSigID,

lib/Serialization/SILFormat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ namespace sil_block {
277277
BCFixed<2>, // serialized
278278
BCFixed<2>, // thunks: signature optimized/reabstraction
279279
BCFixed<1>, // without_actually_escaping
280-
BCFixed<1>, // async
281280
BCFixed<3>, // specialPurpose
282281
BCFixed<2>, // inlineStrategy
283282
BCFixed<2>, // optimizationMode

lib/Serialization/SerializeSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ void SILSerializer::writeSILFunction(const SILFunction &F, bool DeclOnly) {
433433
Out, ScratchRecord, abbrCode, toStableSILLinkage(Linkage),
434434
(unsigned)F.isTransparent(), (unsigned)F.isSerialized(),
435435
(unsigned)F.isThunk(), (unsigned)F.isWithoutActuallyEscapingThunk(),
436-
(unsigned)F.isAsync(), (unsigned)F.getSpecialPurpose(),
436+
(unsigned)F.getSpecialPurpose(),
437437
(unsigned)F.getInlineStrategy(), (unsigned)F.getOptimizationMode(),
438438
(unsigned)F.getClassSubclassScope(), (unsigned)F.getEffectsKind(),
439439
(unsigned)numSpecAttrs, (unsigned)F.hasOwnership(),

test/SILGen/async.swift

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)