Skip to content

Commit bb83f84

Browse files
authored
Merge pull request #101 from lorentey/reorg
Reorganize sources for future work
2 parents b47c8b1 + 9db6c56 commit bb83f84

32 files changed

+1256
-1696
lines changed

Sources/Atomics/CMakeLists.txt

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,33 @@ See https://swift.org/LICENSE.txt for license information
88
#]]
99

1010
add_library(Atomics
11-
autogenerated/AtomicBool.swift
12-
autogenerated/AtomicLazyReference.swift
13-
autogenerated/HighLevelTypes.swift
14-
autogenerated/IntegerConformances.swift
15-
autogenerated/PointerConformances.swift
16-
autogenerated/Primitives.native.swift
17-
autogenerated/Primitives.shims.swift
18-
AtomicInteger.swift
19-
AtomicMemoryOrderings.swift
20-
AtomicOptional.swift
21-
AtomicOptionalRawRepresentable.swift
22-
AtomicRawRepresentable.swift
23-
AtomicStrongReference.swift
24-
AtomicValue.swift
25-
DoubleWord.swift
26-
"Unmanaged extensions.swift")
11+
"Types/UnsafeAtomicLazyReference.swift"
12+
"Types/IntegerOperations.swift.gyb"
13+
"Types/DoubleWord.swift"
14+
"Types/ManagedAtomic.swift"
15+
"Types/ManagedAtomicLazyReference.swift"
16+
"Types/AtomicMemoryOrderings.swift"
17+
"Types/UnsafeAtomic.swift"
18+
"Types/autogenerated/IntegerOperations.swift"
19+
"Unmanaged extensions.swift"
20+
"Primitives/Primitives.shims.swift.gyb"
21+
"Primitives/Primitives.native.swift.gyb"
22+
"Primitives/autogenerated/Primitives.native.swift"
23+
"Primitives/autogenerated/Primitives.shims.swift"
24+
"Conformances/RawRepresentable.swift"
25+
"Conformances/AtomicBool.swift.gyb"
26+
"Conformances/PointerConformances.swift.gyb"
27+
"Conformances/OptionalRawRepresentable.swift"
28+
"Conformances/IntegerConformances.swift.gyb"
29+
"Conformances/autogenerated/IntegerConformances.swift"
30+
"Conformances/autogenerated/PointerConformances.swift"
31+
"Conformances/autogenerated/AtomicBool.swift"
32+
"Protocols/AtomicInteger.swift"
33+
"Protocols/AtomicValue.swift"
34+
"Protocols/AtomicReference.swift"
35+
"Protocols/AtomicOptionalWrappable.swift"
36+
"Protocols/AtomicStorage.swift")
37+
2738
set_target_properties(Atomics PROPERTIES
2839
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
2940
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")

Sources/Atomics/AtomicBool.swift.gyb renamed to Sources/Atomics/Conformances/AtomicBool.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ extension ${construct} where Value == Bool {
232232
ordering: ordering)
233233
return original ${op} operand
234234
}
235+
235236
% end
236237
}
237238
% end

Sources/Atomics/autogenerated/AtomicBool.swift renamed to Sources/Atomics/Conformances/autogenerated/AtomicBool.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ extension UnsafeAtomic where Value == Bool {
302302
ordering: ordering)
303303
return original && operand
304304
}
305+
305306
/// Perform an atomic logical OR operation and return the original value, applying
306307
/// the specified memory ordering.
307308
///
@@ -320,6 +321,7 @@ extension UnsafeAtomic where Value == Bool {
320321
ordering: ordering)
321322
return original || operand
322323
}
324+
323325
/// Perform an atomic logical XOR operation and return the original value, applying
324326
/// the specified memory ordering.
325327
///
@@ -338,6 +340,7 @@ extension UnsafeAtomic where Value == Bool {
338340
ordering: ordering)
339341
return original != operand
340342
}
343+
341344
}
342345
extension ManagedAtomic where Value == Bool {
343346
/// Perform an atomic logical AND operation and return the original value, applying
@@ -412,6 +415,7 @@ extension ManagedAtomic where Value == Bool {
412415
ordering: ordering)
413416
return original && operand
414417
}
418+
415419
/// Perform an atomic logical OR operation and return the original value, applying
416420
/// the specified memory ordering.
417421
///
@@ -430,6 +434,7 @@ extension ManagedAtomic where Value == Bool {
430434
ordering: ordering)
431435
return original || operand
432436
}
437+
433438
/// Perform an atomic logical XOR operation and return the original value, applying
434439
/// the specified memory ordering.
435440
///
@@ -448,4 +453,5 @@ extension ManagedAtomic where Value == Bool {
448453
ordering: ordering)
449454
return original != operand
450455
}
456+
451457
}

