IRGen: Remove -enable-class-resilience staging flag

This commit is contained in:
Slava Pestov
2019-02-06 15:08:29 -05:00
parent c28848ac70
commit b64db715a8
12 changed files with 26 additions and 43 deletions

View File

@@ -168,9 +168,6 @@ public:
/// Emit mangled names of anonymous context descriptors. /// Emit mangled names of anonymous context descriptors.
unsigned EnableAnonymousContextMangledNames : 1; unsigned EnableAnonymousContextMangledNames : 1;
/// Enables resilient class layout.
unsigned EnableClassResilience : 1;
/// Bypass resilience when accessing resilient frameworks. /// Bypass resilience when accessing resilient frameworks.
unsigned EnableResilienceBypass : 1; unsigned EnableResilienceBypass : 1;
@@ -236,7 +233,6 @@ public:
EmbedMode(IRGenEmbedMode::None), HasValueNamesSetting(false), EmbedMode(IRGenEmbedMode::None), HasValueNamesSetting(false),
ValueNames(false), EnableReflectionMetadata(true), ValueNames(false), EnableReflectionMetadata(true),
EnableReflectionNames(true), EnableAnonymousContextMangledNames(false), EnableReflectionNames(true), EnableAnonymousContextMangledNames(false),
EnableClassResilience(false),
EnableResilienceBypass(false), LazyInitializeClassMetadata(false), EnableResilienceBypass(false), LazyInitializeClassMetadata(false),
DisableLegacyTypeInfo(false), DisableLegacyTypeInfo(false),
UseIncrementalLLVMCodeGen(true), UseSwiftCall(false), UseIncrementalLLVMCodeGen(true), UseSwiftCall(false),

View File

@@ -174,9 +174,6 @@ def enable_resilience : Flag<["-"], "enable-resilience">,
HelpText<"Compile the module to export resilient interfaces for all " HelpText<"Compile the module to export resilient interfaces for all "
"public declarations by default">; "public declarations by default">;
def enable_class_resilience : Flag<["-"], "enable-class-resilience">,
HelpText<"Enable resilient layout for classes containing resilient value types">;
def disable_legacy_type_info : Flag<["-"], "disable-legacy-type-info">, def disable_legacy_type_info : Flag<["-"], "disable-legacy-type-info">,
HelpText<"Completely disable legacy type layout">; HelpText<"Completely disable legacy type layout">;

View File

@@ -1067,10 +1067,6 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
Opts.EnableReflectionNames = false; Opts.EnableReflectionNames = false;
} }
if (Args.hasArg(OPT_enable_class_resilience)) {
Opts.EnableClassResilience = true;
}
if (Args.hasArg(OPT_enable_resilience_bypass)) { if (Args.hasArg(OPT_enable_resilience_bypass)) {
Opts.EnableResilienceBypass = true; Opts.EnableResilienceBypass = true;
} }

View File

