Remove the -enable-ossa-modules option.

OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
This commit is contained in:
Erik Eckstein
2025-09-24 08:41:01 +02:00
parent 887bfb7889
commit 2f124cf564
51 changed files with 95 additions and 275 deletions

View File

@@ -194,7 +194,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:-no-link-objc-runtime>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -empty-abi-descriptor>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
"$<$<AND:$<NOT:$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -disable-objc-interop>"

View File

@@ -71,7 +71,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")

View File

@@ -81,7 +81,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Macros>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature ExtensionMacros>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-lexical-lifetimes=false>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:-warn-implicit-overrides>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")

View File

@@ -45,13 +45,12 @@ enum class CopyPropagationOption : uint8_t {
// Do not add any copy propagation passes.
Off = 0,
// Only add the copy propagation passes requested by other flags, currently
// just -enable-ossa-modules.
// Only add the copy propagation passes requested by other flags.
RequestedPassesOnly,
// Run copy propagation during optimized builds only.
//
// If a setting, e.g. -enable-ossa-modules, requests to add copy propagation
// If a setting, requests to add copy propagation
// to the performance pipeline, do so.
Optimizing,
@@ -189,11 +188,6 @@ public:
/// and go from OSSA to non-ownership SIL.
bool StopOptimizationBeforeLoweringOwnership = false;
/// Do we always serialize SIL in OSSA form?
///
/// If this is disabled we do not serialize in OSSA form when optimizing.
bool EnableOSSAModules = true;
/// Allow recompilation of a non-OSSA module to an OSSA module when imported
/// from another OSSA module.
bool EnableRecompilationToOSSAModule = false;

View File

@@ -478,25 +478,6 @@ public:
ModuleInterfaceLoaderOptions() = default;
};
/// Strongly typed enum that represents if we require all SILModules to have
/// OSSA modules emitted. This is implemented by incorporating this bit into the
/// module cache hash.
struct RequireOSSAModules_t {
enum ValueTy {
No = 0,
Yes = 1,
};
ValueTy value;
RequireOSSAModules_t(const SILOptions &opts)
: value(opts.EnableOSSAModules ? RequireOSSAModules_t::Yes
: RequireOSSAModules_t::No) {}
operator ValueTy() const { return value; }
explicit operator bool() const { return bool(value); }
};
class ModuleInterfaceCheckerImpl: public ModuleInterfaceChecker {
friend class ModuleInterfaceLoader;
ASTContext &Ctx;
@@ -504,23 +485,20 @@ class ModuleInterfaceCheckerImpl: public ModuleInterfaceChecker {
std::string PrebuiltCacheDir;
std::string BackupInterfaceDir;
ModuleInterfaceLoaderOptions Opts;
RequireOSSAModules_t RequiresOSSAModules;
public:
explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir,
StringRef prebuiltCacheDir,
StringRef BackupInterfaceDir,
ModuleInterfaceLoaderOptions opts,
RequireOSSAModules_t requiresOSSAModules)
ModuleInterfaceLoaderOptions opts)
: Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
BackupInterfaceDir(BackupInterfaceDir),
Opts(opts), RequiresOSSAModules(requiresOSSAModules) {}
Opts(opts) {}
explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir,
StringRef prebuiltCacheDir,
ModuleInterfaceLoaderOptions opts,
RequireOSSAModules_t requiresOSSAModules):
ModuleInterfaceLoaderOptions opts):
ModuleInterfaceCheckerImpl(Ctx, cacheDir, prebuiltCacheDir, StringRef(),
opts, requiresOSSAModules) {}
opts) {}
std::vector<std::string>
getCompiledModuleCandidatesForInterface(StringRef moduleName,
StringRef interfacePath) override;
@@ -596,7 +574,6 @@ public:
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool SerializeDependencyHashes, bool TrackSystemDependencies,
ModuleInterfaceLoaderOptions Opts,
RequireOSSAModules_t RequireOSSAModules,
bool silenceInterfaceDiagnostics);
/// Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as
@@ -666,8 +643,7 @@ private:
const LangOptions &LangOpts,
const ClangImporterOptions &clangImporterOpts,
const CASOptions &casOpts,
bool suppressRemarks,
RequireOSSAModules_t requireOSSAModules);
bool suppressRemarks);
bool extractSwiftInterfaceVersionAndArgs(CompilerInvocation &subInvocation,
DiagnosticEngine &subInstanceDiags,
SwiftInterfaceInfo &interfaceInfo,
@@ -684,7 +660,7 @@ public:
StringRef backupModuleInterfaceDir,
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool serializeDependencyHashes,
bool trackSystemDependencies, RequireOSSAModules_t requireOSSAModules);
bool trackSystemDependencies);
template<typename ...ArgTypes>
static InFlightDiagnostic diagnose(StringRef interfacePath,

View File

@@ -1320,8 +1320,7 @@ def disable_ast_verifier : Flag<["-"], "disable-ast-verifier">,
let Flags = [FrontendOption, NoDriverOption, HelpHidden, ModuleInterfaceOptionIgnorable] in {
def enable_ossa_modules : Flag<["-"], "enable-ossa-modules">,
HelpText<"Always serialize SIL in ossa form. If this flag is not passed in, "
"when optimizing ownership will be lowered before serializing SIL">;
HelpText<"Obsolete. This option is ignored">;
}
def enable_recompilation_to_ossa_module : Flag<["-"], "enable-recompilation-to-ossa-module">,

View File

@@ -193,7 +193,6 @@ protected:
static llvm::ErrorOr<std::vector<ScannerImportStatementInfo>>
getMatchingPackageOnlyImportsOfModule(Twine modulePath,
bool isFramework,
bool isRequiredOSSAModules,
StringRef SDKName,
const llvm::Triple &target,
StringRef packageName,
@@ -222,8 +221,6 @@ public:
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework);
bool isRequiredOSSAModules() const;
/// Check whether the module with a given name can be imported without
/// importing it.
///

View File

@@ -297,8 +297,6 @@ struct SearchPath {
///
/// \param data A buffer containing the serialized AST. Result information
/// refers directly into this buffer.
/// \param requiresOSSAModules If true, necessitates the module to be
/// compiled with -enable-ossa-modules.
/// \param requiredSDK If not empty, only accept modules built with
/// a compatible SDK. The StringRef represents the canonical SDK name.
/// \param target The target triple of the current compilation for
@@ -309,7 +307,7 @@ struct SearchPath {
/// \param[out] dependencies If present, will be populated with list of
/// input files the module depends on, if present in INPUT_BLOCK.
ValidationInfo validateSerializedAST(
StringRef data, bool requiresOSSAModules,
StringRef data,
StringRef requiredSDK,
ExtendedValidationInfo *extendedInfo = nullptr,
SmallVectorImpl<SerializationOptions::FileDependency> *dependencies =

View File

@@ -58,7 +58,7 @@ swift::parseASTSection(MemoryBufferSerializedModuleLoader &Loader,
// headers. Iterate over all AST modules.
while (!buf.empty()) {
auto info = serialization::validateSerializedAST(
buf, Loader.isRequiredOSSAModules(),
buf,
/*requiredSDK*/StringRef());
assert(info.name.size() < (2 << 10) && "name failed sanity check");

View File

@@ -252,8 +252,8 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
workerCompilerInvocation->getFrontendOptions()
.SerializeModuleInterfaceDependencyHashes,
workerCompilerInvocation->getFrontendOptions()
.shouldTrackSystemDependencies(),
RequireOSSAModules_t(SILOptions));
.shouldTrackSystemDependencies()
);
auto loader = std::make_unique<PluginLoader>(
*workerASTContext, /*DepTracker=*/nullptr,

View File

@@ -118,12 +118,6 @@ struct SILFuncExtractorOptions {
llvm::cl::init(false),
llvm::cl::desc("Do not dump AST."));
llvm::cl::opt<bool> EnableOSSAModules = llvm::cl::opt<bool>(
"enable-ossa-modules", llvm::cl::init(true),
llvm::cl::desc("Do we always serialize SIL in OSSA form? If "
"this is disabled we do not serialize in OSSA "
"form when optimizing."));
llvm::cl::opt<llvm::cl::boolOrDefault>
EnableObjCInterop = llvm::cl::opt<llvm::cl::boolOrDefault>(
"enable-objc-interop",
@@ -275,7 +269,6 @@ int sil_func_extractor_main(ArrayRef<const char *> argv, void *MainAddr) {
SILOptions &Opts = Invocation.getSILOptions();
Opts.EmitVerboseSIL = options.EmitVerboseSIL;
Opts.EmitSortedSIL = options.EmitSortedSIL;
Opts.EnableOSSAModules = options.EnableOSSAModules;
Opts.StopOptimizationAfterSerialization |= options.EmitSIB;
serialization::ExtendedValidationInfo extendedInfo;
@@ -368,7 +361,7 @@ int sil_func_extractor_main(ArrayRef<const char *> argv, void *MainAddr) {
serializationOpts.OutputPath = OutputFile;
serializationOpts.SerializeAllSIL = true;
serializationOpts.IsSIB = true;
serializationOpts.IsOSSA = options.EnableOSSAModules;
serializationOpts.IsOSSA = true;
symbolgraphgen::SymbolGraphOptions symbolGraphOpts;

View File

@@ -316,12 +316,6 @@ struct SILOptOptions {
EnableMoveInoutStackProtection = llvm::cl::opt<bool>("enable-move-inout-stack-protector",
llvm::cl::desc("Enable the stack protector by moving values to temporaries."));
llvm::cl::opt<bool> EnableOSSAModules = llvm::cl::opt<bool>(
"enable-ossa-modules", llvm::cl::init(true),
llvm::cl::desc("Do we always serialize SIL in OSSA form? If "
"this is disabled we do not serialize in OSSA "
"form when optimizing."));
cl::opt<EnforceExclusivityMode>
EnforceExclusivity = cl::opt<EnforceExclusivityMode>(
"enforce-exclusivity", cl::desc("Enforce law of exclusivity "
@@ -902,7 +896,6 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
SILOpts.EnableThrowsPrediction = options.EnableThrowsPrediction;
SILOpts.EnableNoReturnCold = options.EnableNoReturnCold;
SILOpts.IgnoreAlwaysInline = options.IgnoreAlwaysInline;
SILOpts.EnableOSSAModules = options.EnableOSSAModules;
SILOpts.EnableSILOpaqueValues = options.EnableSILOpaqueValues;
SILOpts.OSSACompleteLifetimes = options.EnableOSSACompleteLifetimes;
SILOpts.OSSAVerifyComplete = options.EnableOSSAVerifyComplete;
@@ -1088,7 +1081,7 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
serializationOpts.OutputPath = OutputFile;
serializationOpts.SerializeAllSIL = options.EmitSIB;
serializationOpts.IsSIB = options.EmitSIB;
serializationOpts.IsOSSA = SILOpts.EnableOSSAModules;
serializationOpts.IsOSSA = true;
symbolgraphgen::SymbolGraphOptions symbolGraphOptions;

View File

@@ -3047,7 +3047,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
enablePackMetadataStackPromotionFlag.value();
Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts);
Opts.EnableOSSAModules |= Args.hasArg(OPT_enable_ossa_modules);
Opts.EnableRecompilationToOSSAModule |=
Args.hasArg(OPT_enable_recompilation_to_ossa_module);
Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts);
@@ -4190,8 +4189,6 @@ bool CompilerInvocation::parseArgs(
SILOpts.CMOMode = CrossModuleOptimizationMode::Everything;
SILOpts.EmbeddedSwift = true;
SILOpts.UseAggressiveReg2MemForCodeSize = true;
// OSSA modules are required for deinit de-virtualization.
SILOpts.EnableOSSAModules = true;
// -g is promoted to -gdwarf-types in embedded Swift
if (IRGenOpts.DebugInfoLevel == IRGenDebugInfoLevel::ASTTypes) {
IRGenOpts.DebugInfoLevel = IRGenDebugInfoLevel::DwarfTypes;
@@ -4244,7 +4241,6 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) {
serialization::ValidationInfo info =
serialization::validateSerializedAST(
data,
getSILOptions().EnableOSSAModules,
LangOpts.SDKName,
&extendedInfo);
@@ -4282,7 +4278,6 @@ CompilerInvocation::setUpInputForSILTool(
auto result = serialization::validateSerializedAST(
fileBufOrErr.get()->getBuffer(),
getSILOptions().EnableOSSAModules,
LangOpts.SDKName,
&extendedInfo);
bool hasSerializedAST = result.status == serialization::Status::Valid;

View File

@@ -281,7 +281,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
serializationOpts.SerializeDebugInfoSIL = true;
}
serializationOpts.IsOSSA = getSILOptions().EnableOSSAModules;
serializationOpts.IsOSSA = true;
serializationOpts.SkipNonExportableDecls =
getLangOptions().SkipNonExportableDecls;
@@ -792,8 +792,7 @@ bool CompilerInstance::setUpModuleLoaders() {
Context->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>(
*Context, ModuleCachePathFromInvocation, FEOpts.PrebuiltModuleCachePath,
FEOpts.BackupModuleInterfaceDir, LoaderOpts,
RequireOSSAModules_t(Invocation.getSILOptions())));
FEOpts.BackupModuleInterfaceDir, LoaderOpts));
if (MLM != ModuleLoadingMode::OnlySerialized) {
// We only need ModuleInterfaceLoader for implicit modules.
@@ -867,8 +866,7 @@ bool CompilerInstance::setUpModuleLoaders() {
Context->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>(
*Context, ModuleCachePath, FEOpts.PrebuiltModuleCachePath,
FEOpts.BackupModuleInterfaceDir, LoaderOpts,
RequireOSSAModules_t(Invocation.getSILOptions())));
FEOpts.BackupModuleInterfaceDir, LoaderOpts));
// Install an explicit module loader if it was created earlier.
if (ESML) {
@@ -910,8 +908,7 @@ bool CompilerInstance::setUpModuleLoaders() {
FEOpts.PrebuiltModuleCachePath, FEOpts.BackupModuleInterfaceDir,
FEOpts.CacheReplayPrefixMap,
FEOpts.SerializeModuleInterfaceDependencyHashes,
FEOpts.shouldTrackSystemDependencies(),
RequireOSSAModules_t(Invocation.getSILOptions()));
FEOpts.shouldTrackSystemDependencies());
}
return false;

View File

@@ -310,7 +310,7 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(
return std::make_error_code(std::errc::not_supported);
SerializationOpts.Dependencies = Deps;
}
SerializationOpts.IsOSSA = SILOpts.EnableOSSAModules;
SerializationOpts.IsOSSA = true;
SILMod->setSerializeSILAction([&]() {
// We don't want to serialize module docs in the cache -- they

View File

@@ -213,10 +213,8 @@ public:
namespace path = llvm::sys::path;
static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf,
bool requiresOSSAModules,
StringRef requiredSDK) {
auto VI = serialization::validateSerializedAST(buf.getBuffer(),
requiresOSSAModules,
requiredSDK);
return VI.status == serialization::Status::Valid;
}
@@ -408,14 +406,11 @@ StringRef getFullDependencyPath(const FileDependency &dep,
class UpToDateModuleCheker {
ASTContext &ctx;
llvm::vfs::FileSystem &fs;
RequireOSSAModules_t requiresOSSAModules;
public:
UpToDateModuleCheker(ASTContext &ctx,
RequireOSSAModules_t requiresOSSAModules)
UpToDateModuleCheker(ASTContext &ctx)
: ctx(ctx),
fs(*ctx.SourceMgr.getFileSystem()),
requiresOSSAModules(requiresOSSAModules) {}
fs(*ctx.SourceMgr.getFileSystem()) {}
// Check if all the provided file dependencies are up-to-date compared to
// what's currently on disk.
@@ -460,7 +455,7 @@ public:
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n");
auto validationInfo = serialization::validateSerializedAST(
buf.getBuffer(), requiresOSSAModules,
buf.getBuffer(),
ctx.LangOpts.SDKName, /*ExtendedValidationInfo=*/nullptr, &allDeps);
if (validationInfo.status != serialization::Status::Valid) {
@@ -551,25 +546,22 @@ class ModuleInterfaceLoaderImpl {
DependencyTracker *const dependencyTracker;
const ModuleLoadingMode loadMode;
ModuleInterfaceLoaderOptions Opts;
RequireOSSAModules_t requiresOSSAModules;
ModuleInterfaceLoaderImpl(
ASTContext &ctx, StringRef modulePath, StringRef interfacePath,
StringRef moduleName, StringRef cacheDir, StringRef prebuiltCacheDir,
StringRef backupInterfaceDir,
SourceLoc diagLoc, ModuleInterfaceLoaderOptions Opts,
RequireOSSAModules_t requiresOSSAModules,
DependencyTracker *dependencyTracker = nullptr,
ModuleLoadingMode loadMode = ModuleLoadingMode::PreferSerialized)
: ctx(ctx), fs(*ctx.SourceMgr.getFileSystem()), diags(ctx.Diags),
upToDateChecker(ctx, requiresOSSAModules),
upToDateChecker(ctx),
modulePath(modulePath), interfacePath(interfacePath),
moduleName(moduleName),
prebuiltCacheDir(prebuiltCacheDir),
backupInterfaceDir(backupInterfaceDir),
cacheDir(cacheDir), diagnosticLoc(diagLoc),
dependencyTracker(dependencyTracker), loadMode(loadMode), Opts(Opts),
requiresOSSAModules(requiresOSSAModules) {}
dependencyTracker(dependencyTracker), loadMode(loadMode), Opts(Opts) {}
std::string getBackupPublicModuleInterfacePath() {
return getBackupPublicModuleInterfacePath(ctx.SourceMgr, backupInterfaceDir,
@@ -622,7 +614,6 @@ class ModuleInterfaceLoaderImpl {
return false;
auto looksValid = serializedASTLooksValid(*modBuf.get(),
requiresOSSAModules,
ctx.LangOpts.SDKName);
if (!looksValid)
return false;
@@ -935,15 +926,7 @@ class ModuleInterfaceLoaderImpl {
version::getCurrentCompilerSerializationTag().empty() &&
rebuildInfo.getOrInsertCandidateModule(adjacentMod)
.serializationStatus !=
serialization::Status::SDKMismatch &&
// FIXME (meg-gupta): We need to support recompilation of
// modules in the resource directory if the mismatch is due
// to importing a non-ossa module to an ossa module. This is
// needed during ossa bringup, once -enable-ossa-modules is
// on by default, this can be deleted.
rebuildInfo.getOrInsertCandidateModule(adjacentMod)
.serializationStatus !=
serialization::Status::NotInOSSA) {
serialization::Status::SDKMismatch) {
// Special-case here: If we're loading a .swiftmodule from the resource
// dir adjacent to the compiler, defer to the serialized loader instead
// of falling back. This is to support local development of Swift,
@@ -1130,8 +1113,7 @@ class ModuleInterfaceLoaderImpl {
ctx.ClangImporterOpts, ctx.CASOpts, Opts,
/*buildModuleCacheDirIfAbsent*/ true, cacheDir, prebuiltCacheDir,
backupInterfaceDir, /*replayPrefixMap=*/{},
/*serializeDependencyHashes*/ false, trackSystemDependencies,
requiresOSSAModules);
/*serializeDependencyHashes*/ false, trackSystemDependencies);
// Compute the output path if we're loading or emitting a cached module.
SwiftInterfaceModuleOutputPathResolution::ResultTy resolvedOutputPath;
@@ -1375,7 +1357,6 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
Ctx, ModPath, *InPath, ModuleName, InterfaceChecker.CacheDir,
InterfaceChecker.PrebuiltCacheDir, InterfaceChecker.BackupInterfaceDir,
ModuleID.Loc, InterfaceChecker.Opts,
InterfaceChecker.RequiresOSSAModules,
dependencyTracker,
llvm::is_contained(PreferInterfaceForModules, ModuleName)
? ModuleLoadingMode::PreferInterface
@@ -1429,7 +1410,7 @@ ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface(
ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName,
CacheDir, PrebuiltCacheDir, BackupInterfaceDir,
SourceLoc(), Opts, RequiresOSSAModules,
SourceLoc(), Opts,
nullptr, Ctx.SearchPathOpts.ModuleLoadMode);
std::vector<std::string> results;
std::string adjacentMod, prebuiltMod;
@@ -1469,7 +1450,6 @@ bool ModuleInterfaceCheckerImpl::tryEmitForwardingModule(
ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName,
CacheDir, PrebuiltCacheDir,
BackupInterfaceDir, SourceLoc(), Opts,
RequiresOSSAModules,
nullptr,
ModuleLoadingMode::PreferSerialized);
SmallVector<FileDependency, 16> deps;
@@ -1503,13 +1483,13 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool SerializeDependencyHashes, bool TrackSystemDependencies,
ModuleInterfaceLoaderOptions LoaderOpts,
RequireOSSAModules_t RequireOSSAModules, bool silenceInterfaceDiagnostics) {
bool silenceInterfaceDiagnostics) {
InterfaceSubContextDelegateImpl astDelegate(
SourceMgr, &Diags, SearchPathOpts, LangOpts, ClangOpts, CASOpts,
LoaderOpts,
/*CreateCacheDirIfAbsent*/ true, CacheDir, PrebuiltCacheDir,
BackupInterfaceDir, replayPrefixMap, SerializeDependencyHashes,
TrackSystemDependencies, RequireOSSAModules);
TrackSystemDependencies);
ImplicitModuleInterfaceBuilder builder(SourceMgr, &Diags, astDelegate, InPath,
SearchPathOpts.getSDKPath(),
SearchPathOpts.getSysRoot(),
@@ -1635,8 +1615,7 @@ bool ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
// up-to-date w.r.t. all of the dependencies it was built with. If so, early
// exit.
UpToDateModuleCheker checker(
Instance.getASTContext(),
RequireOSSAModules_t(Instance.getSILOptions()));
Instance.getASTContext());
ModuleRebuildInfo rebuildInfo;
SmallVector<FileDependency, 3> allDeps;
std::unique_ptr<llvm::MemoryBuffer> moduleBuffer;
@@ -1684,7 +1663,7 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
FrontendOptions::ActionType requestedAction,
const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts,
const ClangImporterOptions &clangImporterOpts, const CASOptions &casOpts,
bool suppressRemarks, RequireOSSAModules_t RequireOSSAModules) {
bool suppressRemarks) {
GenericArgs.push_back("-frontend");
// Start with a genericSubInvocation that copies various state from our
// invoking ASTContext.
@@ -1791,12 +1770,6 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
genericSubInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
GenericArgs.push_back("-disable-objc-attr-requires-foundation-module");
// If we are supposed to use RequireOSSAModules, do so.
if (RequireOSSAModules) {
genericSubInvocation.getSILOptions().EnableOSSAModules = true;
GenericArgs.push_back("-enable-ossa-modules");
}
if (LangOpts.DisableAvailabilityChecking) {
genericSubInvocation.getLangOptions().DisableAvailabilityChecking = true;
GenericArgs.push_back("-disable-availability-checking");
@@ -1885,14 +1858,12 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
StringRef moduleCachePath, StringRef prebuiltCachePath,
StringRef backupModuleInterfaceDir,
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool serializeDependencyHashes, bool trackSystemDependencies,
RequireOSSAModules_t requireOSSAModules)
bool serializeDependencyHashes, bool trackSystemDependencies)
: SM(SM), Diags(Diags), ArgSaver(Allocator) {
genericSubInvocation.setMainExecutablePath(LoaderOpts.mainExecutablePath);
inheritOptionsForBuildingInterface(LoaderOpts.requestedAction, searchPathOpts,
langOpts, clangImporterOpts, casOpts,
Diags->getSuppressRemarks(),
requireOSSAModules);
Diags->getSuppressRemarks());
// Configure front-end input.
auto &SubFEOpts = genericSubInvocation.getFrontendOptions();
SubFEOpts.RequestedAction = LoaderOpts.requestedAction;
@@ -2447,7 +2418,6 @@ bool ExplicitSwiftModuleLoader::canImportModule(
auto metaData = serialization::validateSerializedAST(
(*moduleBuf)->getBuffer(),
Ctx.SILOpts.EnableOSSAModules,
Ctx.LangOpts.SDKName);
versionInfo->setVersion(metaData.userModuleVersion,
ModuleVersionSourceKind::SwiftBinaryModule);
@@ -2802,7 +2772,7 @@ bool ExplicitCASModuleLoader::canImportModule(
return false;
}
auto metaData = serialization::validateSerializedAST(
moduleBuf->getBuffer(), Ctx.SILOpts.EnableOSSAModules,
moduleBuf->getBuffer(),
Ctx.LangOpts.SDKName);
versionInfo->setVersion(metaData.userModuleVersion,
ModuleVersionSourceKind::SwiftBinaryModule);
@@ -2915,12 +2885,6 @@ static std::string getContextHash(const CompilerInvocation &CI,
// Application extension.
unsigned(CI.getLangOptions().EnableAppExtensionRestrictions),
// Whether or not OSSA modules are enabled.
//
// If OSSA modules are enabled, we use a separate namespace of modules to
// ensure that we compile all swift interface files with the option set.
unsigned(CI.getSILOptions().EnableOSSAModules),
// Is the C++ interop enabled?
unsigned(CI.getLangOptions().EnableCXXInterop),

View File

@@ -391,7 +391,7 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
Invocation.getOutputFilename(), ABIPath, FEOpts.CacheReplayPrefixMap,
FEOpts.SerializeModuleInterfaceDependencyHashes,
FEOpts.shouldTrackSystemDependencies(), LoaderOpts,
RequireOSSAModules_t(Invocation.getSILOptions()), IgnoreAdjacentModules);
IgnoreAdjacentModules);
}
static bool compileLLVMIR(CompilerInstance &Instance) {
@@ -1754,7 +1754,7 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs,
serializationOpts.OutputPath = moduleOutputPath;
serializationOpts.SerializeAllSIL = true;
serializationOpts.IsSIB = true;
serializationOpts.IsOSSA = Context.SILOpts.EnableOSSAModules;
serializationOpts.IsOSSA = true;
symbolgraphgen::SymbolGraphOptions symbolGraphOptions;

View File

@@ -543,16 +543,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
if (!P.getOptions().EnableOSSAModules) {
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
return;
if (SILPrintFinalOSSAModule) {
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
}
P.addNonTransparentFunctionOwnershipModelEliminator();
}
switch (OpLevel) {
case OptimizationLevelKind::HighLevel:
// Does not inline functions with defined semantics or effects.
@@ -566,13 +556,11 @@ void addFunctionPasses(SILPassPipelinePlan &P,
}
// Clean up Semantic ARC before we perform additional post-inliner opts.
if (P.getOptions().EnableOSSAModules) {
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
// Promote stack allocations to values and eliminate redundant
// loads.
@@ -633,14 +621,12 @@ void addFunctionPasses(SILPassPipelinePlan &P,
P.addARCSequenceOpts();
// Run a final round of ARC opts when ownership is enabled.
if (P.getOptions().EnableOSSAModules) {
P.addDestroyHoisting();
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
P.addDestroyHoisting();
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
}
static void addPerfDebugSerializationPipeline(SILPassPipelinePlan &P) {
@@ -1022,13 +1008,11 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
// Run one last copy propagation/semantic arc opts run before serialization/us
// lowering ownership.
if (P.getOptions().EnableOSSAModules) {
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
P.addCrossModuleOptimization();
@@ -1042,10 +1026,9 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
if (Options.StopOptimizationAfterSerialization)
return P;
if (P.getOptions().EnableOSSAModules && SILPrintFinalOSSAModule) {
if (SILPrintFinalOSSAModule) {
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
}
// Strip any transparent functions that still have ownership.
P.addOwnershipModelEliminator();
P.addAutodiffClosureSpecialization();
@@ -1126,7 +1109,6 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
if (P.Options.StopOptimizationBeforeLoweringOwnership)
return P;
// Now strip any transparent functions that still have ownership.
P.addOwnershipModelEliminator();
// Finally perform some small transforms.

View File

@@ -669,10 +669,8 @@ class SILCombine : public SILFunctionTransform {
void run() override {
bool enableCopyPropagation =
getOptions().CopyPropagation >= CopyPropagationOption::Optimizing;
if (getOptions().EnableOSSAModules) {
enableCopyPropagation =
getOptions().CopyPropagation != CopyPropagationOption::Off;
}
enableCopyPropagation =
getOptions().CopyPropagation != CopyPropagationOption::Off;
SILCombiner Combiner(this, getOptions().RemoveRuntimeAsserts,
enableCopyPropagation);

View File

@@ -426,7 +426,7 @@ ModuleFile::getModuleName(ASTContext &Ctx, StringRef modulePath,
bool isFramework = false;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(newBuf), nullptr, nullptr,
/*isFramework=*/isFramework, Ctx.SILOpts.EnableOSSAModules,
/*isFramework=*/isFramework,
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile);
Name = loadedModuleFile->Name.str();

View File

@@ -242,7 +242,6 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
static ValidationInfo validateControlBlock(
llvm::BitstreamCursor &cursor, SmallVectorImpl<uint64_t> &scratch,
std::pair<uint16_t, uint16_t> expectedVersion,
bool requiresOSSAModules,
bool requiresRevisionMatch,
StringRef requiredSDK,
std::optional<llvm::Triple> target,
@@ -486,7 +485,7 @@ static ValidationInfo validateControlBlock(
}
case control_block::IS_OSSA: {
auto isModuleInOSSA = scratch[0];
if (requiresOSSAModules && !isModuleInOSSA)
if (!isModuleInOSSA)
result.status = Status::NotInOSSA;
break;
}
@@ -615,7 +614,7 @@ bool serialization::isSerializedAST(StringRef data) {
}
ValidationInfo serialization::validateSerializedAST(
StringRef data, bool requiresOSSAModules,
StringRef data,
StringRef requiredSDK,
ExtendedValidationInfo *extendedInfo,
SmallVectorImpl<SerializationOptions::FileDependency> *dependencies,
@@ -661,7 +660,6 @@ ValidationInfo serialization::validateSerializedAST(
result = validateControlBlock(
cursor, scratch,
{SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR},
requiresOSSAModules,
/*requiresRevisionMatch=*/true,
requiredSDK, target,
extendedInfo, localObfuscator);
@@ -1213,7 +1211,6 @@ bool ModuleFileSharedCore::readModuleDocIfPresent(PathObfuscator &pathRecoverer)
info = validateControlBlock(
docCursor, scratch, {SWIFTDOC_VERSION_MAJOR, SWIFTDOC_VERSION_MINOR},
RequiresOSSAModules,
/*requiresRevisionMatch*/false,
/*requiredSDK*/StringRef(), /*target*/std::nullopt,
/*extendedInfo*/nullptr, pathRecoverer);
@@ -1359,7 +1356,6 @@ bool ModuleFileSharedCore::readModuleSourceInfoIfPresent(PathObfuscator &pathRec
info = validateControlBlock(
infoCursor, scratch,
{SWIFTSOURCEINFO_VERSION_MAJOR, SWIFTSOURCEINFO_VERSION_MINOR},
RequiresOSSAModules,
/*requiresRevisionMatch*/false,
/*requiredSDK*/StringRef(), /*target*/std::nullopt,
/*extendedInfo*/nullptr, pathRecoverer);
@@ -1439,14 +1435,12 @@ ModuleFileSharedCore::ModuleFileSharedCore(
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework,
bool requiresOSSAModules,
StringRef requiredSDK,
std::optional<llvm::Triple> target,
serialization::ValidationInfo &info, PathObfuscator &pathRecoverer)
: ModuleInputBuffer(std::move(moduleInputBuffer)),
ModuleDocInputBuffer(std::move(moduleDocInputBuffer)),
ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)),
RequiresOSSAModules(requiresOSSAModules) {
ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)) {
assert(!hasError());
Bits.IsFramework = isFramework;
@@ -1493,7 +1487,6 @@ ModuleFileSharedCore::ModuleFileSharedCore(
info = validateControlBlock(
cursor, scratch,
{SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR},
RequiresOSSAModules,
/*requiresRevisionMatch=*/true, requiredSDK, target,
&extInfo, pathRecoverer);
if (info.status != Status::Valid) {

View File

@@ -114,9 +114,6 @@ class ModuleFileSharedCore {
/// \c true if this module has incremental dependency information.
bool HasIncrementalInfo = false;
/// \c true if this module was compiled with -enable-ossa-modules.
bool RequiresOSSAModules;
/// An array of module names that are allowed to import this one.
ArrayRef<StringRef> AllowableClientNames;
@@ -445,7 +442,6 @@ private:
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework,
bool requiresOSSAModules,
StringRef requiredSDK,
std::optional<llvm::Triple> target,
serialization::ValidationInfo &info, PathObfuscator &pathRecoverer);
@@ -573,8 +569,6 @@ public:
/// of the buffer, even if there's an error in loading.
/// \param isFramework If true, this is treated as a framework module for
/// linking purposes.
/// \param requiresOSSAModules If true, this requires dependent modules to be
/// compiled with -enable-ossa-modules.
/// \param requiredSDK A string denoting the name of the currently-used SDK,
/// to ensure that the loaded module was built with a compatible SDK.
/// \param target The target triple of the current compilation for
@@ -587,7 +581,7 @@ public:
std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework, bool requiresOSSAModules,
bool isFramework,
StringRef requiredSDK, std::optional<llvm::Triple> target,
PathObfuscator &pathRecoverer,
std::shared_ptr<const ModuleFileSharedCore> &theModule) {
@@ -595,7 +589,7 @@ public:
auto *core = new ModuleFileSharedCore(
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
std::move(moduleSourceInfoInputBuffer), isFramework,
requiresOSSAModules, requiredSDK, target, info,
requiredSDK, target, info,
pathRecoverer);
if (!moduleInterfacePath.empty()) {
ArrayRef<char> path;

View File

@@ -252,7 +252,7 @@ SwiftModuleScanner::scanInterfaceFile(Identifier moduleID,
if (adjacentBinaryModule != compiledCandidates.end()) {
auto adjacentBinaryModulePackageOnlyImports =
getMatchingPackageOnlyImportsOfModule(
*adjacentBinaryModule, isFramework, isRequiredOSSAModules(),
*adjacentBinaryModule, isFramework,
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
ScannerPackageName, Ctx.SourceMgr.getFileSystem().get(),
Ctx.SearchPathOpts.DeserializedPathRecoverer);
@@ -294,7 +294,7 @@ llvm::ErrorOr<ModuleDependencyInfo> SwiftModuleScanner::scanBinaryModuleFile(
std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework,
isRequiredOSSAModules(), Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile);
if (Ctx.SearchPathOpts.ScannerModuleValidation) {

View File

@@ -343,7 +343,7 @@ std::optional<std::string> SerializedModuleLoaderBase::invalidModuleReason(seria
llvm::ErrorOr<std::vector<ScannerImportStatementInfo>>
SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule(
Twine modulePath, bool isFramework, bool isRequiredOSSAModules,
Twine modulePath, bool isFramework,
StringRef SDKName, const llvm::Triple &target, StringRef packageName,
llvm::vfs::FileSystem *fileSystem, PathObfuscator &recoverer) {
auto moduleBuf = fileSystem->getBufferForFile(modulePath);
@@ -355,7 +355,7 @@ SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule(
std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework,
isRequiredOSSAModules, SDKName, target, recoverer, loadedModuleFile);
SDKName, target, recoverer, loadedModuleFile);
if (loadedModuleFile->getModulePackageName() != packageName)
return importedModuleNames;
@@ -953,7 +953,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
moduleInterfacePath, moduleInterfaceSourcePath,
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
std::move(moduleSourceInfoInputBuffer), isFramework,
isRequiredOSSAModules(),
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFileCore);
SerializedASTFile *fileUnit = nullptr;
@@ -1113,10 +1112,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
return fileUnit;
}
bool SerializedModuleLoaderBase::isRequiredOSSAModules() const {
return Ctx.SILOpts.EnableOSSAModules;
}
void swift::serialization::diagnoseSerializedASTLoadFailure(
ASTContext &Ctx, SourceLoc diagLoc,
const serialization::ValidationInfo &loadInfo,
@@ -1155,12 +1150,9 @@ void swift::serialization::diagnoseSerializedASTLoadFailure(
moduleBufferID);
break;
case serialization::Status::NotInOSSA:
if (Ctx.SerializationOpts.ExplicitModuleBuild ||
Ctx.SILOpts.EnableOSSAModules) {
Ctx.Diags.diagnose(diagLoc,
diag::serialization_non_ossa_module_incompatible,
ModuleName);
}
Ctx.Diags.diagnose(diagLoc,
diag::serialization_non_ossa_module_incompatible,
ModuleName);
break;
case serialization::Status::RevisionIncompatible:
Ctx.Diags.diagnose(diagLoc, diag::serialization_module_incompatible_revision,
@@ -1498,7 +1490,7 @@ std::unique_ptr<llvm::MemoryBuffer> swift::extractEmbeddedBridgingHeaderContent(
std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(file), nullptr, nullptr, false,
Context.SILOpts.EnableOSSAModules, Context.LangOpts.SDKName,
Context.LangOpts.SDKName,
Context.LangOpts.Target,
Context.SearchPathOpts.DeserializedPathRecoverer,
loadedModuleFile);
@@ -1553,7 +1545,7 @@ bool SerializedModuleLoaderBase::canImportModule(
if (moduleInputBuffer) {
auto metaData = serialization::validateSerializedAST(
moduleInputBuffer->getBuffer(), Ctx.SILOpts.EnableOSSAModules,
moduleInputBuffer->getBuffer(),
Ctx.LangOpts.SDKName);
// If we only found binary module, make sure that is valid.

View File

@@ -1920,9 +1920,6 @@ endfunction()
# INSTALL_WITH_SHARED
# Install a static library target alongside shared libraries
#
# IMPORTS_NON_OSSA
# Imports a non-ossa module
#
# MACCATALYST_BUILD_FLAVOR
# Possible values are 'ios-like', 'macos-like', 'zippered', 'unzippered-twin'
# Presence of a build flavor requires SWIFT_MODULE_DEPENDS_MACCATALYST to be
@@ -1984,8 +1981,7 @@ function(add_swift_target_library name)
SHARED
STATIC
NO_LINK_NAME
INSTALL_WITH_SHARED
IMPORTS_NON_OSSA)
INSTALL_WITH_SHARED)
set(SWIFTLIB_single_parameter_options
DEPLOYMENT_VERSION_IOS
DEPLOYMENT_VERSION_OSX
@@ -2150,10 +2146,6 @@ function(add_swift_target_library name)
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-enable-lexical-lifetimes=false")
endif()
if (NOT SWIFTLIB_IMPORTS_NON_OSSA)
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-enable-ossa-modules")
endif()
if(NOT DEFINED SWIFTLIB_INSTALL_BINARY_SWIFTMODULE)
set(SWIFTLIB_INSTALL_BINARY_SWIFTMODULE TRUE)
endif()

View File

@@ -25,7 +25,7 @@ set(swift_distributed_link_libraries
swiftCore)
add_swift_target_library(swiftDistributed ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IMPORTS_NON_OSSA
add_swift_target_library(swiftDistributed ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
DistributedActor.cpp
DistributedActor.swift
DistributedActorSystem.swift

View File

@@ -96,7 +96,7 @@ set(SWIFT_SYNCHRNOIZATION_SWIFT_FLAGS
"-strict-memory-safety"
)
add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IMPORTS_NON_OSSA
add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
${SWIFT_SYNCHRONIZATION_SOURCES}
GYB_SOURCES

View File

@@ -536,7 +536,6 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
GYB_SOURCES ${SWIFTLIB_EMBEDDED_GYB_SOURCES}
SWIFT_COMPILE_FLAGS
${swift_stdlib_compile_flags} -Xcc -ffreestanding -enable-experimental-feature Embedded
-Xfrontend -enable-ossa-modules
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
SDK "embedded"
ARCHITECTURE "${arch}"

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend %s -emit-sil -g -Osize -parse-stdlib -parse-as-library -enable-ossa-modules -o - | %FileCheck %s
// RUN: %target-swift-frontend %s -emit-sil -g -Osize -parse-stdlib -parse-as-library -o - | %FileCheck %s
// REQUIRES: asserts

View File

@@ -1,6 +1,5 @@
// RUN: %target-run-simple-swift(-Xfrontend -sil-verify-all)
// RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all)
// RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all -Xfrontend -enable-ossa-modules)
// REQUIRES: executable_test

View File

@@ -6,7 +6,6 @@
// RUN: %FileCheck %s --check-prefix=CHECK-IR
// RUN: %target-run-simple-swift(-parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all) | %FileCheck %s
// RUN: %target-run-simple-swift(-O -parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all) | %FileCheck %s
// RUN: %target-run-simple-swift(-O -parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all -Xfrontend -enable-ossa-modules) | %FileCheck %s
// REQUIRES: executable_test

View File

@@ -13,7 +13,7 @@
// RUN: %empty-directory(%t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule)
// RUN: %empty-directory(%t/PreBuiltSDKModules)
// RUN: %target-swift-frontend -c -emit-module-interface-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftinterface-name -emit-module-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftmodule-name -o %t/Swift.o -parse-stdlib -module-name Swift -enable-library-evolution -module-cache-path %t/TempModuleCacheLibrary -swift-version 5 %s -disable-objc-interop -enable-ossa-modules
// RUN: %target-swift-frontend -c -emit-module-interface-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftinterface-name -emit-module-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftmodule-name -o %t/Swift.o -parse-stdlib -module-name Swift -enable-library-evolution -module-cache-path %t/TempModuleCacheLibrary -swift-version 5 %s -disable-objc-interop
// RUN: %swift_build_sdk_interfaces_base -o %t/PreBuiltSDKModules -j 1 -sdk %t/SDK -module-cache-path %t/TempModuleCacheBuilder %t/SDK -v
@@ -23,7 +23,7 @@
// In this case also, we should not rebuild.
// RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-no-rebuild-remark.swift -verify -enable-ossa-modules
// RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-no-rebuild-remark.swift -verify
// Flaky hangs: rdar://77288690
// UNSUPPORTED: CPU=arm64, CPU=arm64e

View File

@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -O -enable-ossa-modules
// RUN: %target-sil-opt -enable-sil-verify-all -I %t -performance-linker -enable-ossa-modules -inline %s -o - | %FileCheck %s
// RUN: %target-swift-frontend %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -O
// RUN: %target-sil-opt -enable-sil-verify-all -I %t -performance-linker -inline %s -o - | %FileCheck %s
// CHECK: sil private @top_level_code
// CHECK: sil public_external [serialized] [ossa] @$ss1XVABycfC{{.*}}

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -O -parse-as-library -emit-sil -enable-ossa-modules %s | %FileCheck %s
// RUN: %target-swift-frontend -O -parse-as-library -emit-sil %s | %FileCheck %s
// REQUIRES: PTRSIZE=32,swift_stdlib_asserts
import Swift

View File

@@ -1,7 +1,7 @@
// RUN: %target-sil-opt -diagnostics -enable-sil-opaque-values %s | \
// RUN: %target-sil-opt -Onone-performance -enable-sil-verify-all \
// RUN: -enable-sil-opaque-values -emit-sorted-sil \
// RUN: -enable-ossa-modules -enable-copy-propagation \
// RUN: -enable-copy-propagation \
// RUN: -enable-lexical-borrow-scopes | \
// RUN: %FileCheck %s
//

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-sil -O -enable-ossa-modules -sil-verify-all %s
// RUN: %target-swift-frontend -emit-sil -O -sil-verify-all %s
// REQUIRES: OS=macosx
import Foundation

View File

@@ -1,8 +1,6 @@
// RUN: %target-swift-frontend -Osize -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation | %FileCheck %s
// RUN: %target-swift-frontend -Osize -g -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation | %FileCheck %s
// RUN: %target-swift-frontend -Osize -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation -enable-ossa-modules | %FileCheck %s
// RUN: %target-swift-frontend -Osize -g -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation -enable-ossa-modules | %FileCheck %s
// REQUIRES: objc_interop
// REQUIRES: optimized_stdlib
// REQUIRES: swift_in_compiler

View File

@@ -1,5 +1,4 @@
// RUN: %target-swift-frontend %s -O -Xllvm -sil-print-types -emit-sil | %FileCheck %s
// RUN: %target-swift-frontend %s -O -Xllvm -sil-print-types -enable-ossa-modules -emit-sil | %FileCheck %s
func curry<T1, T2, T3, T4>(_ f: @escaping (T1, T2, T3) -> T4) -> (T1) -> (T2) -> (T3) -> T4 {
return { x in { y in { z in f(x, y, z) } } }

View File

@@ -1,4 +1,4 @@
// RUN: %target-sil-opt -sil-print-types -enable-ossa-modules -enable-copy-propagation -enable-lexical-lifetimes=false -enable-sil-verify-all %s -sil-combine -sil-combine-disable-alloc-stack-opts | %FileCheck %s
// RUN: %target-sil-opt -sil-print-types -enable-copy-propagation -enable-lexical-lifetimes=false -enable-sil-verify-all %s -sil-combine -sil-combine-disable-alloc-stack-opts | %FileCheck %s
import Swift
import Builtin

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -O -enable-ossa-modules -Xllvm -sil-print-types -emit-sil -sil-verify-all -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s
// RUN: %target-swift-frontend -O -enable-ossa-modules -Xllvm -sil-print-types -emit-sil -Xllvm -sil-verify-force-analysis-around-pass=devirtualizer -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s
// RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -sil-verify-all -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s
// RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -Xllvm -sil-verify-force-analysis-around-pass=devirtualizer -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s
// REQUIRES: swift_in_compiler

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -O %s -enable-ossa-modules -emit-sil -o /dev/null
// RUN: %target-swift-frontend -O %s -emit-sil -o /dev/null
public class X {}

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -disable-availability-checking -enable-ossa-modules %s | %IRGenFileCheck %s
// RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -disable-availability-checking %s | %IRGenFileCheck %s
// REQUIRES: synchronization

View File

@@ -1,5 +1,4 @@
// RUN: %target-build-swift -O %s -module-name=test -Xfrontend -sil-verify-all -emit-sil | %FileCheck %s
// RUN: %target-build-swift -O %s -module-name=test -Xfrontend -sil-verify-all -emit-sil -Xfrontend -enable-ossa-modules | %FileCheck %s
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -O -module-name=test %s -o %t/a.out

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -module-name=test -O -enable-ossa-modules -Xllvm -sil-print-types -emit-sil %s | %FileCheck %s
// RUN: %target-swift-frontend -module-name=test -O -Xllvm -sil-print-types -emit-sil %s | %FileCheck %s
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -O -module-name=test %s -o %t/a.out

View File

@@ -1,21 +0,0 @@
// REQUIRES: objc_interop
// RUN: %empty-directory(%t)
// RUN: mkdir -p %t/clang-module-cache
// RUN: mkdir -p %t/Frameworks
// RUN: mkdir -p %t/Frameworks/E.framework/
// RUN: mkdir -p %t/Frameworks/E.framework/Modules
// RUN: mkdir -p %t/Frameworks/E.framework/Modules/E.swiftmodule
// Copy over the interface
// RUN: cp %S/Inputs/Swift/E.swiftinterface %t/Frameworks/E.framework/Modules/E.swiftmodule/%module-target-triple.swiftinterface
// Run the scan
// RUN: %target-swift-frontend -scan-dependencies -enable-ossa-modules -disable-implicit-swift-modules -module-load-mode prefer-interface %s -o %t/deps.json -F %t/Frameworks/ -sdk %t
// RUN: %validate-json %t/deps.json | %FileCheck %s
import E
// CHECK: E.swiftmodule/{{.*}}.swiftinterface
// CHECK: "commandLine": [
// CHECK: "-enable-ossa-modules"
// CHECK: ]

View File

@@ -1,5 +1,5 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -O -module-name Swift -module-link-name swiftCore -parse-as-library -parse-stdlib -emit-module %s -o %t/Swift.swiftmodule -enable-ossa-modules
// RUN: %target-swift-frontend -emit-module -O -module-name Swift -module-link-name swiftCore -parse-as-library -parse-stdlib -emit-module %s -o %t/Swift.swiftmodule
// RUN: %target-sil-opt -enable-sil-verify-all %t/Swift.swiftmodule -emit-sorted-sil -o - | %FileCheck %s
// Test that early serialization works as expected:

View File

@@ -6,7 +6,7 @@
// RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo
// MyModule is not embedded - error
// RUN: %target-swift-frontend -emit-module -enable-ossa-modules -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -wmo
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -wmo
// RUN: not %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo 2>&1 | %FileCheck %s --check-prefix CHECK-A
// main module is not embedded - error

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -enable-ossa-modules -o /dev/null | %target-sil-func-extractor -module-name="Swift" -enable-ossa-modules -func='$ss1XV4testyyF' | %FileCheck %s
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -enable-ossa-modules -o - | %target-sil-func-extractor -module-name="Swift" -enable-ossa-modules -func='$ss1XV4testyyF' | %FileCheck %s -check-prefix=SIB-CHECK
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-func-extractor -module-name="Swift" -func='$ss1XV4testyyF' | %FileCheck %s
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-func-extractor -module-name="Swift" -func='$ss1XV4testyyF' | %FileCheck %s -check-prefix=SIB-CHECK
// CHECK: import Builtin
// CHECK: import Swift

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -primary-file %s -enable-ossa-modules -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s
// RUN: %target-swift-frontend -primary-file %s -enable-ossa-modules -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s -check-prefix=SIB-CHECK
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s -check-prefix=SIB-CHECK
// CHECK: import Builtin
// CHECK: import Swift

View File

@@ -46,12 +46,12 @@ void anchorForGetMainExecutable() {}
using namespace llvm::MachO;
static bool validateModule(
llvm::StringRef data, bool Verbose, bool requiresOSSAModules,
llvm::StringRef data, bool Verbose,
swift::serialization::ValidationInfo &info,
swift::serialization::ExtendedValidationInfo &extendedInfo,
llvm::SmallVectorImpl<swift::serialization::SearchPath> &searchPaths) {
info = swift::serialization::validateSerializedAST(
data, requiresOSSAModules,
data,
/*requiredSDK*/ StringRef(), &extendedInfo, /* dependencies*/ nullptr,
&searchPaths);
if (info.status != swift::serialization::Status::Valid) {
@@ -284,9 +284,6 @@ int main(int argc, char **argv) {
opt<bool> QualifyTypes("qualify-types", desc("Qualify dumped types"),
cat(Visible));
opt<bool> EnableOSSAModules("enable-ossa-modules", init(false),
desc("Serialize modules in OSSA"), cat(Visible));
ParseCommandLineOptions(argc, argv);
// Unregister our options so they don't interfere with the command line
@@ -331,7 +328,6 @@ int main(int argc, char **argv) {
info = {};
extendedInfo = {};
if (!validateModule(StringRef(Module.first, Module.second), Verbose,
EnableOSSAModules,
info, extendedInfo, searchPaths)) {
llvm::errs() << "Malformed module!\n";
return 1;
@@ -355,7 +351,6 @@ int main(int argc, char **argv) {
Invocation.setModuleName("lldbtest");
Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath;
Invocation.getLangOptions().EnableMemoryBufferImporter = true;
Invocation.getSILOptions().EnableOSSAModules = EnableOSSAModules;
if (!ResourceDir.empty()) {
Invocation.setRuntimeResourcePath(ResourceDir);

View File

@@ -111,8 +111,7 @@ protected:
ctx->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>(*ctx, cacheDir,
prebuiltCacheDir, ModuleInterfaceLoaderOptions(),
swift::RequireOSSAModules_t(silOpts)));
prebuiltCacheDir, ModuleInterfaceLoaderOptions()));
auto loader = ModuleInterfaceLoader::create(
*ctx, *static_cast<ModuleInterfaceCheckerImpl*>(
@@ -152,7 +151,7 @@ protected:
auto bufData = (*bufOrErr)->getBuffer();
auto validationInfo = serialization::validateSerializedAST(
bufData, silOpts.EnableOSSAModules,
bufData,
/*requiredSDK*/StringRef());
ASSERT_EQ(serialization::Status::Valid, validationInfo.status);
ASSERT_EQ(bufData, moduleBuffer->getBuffer());