Skip to content

Commit c0a55e1

Browse files
authored
Merge pull request #77314 from meg-gupta/ossaflag
Remove -enable-ossa-modules for Synchronization and Distributed
2 parents 43839ac + d55146c commit c0a55e1

32 files changed

+265
-188
lines changed

include/swift/AST/ASTContext.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
#include "swift/AST/Type.h"
2828
#include "swift/AST/TypeAlignments.h"
2929
#include "swift/AST/Types.h"
30+
#include "swift/Basic/BlockList.h"
3031
#include "swift/Basic/CASOptions.h"
3132
#include "swift/Basic/LangOptions.h"
3233
#include "swift/Basic/Located.h"
3334
#include "swift/Basic/Malloc.h"
34-
#include "swift/Basic/BlockList.h"
35+
#include "swift/Serialization/SerializationOptions.h"
3536
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
3637
#include "clang/AST/DeclTemplate.h"
3738
#include "clang/Basic/DarwinSDKInfo.h"
@@ -266,7 +267,8 @@ class ASTContext final {
266267
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
267268
ClangImporterOptions &ClangImporterOpts,
268269
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
269-
SourceManager &SourceMgr, DiagnosticEngine &Diags,
270+
SerializationOptions &serializationOpts, SourceManager &SourceMgr,
271+
DiagnosticEngine &Diags,
270272
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend = nullptr);
271273

272274
public:
@@ -283,7 +285,8 @@ class ASTContext final {
283285
SILOptions &silOpts, SearchPathOptions &SearchPathOpts,
284286
ClangImporterOptions &ClangImporterOpts,
285287
symbolgraphgen::SymbolGraphOptions &SymbolGraphOpts, CASOptions &casOpts,
286-
SourceManager &SourceMgr, DiagnosticEngine &Diags,
288+
SerializationOptions &serializationOpts, SourceManager &SourceMgr,
289+
DiagnosticEngine &Diags,
287290
llvm::IntrusiveRefCntPtr<llvm::vfs::OutputBackend> OutBackend = nullptr);
288291
~ASTContext();
289292

