Skip to content

Commit 581fb9e

Browse files
committed
Drop support for Swifts 5.7-5.9
As usual, we support just the three latest Swift releases: 5.10, 6.0 and 6.1. Also delete obsolete C atomics. Dropping Swifts <5.9 allows us to make ATOMICS_NATIVE_BUILTINS the unconditional default behavior.
1 parent 239a74d commit 581fb9e

22 files changed

+11
-3900
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ set(ATOMICS_C_FLAGS)
3131
if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.9)
3232
list(APPEND ATOMICS_SWIFT_FLAGS
3333
"-enable-experimental-feature BuiltinModule"
34-
"-DATOMICS_NATIVE_BUILTINS"
35-
"-Xcc" "-DATOMICS_NATIVE_BUILTINS=1")
36-
list(APPEND ATOMICS_C_FLAGS
37-
"-DATOMICS_NATIVE_BUILTINS=1")
34+
)
3835
endif()
3936

4037
add_subdirectory(Sources)

Package.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version:5.10
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the Swift.org open source project
@@ -18,10 +18,8 @@ var _swiftSettings: [SwiftSetting] = []
1818

1919
// Enable the use of native Swift compiler builtins instead of C atomics.
2020
_cSettings += [
21-
.define("ATOMICS_NATIVE_BUILTINS"),
2221
]
2322
_swiftSettings += [
24-
.define("ATOMICS_NATIVE_BUILTINS"),
2523
.enableExperimentalFeature("BuiltinModule")
2624
]
2725

@@ -48,7 +46,6 @@ let package = Package(
4846
"Conformances/IntegerConformances.swift.gyb",
4947
"Conformances/PointerConformances.swift.gyb",
5048
"Primitives/Primitives.native.swift.gyb",
51-
"Primitives/Primitives.shims.swift.gyb",
5249
"Types/IntegerOperations.swift.gyb",
5350
],
5451
cSettings: _cSettings,

[email protected]

Lines changed: 0 additions & 87 deletions
This file was deleted.

[email protected]

Lines changed: 0 additions & 87 deletions
This file was deleted.

Sources/Atomics/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ add_library(Atomics
1717
"Types/autogenerated/IntegerOperations.swift"
1818
"Unmanaged extensions.swift"
1919
"Primitives/autogenerated/Primitives.native.swift"
20-
"Primitives/autogenerated/Primitives.shims.swift"
2120
"Conformances/RawRepresentable.swift"
2221
"Conformances/OptionalRawRepresentable.swift"
2322
"Conformances/autogenerated/IntegerConformances.swift"

Sources/Atomics/Conformances/AtomicBool.swift.gyb

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
}%
1717
${autogenerated_warning()}
1818

19-
#if ATOMICS_NATIVE_BUILTINS
2019
import Builtin
2120

2221
extension Bool {
@@ -26,9 +25,6 @@ extension Bool {
2625
self = unsafeBitCast(builtin, to: Bool.self)
2726
}
2827
}
29-
#else
30-
import _AtomicsShims
31-
#endif
3228

3329
extension Bool: AtomicValue {
3430
@frozen
@@ -43,25 +39,16 @@ extension Bool: AtomicValue {
4339

4440
@_transparent @_alwaysEmitIntoClient
4541
public init(_ value: Bool) {
46-
#if ATOMICS_NATIVE_BUILTINS
4742
_storage = value._atomicRepresentation
48-
#else
49-
_storage = _sa_prepare_Int8(value._atomicRepresentation)
50-
#endif
5143
}
5244

5345
@_transparent @_alwaysEmitIntoClient
5446
public func dispose() -> Value {
55-
#if ATOMICS_NATIVE_BUILTINS
5647
return _storage._decodeBool
57-
#else
58-
return _sa_dispose_Int8(_storage)._decodeBool
59-
#endif
6048
}
6149
}
6250
}
6351

64-
#if ATOMICS_NATIVE_BUILTINS
6552
extension Bool {
6653
@_transparent @_alwaysEmitIntoClient
6754
internal var _atomicRepresentation: _AtomicInt8Storage {
@@ -76,21 +63,6 @@ extension _AtomicInt8Storage {
7663
(Int8(self._value) & 1) != 0
7764
}
7865
}
79-
#else
80-
extension Bool {
81-
@_transparent @_alwaysEmitIntoClient
82-
internal var _atomicRepresentation: Int8 {
83-
self ? 1 : 0
84-
}
85-
}
86-
87-
extension Int8 {
88-
@_transparent @_alwaysEmitIntoClient
89-
internal var _decodeBool: Bool {
90-
(self & 1) != 0
91-
}
92-
}
93-
#endif
9466

9567
extension UnsafeMutablePointer
9668
where Pointee == Bool.AtomicRepresentation {

Sources/Atomics/Conformances/IntegerConformances.swift.gyb

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
}%
3030
${autogenerated_warning()}
3131

32-
#if !ATOMICS_NATIVE_BUILTINS
33-
import _AtomicsShims
34-
#endif
35-
3632
% for (swiftType, storageType, shimType) in integerTypes:
3733

3834
extension ${swiftType}: AtomicValue {
@@ -48,20 +44,12 @@ extension ${swiftType}: AtomicValue {
4844

4945
@_transparent @_alwaysEmitIntoClient
5046
public init(_ value: Value) {
51-
#if ATOMICS_NATIVE_BUILTINS
5247
_storage = Self._encode(value)
53-
#else
54-
_storage = _sa_prepare_${shimType}(Self._encode(value))
55-
#endif
5648
}
5749

5850
@_transparent @_alwaysEmitIntoClient
5951
public func dispose() -> Value {
60-
#if ATOMICS_NATIVE_BUILTINS
6152
return Self._decode(_storage)
62-
#else
63-
return Self._decode(_sa_dispose_${shimType}(_storage))
64-
#endif
6553
}
6654
}
6755
}
@@ -76,7 +64,6 @@ where Pointee == ${swiftType}.AtomicRepresentation {
7664
}
7765
}
7866

79-
#if ATOMICS_NATIVE_BUILTINS
8067
extension ${swiftType}.AtomicRepresentation {
8168
@_transparent @_alwaysEmitIntoClient
8269
static func _decode(_ storage: _Storage) -> Value {
@@ -88,27 +75,6 @@ extension ${swiftType}.AtomicRepresentation {
8875
return _Storage(value._value)
8976
}
9077
}
91-
#else
92-
extension ${swiftType}.AtomicRepresentation {
93-
@_transparent @_alwaysEmitIntoClient
94-
static func _decode(_ v: ${shimType}) -> Value {
95-
% if swiftType == shimType:
96-
return v
97-
% else:
98-
return Value(v._value)
99-
% end
100-
}
101-
102-
@_transparent @_alwaysEmitIntoClient
103-
static func _encode(_ value: Value) -> ${shimType} {
104-
% if swiftType == shimType:
105-
return value
106-
% else:
107-
return ${shimType}(value._value)
108-
% end
109-
}
110-
}
111-
#endif
11278

11379
extension ${swiftType}.AtomicRepresentation: AtomicStorage {
11480
@_semantics("atomics.requires_constant_orderings")

0 commit comments

Comments
 (0)