Skip to content

Commit f4cef57

Browse files
authored
Merge pull request swiftlang#29742 from CodaFi/leaving-the-nest
Always write out nested types tables
2 parents a4ba2ce + 53b368b commit f4cef57

File tree

10 files changed

+4
-35
lines changed

10 files changed

+4
-35
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,6 @@ class FrontendOptions {
177177
/// entity.
178178
bool ProfileEntities = false;
179179

180-
/// If true, serialization encodes an extra lookup table for use in module-
181-
/// merging when emitting partial modules (the per-file modules in a non-WMO
182-
/// build).
183-
bool EnableSerializationNestedTypeLookupTable = true;
184-
185180
/// Indicates whether or not an import statement can pick up a Swift source
186181
/// file (as opposed to a module file).
187182
bool EnableSourceImport = false;

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ def autolink_library : Separate<["-"], "autolink-library">,
182182
def disable_typo_correction : Flag<["-"], "disable-typo-correction">,
183183
HelpText<"Disable typo correction">;
184184

185-
def disable_serialization_nested_type_lookup_table :
186-
Flag<["-"], "disable-serialization-nested-type-lookup-table">,
187-
HelpText<"Force module merging to use regular lookups to find nested types">;
188-
189185
} // end let Flags = [FrontendOption, NoDriverOption]
190186

191187
def debug_crash_Group : OptionGroup<"<automatic crashing options>">;

include/swift/Serialization/SerializationOptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ namespace swift {
128128
ArrayRef<FileDependency> Dependencies;
129129

130130
bool AutolinkForceLoad = false;
131-
bool EnableNestedTypeLookupTable = false;
132131
bool SerializeAllSIL = false;
133132
bool SerializeOptionsForDebugging = false;
134133
bool IsSIB = false;

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ bool ArgsToFrontendOptionsConverter::convert(
174174

175175
Opts.EnableSourceImport |= Args.hasArg(OPT_enable_source_import);
176176
Opts.ImportUnderlyingModule |= Args.hasArg(OPT_import_underlying_module);
177-
Opts.EnableSerializationNestedTypeLookupTable &=
178-
!Args.hasArg(OPT_disable_serialization_nested_type_lookup_table);
179177

180178
computeImportObjCHeaderOptions();
181179
computeImplicitImportModuleNames();

lib/Frontend/Frontend.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
154154
serializationOpts.ImportedHeader = opts.ImplicitObjCHeaderPath;
155155
serializationOpts.ModuleLinkName = opts.ModuleLinkName;
156156
serializationOpts.ExtraClangOptions = getClangImporterOptions().ExtraArgs;
157-
serializationOpts.EnableNestedTypeLookupTable =
158-
opts.EnableSerializationNestedTypeLookupTable;
159157
if (!getIRGenOptions().ForceLoadSymbolName.empty())
160158
serializationOpts.AutolinkForceLoad = true;
161159

lib/Frontend/ModuleInterfaceBuilder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal(
347347
// optimization pipeline.
348348
SerializationOptions SerializationOpts;
349349
std::string OutPathStr = OutPath;
350-
SerializationOpts.EnableNestedTypeLookupTable
351-
= FEOpts.EnableSerializationNestedTypeLookupTable;
352350
SerializationOpts.OutputPath = OutPathStr.c_str();
353351
SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName;
354352
SerializationOpts.AutolinkForceLoad =

lib/Serialization/Deserialization.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,10 +1465,6 @@ ModuleFile::resolveCrossReference(ModuleID MID, uint32_t pathLen) {
14651465
Identifier memberName = getIdentifier(IID);
14661466
pathTrace.addValue(memberName);
14671467

1468-
llvm::PrettyStackTraceString message{
1469-
"If you're seeing a crash here, try passing "
1470-
"-Xfrontend -disable-serialization-nested-type-lookup-table"};
1471-
14721468
auto *baseType = cast<NominalTypeDecl>(values.front());
14731469
ModuleDecl *extensionModule = M;
14741470
if (!extensionModule)

lib/Serialization/Serialization.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4832,8 +4832,7 @@ static void collectInterestingNestedDeclarations(
48324832
}
48334833
}
48344834

4835-
void Serializer::writeAST(ModuleOrSourceFile DC,
4836-
bool enableNestedTypeLookupTable) {
4835+
void Serializer::writeAST(ModuleOrSourceFile DC) {
48374836
DeclTable topLevelDecls, operatorDecls, operatorMethodDecls;
48384837
DeclTable precedenceGroupDecls;
48394838
ObjCMethodTable objcMethods;
@@ -4984,8 +4983,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC,
49844983
index_block::ObjCMethodTableLayout ObjCMethodTable(Out);
49854984
writeObjCMethodTable(ObjCMethodTable, objcMethods);
49864985

4987-
if (enableNestedTypeLookupTable &&
4988-
!nestedTypeDecls.empty()) {
4986+
if (!nestedTypeDecls.empty()) {
49894987
index_block::NestedTypeDeclsLayout NestedTypeDeclsTable(Out);
49904988
writeNestedTypeDeclsTable(NestedTypeDeclsTable, nestedTypeDecls);
49914989
}
@@ -5041,7 +5039,7 @@ void Serializer::writeToStream(raw_ostream &os, ModuleOrSourceFile DC,
50415039
S.writeHeader(options);
50425040
S.writeInputBlock(options);
50435041
S.writeSIL(SILMod, options.SerializeAllSIL);
5044-
S.writeAST(DC, options.EnableNestedTypeLookupTable);
5042+
S.writeAST(DC);
50455043
}
50465044

50475045
S.writeToStream(os);

lib/Serialization/Serialization.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,7 @@ class Serializer : public SerializerBase {
370370
void writeSIL(const SILModule *M, bool serializeAllSIL);
371371

372372
/// Top-level entry point for serializing a module.
373-
void writeAST(ModuleOrSourceFile DC,
374-
bool enableNestedTypeLookupTable);
373+
void writeAST(ModuleOrSourceFile DC);
375374

376375
using SerializerBase::SerializerBase;
377376
using SerializerBase::writeToStream;

test/Serialization/multi-file-nested-type-simple.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@
77
// Switch the order of the files.
88
// RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file-2.swiftmodule %t/multi-file.swiftmodule -o %t -print-stats 2>&1 | %FileCheck %s
99

10-
// RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file.swiftmodule -primary-file %s %S/Inputs/multi-file-nested-types.swift -disable-serialization-nested-type-lookup-table
11-
// RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file-2.swiftmodule %s -primary-file %S/Inputs/multi-file-nested-types.swift -disable-serialization-nested-type-lookup-table
12-
13-
// RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file.swiftmodule %t/multi-file-2.swiftmodule -o %t -print-stats 2>&1 | %FileCheck -check-prefix=DISABLED %s
14-
// RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file-2.swiftmodule %t/multi-file.swiftmodule -o %t -print-stats 2>&1 | %FileCheck -check-prefix=DISABLED %s
15-
1610
// REQUIRES: asserts
1711

1812
// CHECK: 4 Serialization - # of nested types resolved without full lookup
19-
// DISABLED: Statistics
20-
// DISABLED-NOT: nested types resolved without full lookup
2113

2214
public func useTypes(
2315
_: Outer.Inner,

0 commit comments

Comments
 (0)