@@ -528,12 +528,8 @@ const ClassLayout &
ClassTypeInfo::getClassLayout(IRGenModule &IGM, SILType classType, ClassTypeInfo::getClassLayout(IRGenModule &IGM, SILType classType,
bool forBackwardDeployment) const { bool forBackwardDeployment) const {
// Perform fragile layout only if Objective-C interop is enabled. // Perform fragile layout only if Objective-C interop is enabled.
//
// FIXME: EnableClassResilience staging flag will go away once we can do
// in-place re-initialization of class metadata.
bool completelyFragileLayout = (forBackwardDeployment && bool completelyFragileLayout = (forBackwardDeployment &&
IGM.Context.LangOpts.EnableObjCInterop && IGM.Context.LangOpts.EnableObjCInterop);
!IGM.IRGen.Opts.EnableClassResilience);
// Return the cached layout if available. // Return the cached layout if available.
auto &Layout = completelyFragileLayout ? FragileLayout : ResilientLayout; auto &Layout = completelyFragileLayout ? FragileLayout : ResilientLayout;

View File

@@ -1,10 +1,10 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %{python} %utils/chex.py < %s > %t/class_resilience.swift // RUN: %{python} %utils/chex.py < %s > %t/class_resilience.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct %S/../Inputs/resilient_struct.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct %S/../Inputs/resilient_struct.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/resilient_enum.swiftmodule -module-name=resilient_enum -I %t %S/../Inputs/resilient_enum.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_enum.swiftmodule -module-name=resilient_enum -I %t %S/../Inputs/resilient_enum.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class -I %t %S/../Inputs/resilient_class.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class -I %t %S/../Inputs/resilient_class.swift
// RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -enable-class-resilience %t/class_resilience.swift | %FileCheck %t/class_resilience.swift --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime -DINT=i%target-ptrsize // RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience %t/class_resilience.swift | %FileCheck %t/class_resilience.swift --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime -DINT=i%target-ptrsize
// RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -enable-class-resilience -O %t/class_resilience.swift // RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -O %t/class_resilience.swift
// CHECK: @"$s16class_resilience26ClassWithResilientPropertyC1s16resilient_struct4SizeVvpWvd" = hidden global [[INT]] 0 // CHECK: @"$s16class_resilience26ClassWithResilientPropertyC1s16resilient_struct4SizeVvpWvd" = hidden global [[INT]] 0
// CHECK: @"$s16class_resilience26ClassWithResilientPropertyC5colors5Int32VvpWvd" = hidden global [[INT]] 0 // CHECK: @"$s16class_resilience26ClassWithResilientPropertyC5colors5Int32VvpWvd" = hidden global [[INT]] 0

View File

@@ -1,11 +1,11 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %{python} %utils/chex.py < %s > %t/class_resilience.swift // RUN: %{python} %utils/chex.py < %s > %t/class_resilience.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct %S/../Inputs/resilient_struct.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct %S/../Inputs/resilient_struct.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/resilient_enum.swiftmodule -module-name=resilient_enum -I %t %S/../Inputs/resilient_enum.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_enum.swiftmodule -module-name=resilient_enum -I %t %S/../Inputs/resilient_enum.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class -I %t %S/../Inputs/resilient_class.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class -I %t %S/../Inputs/resilient_class.swift
// RUN: %target-swift-frontend -emit-module -enable-resilience -enable-class-resilience -emit-module-path=%t/fixed_layout_class.swiftmodule -module-name=fixed_layout_class -I %t %S/../Inputs/fixed_layout_class.swift // RUN: %target-swift-frontend -emit-module -enable-resilience -emit-module-path=%t/fixed_layout_class.swiftmodule -module-name=fixed_layout_class -I %t %S/../Inputs/fixed_layout_class.swift
// RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -enable-class-resilience %t/class_resilience.swift | %FileCheck %t/class_resilience.swift --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime -DINT=i%target-ptrsize // RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience %t/class_resilience.swift | %FileCheck %t/class_resilience.swift --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime -DINT=i%target-ptrsize
// RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -enable-class-resilience -O %t/class_resilience.swift // RUN: %target-swift-frontend -I %t -emit-ir -enable-resilience -O %t/class_resilience.swift
// This tests @_fixed_layout classes in resilient modules. // This tests @_fixed_layout classes in resilient modules.
import fixed_layout_class import fixed_layout_class

View File

@@ -3,8 +3,8 @@
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/%target-library-name(BaseModule) // RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/%target-library-name(BaseModule)
// RUN: %target-build-swift -I %t %s -o %t/a.out -L%t -lBaseModule // RUN: %target-build-swift -I %t %s -o %t/a.out -L%t -lBaseModule
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/%target-library-name(BaseModule) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience // RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/%target-library-name(BaseModule) -Xfrontend -enable-resilience
// RUN: %target-build-swift -I %t %s -o %t/a.out -Xfrontend -enable-class-resilience -L%t -lBaseModule // RUN: %target-build-swift -I %t %s -o %t/a.out -L%t -lBaseModule
// Check if the program can be linked without undefined symbol errors. // Check if the program can be linked without undefined symbol errors.

View File

@@ -1,9 +1,9 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience %S/../../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_struct) // RUN: %target-codesign %t/%target-library-name(resilient_struct)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class)) -Xfrontend -enable-resilience %S/../../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_class) // RUN: %target-codesign %t/%target-library-name(resilient_class)
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -o %t/main %target-rpath(%t) // RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -o %t/main %target-rpath(%t)

View File

@@ -1,29 +1,29 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_struct) // RUN: %target-codesign %t/%target-library-name(resilient_struct)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class)) -Xfrontend -enable-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_class) // RUN: %target-codesign %t/%target-library-name(resilient_class)
// RUN: %target-build-swift-dylib(%t/%target-library-name(fixed_layout_class)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(fixed_layout_class)) -Xfrontend -enable-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct
// RUN: %target-codesign %t/%target-library-name(fixed_layout_class) // RUN: %target-codesign %t/%target-library-name(fixed_layout_class)
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -lfixed_layout_class -o %t/main -Xfrontend -enable-class-resilience %target-rpath(%t) // RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -lfixed_layout_class -o %t/main %target-rpath(%t)
// RUN: %target-codesign %t/main // RUN: %target-codesign %t/main
// RUN: %target-run %t/main %t/%target-library-name(resilient_struct) %t/%target-library-name(resilient_class) %t/%target-library-name(fixed_layout_class) // RUN: %target-run %t/main %t/%target-library-name(resilient_struct) %t/%target-library-name(resilient_class) %t/%target-library-name(fixed_layout_class)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct_wmo)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct -whole-module-optimization // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct_wmo)) -Xfrontend -enable-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct -whole-module-optimization
// RUN: %target-codesign %t/%target-library-name(resilient_struct_wmo) // RUN: %target-codesign %t/%target-library-name(resilient_struct_wmo)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class_wmo)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class_wmo)) -Xfrontend -enable-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization
// RUN: %target-codesign %t/%target-library-name(resilient_class_wmo) // RUN: %target-codesign %t/%target-library-name(resilient_class_wmo)
// RUN: %target-build-swift-dylib(%t/%target-library-name(fixed_layout_class_wmo)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization // RUN: %target-build-swift-dylib(%t/%target-library-name(fixed_layout_class_wmo)) -Xfrontend -enable-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization
// RUN: %target-codesign %t/%target-library-name(fixed_layout_class_wmo) // RUN: %target-codesign %t/%target-library-name(fixed_layout_class_wmo)
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct_wmo -lresilient_class_wmo -lfixed_layout_class_wmo -Xfrontend -enable-class-resilience -o %t/main2 %target-rpath(%t) -module-name main // RUN: %target-build-swift %s -L %t -I %t -lresilient_struct_wmo -lresilient_class_wmo -lfixed_layout_class_wmo -o %t/main2 %target-rpath(%t) -module-name main
// RUN: %target-codesign %t/main2 // RUN: %target-codesign %t/main2
// RUN: %target-run %t/main2 %t/%target-library-name(resilient_struct_wmo) %t/%target-library-name(resilient_class_wmo) %t/%target-library-name(fixed_layout_class_wmo) // RUN: %target-run %t/main2 %t/%target-library-name(resilient_struct_wmo) %t/%target-library-name(resilient_class_wmo) %t/%target-library-name(fixed_layout_class_wmo)