Sources/Atomics/autogenerated/IntegerConformances.swift renamed to Sources/Atomics/Conformances/autogenerated/IntegerConformances.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@ extension UInt.AtomicRepresentation: AtomicIntegerStorage {
20922092

20932093

20942094

2095-
#if arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)
2095+
#if (compiler(>=5.9) && _pointerBitWidth(_32)) || (compiler(<5.9) && (arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)))
20962096
extension DoubleWord: AtomicValue {
20972097
@frozen
20982098
public struct AtomicRepresentation {
@@ -2229,7 +2229,7 @@ extension DoubleWord.AtomicRepresentation: AtomicStorage {
22292229

22302230

22312231

2232-
#else /* arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32) */
2232+
#else /* (compiler(>=5.9) && _pointerBitWidth(_32)) || (compiler(<5.9) && (arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32))) */
22332233
extension DoubleWord: AtomicValue {
22342234
@frozen
22352235
public struct AtomicRepresentation {
@@ -2363,5 +2363,5 @@ extension DoubleWord.AtomicRepresentation: AtomicStorage {
23632363
}
23642364
}
23652365

2366-
#endif /* arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32) */
2366+
#endif /* (compiler(>=5.9) && _pointerBitWidth(_32)) || (compiler(<5.9) && (arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32))) */
23672367

Sources/Atomics/Primitives.native.swift.gyb renamed to Sources/Atomics/Primitives/Primitives.native.swift.gyb

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,57 +18,9 @@ ${autogenerated_warning()}
1818
#if ATOMICS_NATIVE_BUILTINS
1919
import Builtin
2020

21-
#if ${ptrBitWidth32}
22-
@frozen
23-
@_alignment(8)
24-
public struct DoubleWord {
25-
@usableFromInline
26-
internal typealias _Builtin = Builtin.Int64
27-
28-
public var first: UInt
29-
public var second: UInt
30-
31-
@inlinable @inline(__always)
32-
public init(first: UInt, second: UInt) {
33-
self.first = first
34-
self.second = second
35-
}
36-
}
37-
#else
38-
@frozen
39-
@_alignment(16)
40-
public struct DoubleWord {
41-
@usableFromInline
42-
internal typealias _Builtin = Builtin.Int128
43-
44-
public var first: UInt
45-
public var second: UInt
46-
47-
@inlinable @inline(__always)
48-
public init(first: UInt, second: UInt) {
49-
self.first = first
50-
self.second = second
51-
}
52-
}
53-
#endif
54-
55-
extension DoubleWord {
56-
@_alwaysEmitIntoClient
57-
@inline(__always)
58-
internal init(_ builtin: _Builtin) {
59-
self = unsafeBitCast(builtin, to: DoubleWord.self)
60-
}
61-
62-
@_alwaysEmitIntoClient
63-
@inline(__always)
64-
internal var _value: _Builtin {
65-
unsafeBitCast(self, to: _Builtin.self)
66-
}
67-
}
68-
6921
extension Bool {
7022
@_alwaysEmitIntoClient
71-
@inline(__always)
23+
@_transparent
7224
internal init(_ builtin: Builtin.Int1) {
7325
self = unsafeBitCast(builtin, to: Bool.self)
7426
}

0 commit comments

Comments
 (0)