Skip to content

Commit ed227e8

Browse files
Steelskincompnerd
authored andcommitted
Rebranch: Disable some optimizations on Windows
There is a bug in the Swift rebranch that prevents some functions from being optimized in a way that the assembler can handle. This temporarily disables optimizations for these functions until a permanent solution is implemented. Bug: swiftlang/llvm-project#11377
1 parent 4592649 commit ed227e8

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ extension ManifestLoaderProtocol {
202202
) async throws -> Manifest {
203203
// find the manifest path and parse it's tools-version
204204
let manifestPath = try ManifestLoader.findManifest(
205-
packagePath: packagePath,
206-
fileSystem: fileSystem,
205+
packagePath: packagePath,
206+
fileSystem: fileSystem,
207207
currentToolsVersion: currentToolsVersion
208208
)
209209
let manifestToolsVersion = try ToolsVersionParser.parse(manifestPath: manifestPath, fileSystem: fileSystem)
210210
// validate the manifest tools-version against the toolchain tools-version
211211
try manifestToolsVersion.validateToolsVersion(
212-
currentToolsVersion,
213-
packageIdentity: packageIdentity,
212+
currentToolsVersion,
213+
packageIdentity: packageIdentity,
214214
packageVersion: packageVersion?.version?.description ?? packageVersion?.revision
215215
)
216216

@@ -259,7 +259,7 @@ actor ManifestCacheActor {
259259
/// `atexit()` handler) which is then deserialized and loaded.
260260
public final class ManifestLoader: ManifestLoaderProtocol {
261261
public typealias Delegate = ManifestLoaderDelegate
262-
262+
263263
private let toolchain: UserToolchain
264264
private let serializedDiagnostics: Bool
265265
private let isManifestSandboxEnabled: Bool
@@ -298,7 +298,7 @@ public final class ManifestLoader: ManifestLoaderProtocol {
298298
self.databaseCacheDir = try? cacheDir.map(resolveSymlinks)
299299
self.pruneDependencies = pruneDependencies
300300
}
301-
301+
302302
public func load(
303303
manifestPath: AbsolutePath,
304304
manifestToolsVersion: ToolsVersion,
@@ -476,7 +476,6 @@ public final class ManifestLoader: ManifestLoaderProtocol {
476476
delegate: Delegate?,
477477
delegateQueue: DispatchQueue?
478478
) async throws -> ManifestJSONParser.Result {
479-
480479
let key = try CacheKey(
481480
packageIdentity: packageIdentity,
482481
packageLocation: packageLocation,
@@ -677,10 +676,14 @@ public final class ManifestLoader: ManifestLoaderProtocol {
677676

678677
return result
679678
}
680-
681679
}
682680

683681
/// Helper method for evaluating the manifest.
682+
// TODO: Optimizations are disabled to work around a compiler bug. Remove this attribute when the bug is fixed.
683+
// See https://github.com/swiftlang/llvm-project/issues/11377 for details.
684+
#if os(Windows)
685+
@_optimize(none)
686+
#endif
684687
func evaluateManifest(
685688
at manifestPath: AbsolutePath,
686689
vfsOverlayPath: AbsolutePath? = nil,

Sources/PackageRegistryCommand/PackageRegistryCommand+Publish.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,11 @@ enum PackageArchiveSigner {
461461
}
462462

463463
enum PackageArchiver {
464+
// TODO: Optimizations are disabled to work around a compiler bug. Remove this attribute when the bug is fixed.
465+
// See https://github.com/swiftlang/llvm-project/issues/11377 for details.
466+
#if os(Windows)
467+
@_optimize(none)
468+
#endif
464469
static func archive(
465470
packageIdentity: PackageIdentity,
466471
packageVersion: Version,

Sources/Workspace/Workspace+Prebuilts.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ extension Workspace {
422422
return hash == checksum
423423
}
424424

425+
// TODO: Optimizations are disabled to work around a compiler bug. Remove this attribute when the bug is fixed.
426+
// See https://github.com/swiftlang/llvm-project/issues/11377 for details.
427+
#if os(Windows)
428+
@_optimize(none)
429+
#endif
425430
func downloadPrebuilt(
426431
workspace: Workspace,
427432
package: PrebuiltPackage,

0 commit comments

Comments
 (0)