Skip to content

Commit 570c26c

Browse files
committed
---
yaml --- r: 345943 b: refs/heads/master c: 942da33 h: refs/heads/master i: 345941: 9e89522 345939: 2897f88 345935: 0ee7adc
1 parent 913531f commit 570c26c

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4537238ed09dfc43407f4941191b942bdec68c5a
2+
refs/heads/master: 942da33956a8b0f69a4a9bc624e8d81ddbbe2d4c
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/include/swift/AST/IRGenOptions.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ class IRGenOptions {
171171
/// Bypass resilience when accessing resilient frameworks.
172172
unsigned EnableResilienceBypass : 1;
173173

174+
/// Force lazy initialization of class metadata
175+
/// Used on Windows to avoid cross-module references.
176+
unsigned LazyInitializeClassMetadata : 1;
177+
174178
/// The path to load legacy type layouts from.
175179
StringRef ReadTypeInfoPath;
176180

@@ -221,10 +225,10 @@ class IRGenOptions {
221225
EmbedMode(IRGenEmbedMode::None), HasValueNamesSetting(false),
222226
ValueNames(false), EnableReflectionMetadata(true),
223227
EnableReflectionNames(true), EnableClassResilience(false),
224-
EnableResilienceBypass(false), UseIncrementalLLVMCodeGen(true),
225-
UseSwiftCall(false), GenerateProfile(false),
226-
EnableDynamicReplacementChaining(false), CmdArgs(),
227-
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
228+
EnableResilienceBypass(false), LazyInitializeClassMetadata(false),
229+
UseIncrementalLLVMCodeGen(true), UseSwiftCall(false),
230+
GenerateProfile(false), EnableDynamicReplacementChaining(false),
231+
CmdArgs(), SanitizeCoverage(llvm::SanitizerCoverageOptions()),
228232
TypeInfoFilter(TypeInfoDumpFilter::All) {}
229233

230234
// Get a hash of all options which influence the llvm compilation but are not

trunk/lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
10591059
Opts.EnableResilienceBypass = true;
10601060
}
10611061

1062+
// PE/COFF cannot deal with the cross-module reference to the metadata parent
1063+
// (e.g. NativeObject). Force the lazy initialization of the VWT always.
1064+
Opts.LazyInitializeClassMetadata = Triple.isOSBinFormatCOFF();
1065+
10621066
if (const Arg *A = Args.getLastArg(OPT_read_type_info_path_EQ)) {
10631067
Opts.ReadTypeInfoPath = A->getValue();
10641068
}

trunk/lib/IRGen/GenClass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ namespace {
276276
return (ClassHasMissingMembers ||
277277
ClassHasResilientMembers ||
278278
ClassHasResilientAncestry ||
279-
ClassHasGenericAncestry);
279+
ClassHasGenericAncestry ||
280+
IGM.getOptions().LazyInitializeClassMetadata);
280281
}
281282

282283
bool doesMetadataRequireRelocation() const {

trunk/test/IRGen/dllimport.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public func g() {
4040
// CHECK-NO-OPT-DAG: declare dllimport void @swift_deallocObject(%swift.refcounted*, i32, i32)
4141
// CHECK-NO-OPT-DAG: declare dllimport void @swift_release(%swift.refcounted*)
4242
// CHECK-NO-OPT-DAG: declare dllimport %swift.refcounted* @swift_retain(%swift.refcounted* returned)
43-
// CHECK-NO-OPT-DAG: @"$s9dllexport1cCN" = external dllimport global %swift.type
4443
// CHECK-NO-OPT-DAG: @"$s9dllexport1pMp" = external dllimport global %swift.protocol
4544
// CHECK-NO-OPT-DAG: @"$sytN" = external dllimport global %swift.full_type
4645
// CHECK-NO-OPT-DAG: @"$sBoWV" = external dllimport global i8*
@@ -51,7 +50,6 @@ public func g() {
5150

5251
// CHECK-OPT-DAG: declare dllimport %swift.refcounted* @swift_retain(%swift.refcounted* returned) local_unnamed_addr
5352
// CHECK-OPT-DAG: @"$sBoWV" = external dllimport global i8*
54-
// CHECK-OPT-DAG: @"$s9dllexport1cCN" = external dllimport global %swift.type
5553
// CHECK-OPT-DAG: @"__imp_$s9dllexport1pMp" = external externally_initialized constant %swift.protocol*
5654
// CHECK-OPT-DAG: declare dllimport swiftcc i8* @"$s9dllexport2ciAA1cCvau"()
5755
// CHECK-OPT-DAG: declare dllimport swiftcc %swift.metadata_response @"$s9dllexport1cCMa"(i32)

0 commit comments

Comments
 (0)