@@ -314,6 +317,9 @@ class ASTContext final {
314317
/// The CAS options used by this AST context.
315318
const CASOptions &CASOpts;
316319

320+
/// Options for Serialization
321+
const SerializationOptions &SerializationOpts;
322+
317323
/// The source manager object.
318324
SourceManager &SourceMgr;
319325

include/swift/AST/DeclAttr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ DECL_ATTR(_semantics, Semantics,
102102
OnAbstractFunction | OnSubscript | OnNominalType | OnVar | AllowMultipleAttributes | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
103103
21)
104104
SIMPLE_DECL_ATTR(_transparent, Transparent,
105-
OnFunc | OnAccessor | OnConstructor | OnVar | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
105+
OnFunc | OnAccessor | OnConstructor | OnVar | OnDestructor | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
106106
26)
107107
SIMPLE_DECL_ATTR(requires_stored_property_inits, RequiresStoredPropertyInits,
108108
OnClass | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,9 @@ ERROR(serialization_target_too_new_repl,none,
908908
"deployment target of %0 %3: %4",
909909
(StringRef, llvm::VersionTuple, Identifier, llvm::VersionTuple,
910910
StringRef))
911+
ERROR(serialization_non_ossa_module_incompatible, Fatal,
912+
"cannot import non-OSSA module into an OSSA module",
913+
(Identifier))
911914

912915
ERROR(serialization_fatal,Fatal,
913916
"fatal error encountered while reading from module '%0'; "

include/swift/AST/SILOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ class SILOptions {
188188
/// If this is disabled we do not serialize in OSSA form when optimizing.
189189
bool EnableOSSAModules = false;
190190

191+
/// Allow recompilation of a non-OSSA module to an OSSA module when imported
192+
/// from another OSSA module.
193+
bool EnableRecompilationToOSSAModule = false;
194+
191195
/// If set to true, compile with the SIL Opaque Values enabled.
192196
bool EnableSILOpaqueValues = false;
193197

include/swift/Frontend/Frontend.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class CompilerInvocation {
103103
TBDGenOptions TBDGenOpts;
104104
ModuleInterfaceOptions ModuleInterfaceOpts;
105105
CASOptions CASOpts;
106+
SerializationOptions SerializationOpts;
106107
llvm::MemoryBuffer *IDEInspectionTargetBuffer = nullptr;
107108

108109
/// The offset that IDEInspection wants to further examine in offset of bytes
@@ -326,6 +327,11 @@ class CompilerInvocation {
326327
IRGenOptions &getIRGenOptions() { return IRGenOpts; }
327328
const IRGenOptions &getIRGenOptions() const { return IRGenOpts; }
328329

330+
SerializationOptions &getSerializationOptions() { return SerializationOpts; }
331+
const SerializationOptions &getSerializationOptions() const {
332+
return SerializationOpts;
333+
}
334+
329335
void setParseStdlib() {
330336
FrontendOpts.ParseStdlib = true;
331337
}

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,9 @@ let Flags = [FrontendOption, NoDriverOption, HelpHidden, ModuleInterfaceOptionIg
12261226
"when optimizing ownership will be lowered before serializing SIL">;
12271227
}
12281228

1229+
def enable_recompilation_to_ossa_module : Flag<["-"], "enable-recompilation-to-ossa-module">,
1230+
HelpText<"Allow recompilation of a non-OSSA module to an OSSA module when imported from another OSSA module">;
1231+
12291232
def enable_sil_opaque_values : Flag<["-"], "enable-sil-opaque-values">,
12301233
HelpText<"Enable SIL Opaque Values">;
12311234

include/swift/Serialization/SerializationOptions.h

Lines changed: 135 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -24,144 +24,144 @@
2424

2525
namespace swift {
2626

27-
class SerializationOptions {
28-
SerializationOptions(const SerializationOptions &) = delete;
29-
void operator=(const SerializationOptions &) = delete;
27+
class SerializationOptions {
28+
public:
29+
SerializationOptions() = default;
30+
SerializationOptions(SerializationOptions &&) = default;
31+
SerializationOptions &operator=(SerializationOptions &&) = default;
32+
SerializationOptions(const SerializationOptions &) = default;
33+
SerializationOptions &operator=(const SerializationOptions &) = default;
34+
~SerializationOptions() = default;
35+
36+
StringRef OutputPath;
37+
StringRef DocOutputPath;
38+
StringRef SourceInfoOutputPath;
39+
std::string ABIDescriptorPath;
40+
bool emptyABIDescriptor = false;
41+
llvm::VersionTuple UserModuleVersion;
42+
std::set<std::string> AllowableClients;
43+
std::string SDKName;
44+
std::string SDKVersion;
45+
46+
StringRef GroupInfoPath;
47+
StringRef ImportedHeader;
48+
StringRef ModuleLinkName;
49+
StringRef ModuleInterface;
50+
std::vector<std::string> ExtraClangOptions;
51+
std::vector<swift::PluginSearchOption> PluginSearchOptions;
52+
53+
/// Path prefixes that should be rewritten in debug info.
54+
PathRemapper DebuggingOptionsPrefixMap;
55+
56+
/// Obfuscate the serialized paths so we don't have the actual paths encoded
57+
/// in the .swiftmodule file.
58+
PathObfuscator PathObfuscator;
59+
60+
/// Describes a single-file dependency for this module, along with the
61+
/// appropriate strategy for how to verify if it's up-to-date.
62+
class FileDependency {
63+
/// The size of the file on disk, in bytes.
64+
uint64_t Size : 62;
65+
66+
/// A dependency can be either hash-based or modification-time-based.
67+
bool IsHashBased : 1;
68+
69+
/// The dependency path can be absolute or relative to the SDK
70+
bool IsSDKRelative : 1;
71+
72+
union {
73+
/// The last modification time of the file.
74+
uint64_t ModificationTime;
75+
76+
/// The xxHash of the full contents of the file.
77+
uint64_t ContentHash;
78+
};
79+
80+
/// The path to the dependency.
81+
std::string Path;
82+
83+
FileDependency(uint64_t size, bool isHash, uint64_t hashOrModTime,
84+
StringRef path, bool isSDKRelative)
85+
: Size(size), IsHashBased(isHash), IsSDKRelative(isSDKRelative),
86+
ModificationTime(hashOrModTime), Path(path) {}
3087

3188
public:
32-
SerializationOptions() = default;
33-
SerializationOptions(SerializationOptions &&) = default;
34-
SerializationOptions &operator=(SerializationOptions &&) = default;
35-
~SerializationOptions() = default;
36-
37-
StringRef OutputPath;
38-
StringRef DocOutputPath;
39-
StringRef SourceInfoOutputPath;
40-
std::string ABIDescriptorPath;
41-
bool emptyABIDescriptor = false;
42-
llvm::VersionTuple UserModuleVersion;
43-
std::set<std::string> AllowableClients;
44-
std::string SDKName;
45-
std::string SDKVersion;
46-
47-
StringRef GroupInfoPath;
48-
StringRef ImportedHeader;
49-
StringRef ModuleLinkName;
50-
StringRef ModuleInterface;
51-
std::vector<std::string> ExtraClangOptions;
52-
std::vector<swift::PluginSearchOption> PluginSearchOptions;
53-
54-
/// Path prefixes that should be rewritten in debug info.
55-
PathRemapper DebuggingOptionsPrefixMap;
56-
57-
/// Obfuscate the serialized paths so we don't have the actual paths encoded
58-
/// in the .swiftmodule file.
59-
PathObfuscator PathObfuscator;
60-
61-
/// Describes a single-file dependency for this module, along with the
62-
/// appropriate strategy for how to verify if it's up-to-date.
63-
class FileDependency {
64-
/// The size of the file on disk, in bytes.
65-
uint64_t Size : 62;
66-
67-
/// A dependency can be either hash-based or modification-time-based.
68-
bool IsHashBased : 1;
69-
70-
/// The dependency path can be absolute or relative to the SDK
71-
bool IsSDKRelative : 1;
72-
73-
union {
74-
/// The last modification time of the file.
75-
uint64_t ModificationTime;
76-
77-
/// The xxHash of the full contents of the file.
78-
uint64_t ContentHash;
79-
};
80-
81-
/// The path to the dependency.
82-
std::string Path;
83-
84-
FileDependency(uint64_t size, bool isHash, uint64_t hashOrModTime,
85-
StringRef path, bool isSDKRelative):
86-
Size(size), IsHashBased(isHash), IsSDKRelative(isSDKRelative),
87-
ModificationTime(hashOrModTime), Path(path) {}
88-
public:
89-
FileDependency() = delete;
90-
91-
/// Creates a new hash-based file dependency.
92-
static FileDependency
93-
hashBased(StringRef path, bool isSDKRelative, uint64_t size, uint64_t hash) {
94-
return FileDependency(size, /*isHash*/true, hash, path, isSDKRelative);
95-
}
96-
97-
/// Creates a new modification time-based file dependency.
98-
static FileDependency
99-
modTimeBased(StringRef path, bool isSDKRelative, uint64_t size, uint64_t mtime) {
100-
return FileDependency(size, /*isHash*/false, mtime, path, isSDKRelative);
101-
}
102-
103-
/// Updates the last-modified time of this dependency.
104-
/// If the dependency is a hash-based dependency, it becomes
105-
/// modification time-based.
106-
void setLastModificationTime(uint64_t mtime) {
107-
IsHashBased = false;
108-
ModificationTime = mtime;
109-
}
110-
111-
/// Updates the content hash of this dependency.
112-
/// If the dependency is a modification time-based dependency, it becomes
113-
/// hash-based.
114-
void setContentHash(uint64_t hash) {
115-
IsHashBased = true;
116-
ContentHash = hash;
117-
}
118-
119-
/// Determines if this dependency is hash-based and should be validated
120-
/// based on content hash.
121-
bool isHashBased() const { return IsHashBased; }
122-
123-
/// Determines if this dependency is absolute or relative to the SDK.
124-
bool isSDKRelative() const { return IsSDKRelative; }
125-
126-
/// Determines if this dependency is hash-based and should be validated
127-
/// based on modification time.
128-
bool isModificationTimeBased() const { return !IsHashBased; }
129-
130-
/// Gets the modification time, if this is a modification time-based
131-
/// dependency.
132-
uint64_t getModificationTime() const {
133-
assert(isModificationTimeBased() &&
134-
"cannot get modification time for hash-based dependency");
135-
return ModificationTime;
136-
}
137-
138-
/// Gets the content hash, if this is a hash-based
139-
/// dependency.
140-
uint64_t getContentHash() const {
141-
assert(isHashBased() &&
142-
"cannot get content hash for mtime-based dependency");
143-
return ContentHash;
144-
}
145-
146-
StringRef getPath() const { return Path; }
147-
uint64_t getSize() const { return Size; }
148-
};
149-
ArrayRef<FileDependency> Dependencies;
150-
ArrayRef<std::string> PublicDependentLibraries;
151-
152-
bool AutolinkForceLoad = false;
153-
bool SerializeAllSIL = false;
154-
bool SerializeOptionsForDebugging = false;
155-
bool IsSIB = false;
156-
bool DisableCrossModuleIncrementalInfo = false;
157-
bool StaticLibrary = false;
158-
bool HermeticSealAtLink = false;
159-
bool EmbeddedSwiftModule = false;
160-
bool IsOSSA = false;
161-
bool SkipNonExportableDecls = false;
162-
bool ExplicitModuleBuild = false;
163-
bool EnableSerializationRemarks = false;
89+
FileDependency() = delete;
90+
91+
/// Creates a new hash-based file dependency.
92+
static FileDependency hashBased(StringRef path, bool isSDKRelative,
93+
uint64_t size, uint64_t hash) {
94+
return FileDependency(size, /*isHash*/ true, hash, path, isSDKRelative);
95+
}
96+
97+
/// Creates a new modification time-based file dependency.
98+
static FileDependency modTimeBased(StringRef path, bool isSDKRelative,
99+
uint64_t size, uint64_t mtime) {
100+
return FileDependency(size, /*isHash*/ false, mtime, path, isSDKRelative);
101+
}
102+
103+
/// Updates the last-modified time of this dependency.
104+
/// If the dependency is a hash-based dependency, it becomes
105+
/// modification time-based.
106+
void setLastModificationTime(uint64_t mtime) {
107+
IsHashBased = false;
108+
ModificationTime = mtime;
109+
}
110+
111+
/// Updates the content hash of this dependency.
112+
/// If the dependency is a modification time-based dependency, it becomes
113+
/// hash-based.
114+
void setContentHash(uint64_t hash) {
115+
IsHashBased = true;
116+
ContentHash = hash;
117+
}
118+
119+
/// Determines if this dependency is hash-based and should be validated
120+
/// based on content hash.
121+
bool isHashBased() const { return IsHashBased; }
122+
123+
/// Determines if this dependency is absolute or relative to the SDK.
124+
bool isSDKRelative() const { return IsSDKRelative; }
125+
126+
/// Determines if this dependency is hash-based and should be validated
127+
/// based on modification time.
128+
bool isModificationTimeBased() const { return !IsHashBased; }
129+
130+
/// Gets the modification time, if this is a modification time-based
131+
/// dependency.
132+
uint64_t getModificationTime() const {
133+
assert(isModificationTimeBased() &&
134+
"cannot get modification time for hash-based dependency");
135+
return ModificationTime;
136+
}
137+
138+
/// Gets the content hash, if this is a hash-based
139+
/// dependency.
140+
uint64_t getContentHash() const {
141+
assert(isHashBased() &&
142+
"cannot get content hash for mtime-based dependency");
143+
return ContentHash;
144+
}
145+
146+
StringRef getPath() const { return Path; }
147+
uint64_t getSize() const { return Size; }
164148
};
149+
ArrayRef<FileDependency> Dependencies;
150+
ArrayRef<std::string> PublicDependentLibraries;
151+
152+
bool AutolinkForceLoad = false;
153+
bool SerializeAllSIL = false;
154+
bool SerializeOptionsForDebugging = false;
155+
bool IsSIB = false;
156+
bool DisableCrossModuleIncrementalInfo = false;
157+
bool StaticLibrary = false;
158+
bool HermeticSealAtLink = false;
159+
bool EmbeddedSwiftModule = false;
160+
bool IsOSSA = false;
161+
bool SkipNonExportableDecls = false;
162+
bool ExplicitModuleBuild = false;
163+
bool EnableSerializationRemarks = false;
164+
};
165165

166166
} // end namespace swift
167167
#endif

0 commit comments

Comments
 (0)