View File

@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_struct) // RUN: %target-codesign %t/%target-library-name(resilient_struct)
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -o %t/main %target-rpath(%t) // RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -o %t/main %target-rpath(%t)

View File

@@ -3,7 +3,7 @@
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_struct)) -Xfrontend -enable-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_struct) // RUN: %target-codesign %t/%target-library-name(resilient_struct)
// RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class)) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct // RUN: %target-build-swift-dylib(%t/%target-library-name(resilient_class)) -Xfrontend -enable-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
// RUN: %target-codesign %t/%target-library-name(resilient_class) // RUN: %target-codesign %t/%target-library-name(resilient_class)
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -o %t/main %target-rpath(%t) // RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -o %t/main %target-rpath(%t)

View File

@@ -83,7 +83,6 @@ class ResilienceTest(object):
compiler_flags = ['-emit-library', '-emit-module', compiler_flags = ['-emit-library', '-emit-module',
'-swift-version', '4', '-swift-version', '4',
'-Xfrontend', '-enable-resilience', '-Xfrontend', '-enable-resilience',
'-Xfrontend', '-enable-class-resilience',
'-D', config, '-D', config,
self.lib_src, self.lib_src,
'-o', output_dylib] '-o', output_dylib]
@@ -146,7 +145,6 @@ class ResilienceTest(object):
output_obj = os.path.join(self.config_dir_map[config], 'main.o') output_obj = os.path.join(self.config_dir_map[config], 'main.o')
compiler_flags = ['-D', config, '-c', self.test_src, compiler_flags = ['-D', config, '-c', self.test_src,
'-Xfrontend', '-enable-class-resilience',
'-I', self.config_dir_map[config], '-I', self.config_dir_map[config],
'-o', output_obj] '-o', output_obj]
command = self.target_build_swift + \ command = self.target_build_swift + \