mirror of
https://github.com/apple/swift-atomics
synced 2026-11-22 04:20:39 +00:00
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.
This commit is contained in:
22 files changed
+11
-3900
No files matched your search
+1
-4
@@ -31,10 +31,7 @@ set(ATOMICS_C_FLAGS)
|
||||
if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.9)
|
||||
list(APPEND ATOMICS_SWIFT_FLAGS
|
||||
"-enable-experimental-feature BuiltinModule"
|
||||
"-DATOMICS_NATIVE_BUILTINS"
|
||||
"-Xcc" "-DATOMICS_NATIVE_BUILTINS=1")
|
||||
list(APPEND ATOMICS_C_FLAGS
|
||||
"-DATOMICS_NATIVE_BUILTINS=1")
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(Sources)
|
||||
|
||||
+1
-4
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:5.9
|
||||
// swift-tools-version:5.10
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
@@ -18,10 +18,8 @@ var _swiftSettings: [SwiftSetting] = []
|
||||
|
||||
// Enable the use of native Swift compiler builtins instead of C atomics.
|
||||
_cSettings += [
|
||||
.define("ATOMICS_NATIVE_BUILTINS"),
|
||||
]
|
||||
_swiftSettings += [
|
||||
.define("ATOMICS_NATIVE_BUILTINS"),
|
||||
.enableExperimentalFeature("BuiltinModule")
|
||||
]
|
||||
|
||||
@@ -48,7 +46,6 @@ let package = Package(
|
||||
"Conformances/IntegerConformances.swift.gyb",
|
||||
"Conformances/PointerConformances.swift.gyb",
|
||||
"Primitives/Primitives.native.swift.gyb",
|
||||
"Primitives/Primitives.shims.swift.gyb",
|
||||
"Types/IntegerOperations.swift.gyb",
|
||||
],
|
||||
cSettings: _cSettings,
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
// swift-tools-version:5.7
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2020 - 2023 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import PackageDescription
|
||||
|
||||
var _cSettings: [CSetting] = []
|
||||
var _swiftSettings: [SwiftSetting] = []
|
||||
|
||||
// Note: ATOMICS_NATIVE_BUILTINS works via the BuiltinModule language feature,
|
||||
// so it is not usable in language versions below 5.9.
|
||||
|
||||
let package = Package(
|
||||
name: "swift-atomics",
|
||||
products: [
|
||||
.library(
|
||||
name: "Atomics",
|
||||
targets: ["Atomics"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "_AtomicsShims",
|
||||
exclude: [
|
||||
"CMakeLists.txt"
|
||||
]
|
||||
),
|
||||
.target(
|
||||
name: "Atomics",
|
||||
dependencies: ["_AtomicsShims"],
|
||||
exclude: [
|
||||
"CMakeLists.txt",
|
||||
"Conformances/AtomicBool.swift.gyb",
|
||||
"Conformances/IntegerConformances.swift.gyb",
|
||||
"Conformances/PointerConformances.swift.gyb",
|
||||
"Primitives/Primitives.native.swift.gyb",
|
||||
"Primitives/Primitives.shims.swift.gyb",
|
||||
"Types/IntegerOperations.swift.gyb",
|
||||
],
|
||||
cSettings: _cSettings,
|
||||
swiftSettings: _swiftSettings
|
||||
),
|
||||
.testTarget(
|
||||
name: "AtomicsTests",
|
||||
dependencies: ["Atomics"],
|
||||
exclude: [
|
||||
"main.swift",
|
||||
"Basics/BasicTests.gyb-template",
|
||||
"Basics/BasicAtomicBoolTests.swift.gyb",
|
||||
"Basics/BasicAtomicDoubleWordTests.swift.gyb",
|
||||
"Basics/BasicAtomicInt16Tests.swift.gyb",
|
||||
"Basics/BasicAtomicInt32Tests.swift.gyb",
|
||||
"Basics/BasicAtomicInt64Tests.swift.gyb",
|
||||
"Basics/BasicAtomicInt8Tests.swift.gyb",
|
||||
"Basics/BasicAtomicIntTests.swift.gyb",
|
||||
"Basics/BasicAtomicMutablePointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicMutableRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalMutablePointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalMutableRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalRawRepresentableTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalReferenceTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalUnmanagedTests.swift.gyb",
|
||||
"Basics/BasicAtomicPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicRawRepresentableTests.swift.gyb",
|
||||
"Basics/BasicAtomicReferenceTests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt16Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt32Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt64Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt8Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUIntTests.swift.gyb",
|
||||
"Basics/BasicAtomicUnmanagedTests.swift.gyb",
|
||||
],
|
||||
swiftSettings: _swiftSettings
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -1,87 +0,0 @@
|
||||
// swift-tools-version:5.7
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2020 - 2023 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import PackageDescription
|
||||
|
||||
var _cSettings: [CSetting] = []
|
||||
var _swiftSettings: [SwiftSetting] = []
|
||||
|
||||
// Note: ATOMICS_NATIVE_BUILTINS works via the BuiltinModule language feature,
|
||||
// so it is not usable in language versions below 5.9.
|
||||
|
||||
let package = Package(
|
||||
name: "swift-atomics",
|
||||
products: [
|
||||
.library(
|
||||
name: "Atomics",
|
||||
targets: ["Atomics"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "_AtomicsShims",
|
||||
exclude: [
|
||||
"CMakeLists.txt"
|
||||
]
|
||||
),
|
||||
.target(
|
||||
name: "Atomics",
|
||||
dependencies: ["_AtomicsShims"],
|
||||
exclude: [
|
||||
"CMakeLists.txt",
|
||||
"Conformances/AtomicBool.swift.gyb",
|
||||
"Conformances/IntegerConformances.swift.gyb",
|
||||
"Conformances/PointerConformances.swift.gyb",
|
||||
"Primitives/Primitives.native.swift.gyb",
|
||||
"Primitives/Primitives.shims.swift.gyb",
|
||||
"Types/IntegerOperations.swift.gyb",
|
||||
],
|
||||
cSettings: _cSettings,
|
||||
swiftSettings: _swiftSettings
|
||||
),
|
||||
.testTarget(
|
||||
name: "AtomicsTests",
|
||||
dependencies: ["Atomics"],
|
||||
exclude: [
|
||||
"main.swift",
|
||||
"Basics/BasicTests.gyb-template",
|
||||
"Basics/BasicAtomicBoolTests.swift.gyb",
|
||||
"Basics/BasicAtomicDoubleWordTests.swift.gyb",
|
||||
"Basics/BasicAtomicInt16Tests.swift.gyb",
|
||||
"Basics/BasicAtomicInt32Tests.swift.gyb",
|
||||
"Basics/BasicAtomicInt64Tests.swift.gyb",
|
||||
"Basics/BasicAtomicInt8Tests.swift.gyb",
|
||||
"Basics/BasicAtomicIntTests.swift.gyb",
|
||||
"Basics/BasicAtomicMutablePointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicMutableRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalMutablePointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalMutableRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalRawRepresentableTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalReferenceTests.swift.gyb",
|
||||
"Basics/BasicAtomicOptionalUnmanagedTests.swift.gyb",
|
||||
"Basics/BasicAtomicPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicRawPointerTests.swift.gyb",
|
||||
"Basics/BasicAtomicRawRepresentableTests.swift.gyb",
|
||||
"Basics/BasicAtomicReferenceTests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt16Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt32Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt64Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUInt8Tests.swift.gyb",
|
||||
"Basics/BasicAtomicUIntTests.swift.gyb",
|
||||
"Basics/BasicAtomicUnmanagedTests.swift.gyb",
|
||||
],
|
||||
swiftSettings: _swiftSettings
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -17,7 +17,6 @@ add_library(Atomics
|
||||
"Types/autogenerated/IntegerOperations.swift"
|
||||
"Unmanaged extensions.swift"
|
||||
"Primitives/autogenerated/Primitives.native.swift"
|
||||
"Primitives/autogenerated/Primitives.shims.swift"
|
||||
"Conformances/RawRepresentable.swift"
|
||||
"Conformances/OptionalRawRepresentable.swift"
|
||||
"Conformances/autogenerated/IntegerConformances.swift"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
import Builtin
|
||||
|
||||
extension Bool {
|
||||
@@ -26,9 +25,6 @@ extension Bool {
|
||||
self = unsafeBitCast(builtin, to: Bool.self)
|
||||
}
|
||||
}
|
||||
#else
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
extension Bool: AtomicValue {
|
||||
@frozen
|
||||
@@ -43,25 +39,16 @@ extension Bool: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Bool) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = value._atomicRepresentation
|
||||
#else
|
||||
_storage = _sa_prepare_Int8(value._atomicRepresentation)
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return _storage._decodeBool
|
||||
#else
|
||||
return _sa_dispose_Int8(_storage)._decodeBool
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Bool {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal var _atomicRepresentation: _AtomicInt8Storage {
|
||||
@@ -76,21 +63,6 @@ extension _AtomicInt8Storage {
|
||||
(Int8(self._value) & 1) != 0
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Bool {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal var _atomicRepresentation: Int8 {
|
||||
self ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
extension Int8 {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal var _decodeBool: Bool {
|
||||
(self & 1) != 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeMutablePointer
|
||||
where Pointee == Bool.AtomicRepresentation {
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
% for (swiftType, storageType, shimType) in integerTypes:
|
||||
|
||||
extension ${swiftType}: AtomicValue {
|
||||
@@ -48,20 +44,12 @@ extension ${swiftType}: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_${shimType}(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_${shimType}(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +64,6 @@ where Pointee == ${swiftType}.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension ${swiftType}.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -88,27 +75,6 @@ extension ${swiftType}.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension ${swiftType}.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: ${shimType}) -> Value {
|
||||
% if swiftType == shimType:
|
||||
return v
|
||||
% else:
|
||||
return Value(v._value)
|
||||
% end
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> ${shimType} {
|
||||
% if swiftType == shimType:
|
||||
return value
|
||||
% else:
|
||||
return ${shimType}(value._value)
|
||||
% end
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension ${swiftType}.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
% for swiftType in atomicTypes:
|
||||
extension ${swiftType}: AtomicValue {
|
||||
@frozen
|
||||
@@ -41,20 +37,12 @@ extension ${swiftType}: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +59,6 @@ extension ${swiftType}.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension ${swiftType}.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -93,27 +80,6 @@ extension ${swiftType}.AtomicRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension ${swiftType}.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
% if swiftType == "Unmanaged":
|
||||
return Unmanaged.fromOpaque(UnsafeRawPointer(bitPattern: bits)!)
|
||||
% else:
|
||||
return ${swiftType}(bitPattern: bits)!
|
||||
% end
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
% if swiftType == "Unmanaged":
|
||||
return Int(bitPattern: value.toOpaque())
|
||||
% else:
|
||||
return Int(bitPattern: value)
|
||||
% end
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension ${swiftType}.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -213,20 +179,12 @@ extension ${swiftType}: AtomicOptionalWrappable {
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,7 +201,6 @@ extension ${swiftType}.AtomicOptionalRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension ${swiftType}.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -268,30 +225,6 @@ extension ${swiftType}.AtomicOptionalRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension ${swiftType}.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
% if swiftType == "Unmanaged":
|
||||
guard let opaque = UnsafeRawPointer(bitPattern: bits) else {
|
||||
return nil
|
||||
}
|
||||
return Unmanaged.fromOpaque(opaque)
|
||||
% else:
|
||||
return ${swiftType}(bitPattern: bits)
|
||||
% end
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
% if swiftType == "Unmanaged":
|
||||
return value.map { Int(bitPattern: $0.toOpaque())} ?? 0
|
||||
% else:
|
||||
return value.map { Int(bitPattern: $0) } ?? 0
|
||||
% end
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension ${swiftType}.AtomicOptionalRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
// #############################################################################
|
||||
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
import Builtin
|
||||
|
||||
extension Bool {
|
||||
@@ -28,9 +27,6 @@ extension Bool {
|
||||
self = unsafeBitCast(builtin, to: Bool.self)
|
||||
}
|
||||
}
|
||||
#else
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
extension Bool: AtomicValue {
|
||||
@frozen
|
||||
@@ -45,25 +41,16 @@ extension Bool: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Bool) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = value._atomicRepresentation
|
||||
#else
|
||||
_storage = _sa_prepare_Int8(value._atomicRepresentation)
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return _storage._decodeBool
|
||||
#else
|
||||
return _sa_dispose_Int8(_storage)._decodeBool
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Bool {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal var _atomicRepresentation: _AtomicInt8Storage {
|
||||
@@ -78,21 +65,6 @@ extension _AtomicInt8Storage {
|
||||
(Int8(self._value) & 1) != 0
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Bool {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal var _atomicRepresentation: Int8 {
|
||||
self ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
extension Int8 {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal var _decodeBool: Bool {
|
||||
(self & 1) != 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeMutablePointer
|
||||
where Pointee == Bool.AtomicRepresentation {
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
// #############################################################################
|
||||
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
|
||||
extension Int8: AtomicValue {
|
||||
@frozen
|
||||
@@ -35,20 +31,12 @@ extension Int8: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int8(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int8(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +51,6 @@ where Pointee == Int8.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Int8.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -75,19 +62,6 @@ extension Int8.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Int8.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int8) -> Value {
|
||||
return v
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int8 {
|
||||
return value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Int8.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -260,20 +234,12 @@ extension Int16: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int16(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int16(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,7 +254,6 @@ where Pointee == Int16.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Int16.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -300,19 +265,6 @@ extension Int16.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Int16.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int16) -> Value {
|
||||
return v
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int16 {
|
||||
return value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Int16.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -485,20 +437,12 @@ extension Int32: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int32(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int32(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,7 +457,6 @@ where Pointee == Int32.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Int32.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -525,19 +468,6 @@ extension Int32.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Int32.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int32) -> Value {
|
||||
return v
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int32 {
|
||||
return value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Int32.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -710,20 +640,12 @@ extension Int64: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int64(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int64(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -738,7 +660,6 @@ where Pointee == Int64.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Int64.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -750,19 +671,6 @@ extension Int64.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Int64.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int64) -> Value {
|
||||
return v
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int64 {
|
||||
return value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Int64.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -935,20 +843,12 @@ extension UInt8: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int8(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int8(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -963,7 +863,6 @@ where Pointee == UInt8.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UInt8.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -975,19 +874,6 @@ extension UInt8.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UInt8.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int8) -> Value {
|
||||
return Value(v._value)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int8 {
|
||||
return Int8(value._value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UInt8.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1160,20 +1046,12 @@ extension UInt16: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int16(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int16(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1188,7 +1066,6 @@ where Pointee == UInt16.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UInt16.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1200,19 +1077,6 @@ extension UInt16.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UInt16.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int16) -> Value {
|
||||
return Value(v._value)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int16 {
|
||||
return Int16(value._value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UInt16.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1385,20 +1249,12 @@ extension UInt32: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int32(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int32(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1413,7 +1269,6 @@ where Pointee == UInt32.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UInt32.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1425,19 +1280,6 @@ extension UInt32.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UInt32.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int32) -> Value {
|
||||
return Value(v._value)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int32 {
|
||||
return Int32(value._value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UInt32.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1610,20 +1452,12 @@ extension UInt64: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int64(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int64(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1638,7 +1472,6 @@ where Pointee == UInt64.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UInt64.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1650,19 +1483,6 @@ extension UInt64.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UInt64.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int64) -> Value {
|
||||
return Value(v._value)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int64 {
|
||||
return Int64(value._value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UInt64.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1835,20 +1655,12 @@ extension Int: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1863,7 +1675,6 @@ where Pointee == Int.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Int.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1875,19 +1686,6 @@ extension Int.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Int.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int) -> Value {
|
||||
return v
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int {
|
||||
return value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Int.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -2060,20 +1858,12 @@ extension UInt: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2088,7 +1878,6 @@ where Pointee == UInt.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UInt.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -2100,19 +1889,6 @@ extension UInt.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UInt.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: Int) -> Value {
|
||||
return Value(v._value)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> Int {
|
||||
return Int(value._value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UInt.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -2285,20 +2061,12 @@ extension DoubleWord: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_DoubleWord(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_DoubleWord(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2313,7 +2081,6 @@ where Pointee == DoubleWord.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension DoubleWord.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -2325,19 +2092,6 @@ extension DoubleWord.AtomicRepresentation {
|
||||
return _Storage(value._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension DoubleWord.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _decode(_ v: DoubleWord) -> Value {
|
||||
return v
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
static func _encode(_ value: Value) -> DoubleWord {
|
||||
return value
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension DoubleWord.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
// #############################################################################
|
||||
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
extension UnsafeRawPointer: AtomicValue {
|
||||
@frozen
|
||||
public struct AtomicRepresentation {
|
||||
@@ -35,20 +31,12 @@ extension UnsafeRawPointer: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +53,6 @@ extension UnsafeRawPointer.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafeRawPointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -79,19 +66,6 @@ extension UnsafeRawPointer.AtomicRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafeRawPointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafeRawPointer(bitPattern: bits)!
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return Int(bitPattern: value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeRawPointer.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -187,20 +161,12 @@ extension UnsafeMutableRawPointer: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,7 +183,6 @@ extension UnsafeMutableRawPointer.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafeMutableRawPointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -231,19 +196,6 @@ extension UnsafeMutableRawPointer.AtomicRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafeMutableRawPointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafeMutableRawPointer(bitPattern: bits)!
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return Int(bitPattern: value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeMutableRawPointer.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -339,20 +291,12 @@ extension UnsafePointer: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,7 +313,6 @@ extension UnsafePointer.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafePointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -383,19 +326,6 @@ extension UnsafePointer.AtomicRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafePointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafePointer(bitPattern: bits)!
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return Int(bitPattern: value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafePointer.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -491,20 +421,12 @@ extension UnsafeMutablePointer: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -521,7 +443,6 @@ extension UnsafeMutablePointer.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafeMutablePointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -535,19 +456,6 @@ extension UnsafeMutablePointer.AtomicRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafeMutablePointer.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafeMutablePointer(bitPattern: bits)!
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return Int(bitPattern: value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeMutablePointer.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -643,20 +551,12 @@ extension Unmanaged: AtomicValue {
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
return Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,7 +573,6 @@ extension Unmanaged.AtomicRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Unmanaged.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -687,19 +586,6 @@ extension Unmanaged.AtomicRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Unmanaged.AtomicRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return Unmanaged.fromOpaque(UnsafeRawPointer(bitPattern: bits)!)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return Int(bitPattern: value.toOpaque())
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Unmanaged.AtomicRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -797,20 +683,12 @@ extension UnsafeRawPointer: AtomicOptionalWrappable {
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -827,7 +705,6 @@ extension UnsafeRawPointer.AtomicOptionalRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafeRawPointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -841,19 +718,6 @@ extension UnsafeRawPointer.AtomicOptionalRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafeRawPointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafeRawPointer(bitPattern: bits)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return value.map { Int(bitPattern: $0) } ?? 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeRawPointer.AtomicOptionalRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -947,20 +811,12 @@ extension UnsafeMutableRawPointer: AtomicOptionalWrappable {
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -977,7 +833,6 @@ extension UnsafeMutableRawPointer.AtomicOptionalRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafeMutableRawPointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -991,19 +846,6 @@ extension UnsafeMutableRawPointer.AtomicOptionalRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafeMutableRawPointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafeMutableRawPointer(bitPattern: bits)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return value.map { Int(bitPattern: $0) } ?? 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeMutableRawPointer.AtomicOptionalRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1097,20 +939,12 @@ extension UnsafePointer: AtomicOptionalWrappable {
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1127,7 +961,6 @@ extension UnsafePointer.AtomicOptionalRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafePointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1141,19 +974,6 @@ extension UnsafePointer.AtomicOptionalRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafePointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafePointer(bitPattern: bits)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return value.map { Int(bitPattern: $0) } ?? 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafePointer.AtomicOptionalRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1247,20 +1067,12 @@ extension UnsafeMutablePointer: AtomicOptionalWrappable {
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1277,7 +1089,6 @@ extension UnsafeMutablePointer.AtomicOptionalRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension UnsafeMutablePointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1291,19 +1102,6 @@ extension UnsafeMutablePointer.AtomicOptionalRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension UnsafeMutablePointer.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
return UnsafeMutablePointer(bitPattern: bits)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return value.map { Int(bitPattern: $0) } ?? 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension UnsafeMutablePointer.AtomicOptionalRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@@ -1397,20 +1195,12 @@ extension Unmanaged: AtomicOptionalWrappable {
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public init(_ value: Value) {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
_storage = Self._encode(value)
|
||||
#else
|
||||
_storage = _sa_prepare_Int(Self._encode(value))
|
||||
#endif
|
||||
}
|
||||
|
||||
@inline(__always) @_alwaysEmitIntoClient
|
||||
public func dispose() -> Value {
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
Self._decode(_storage)
|
||||
#else
|
||||
return Self._decode(_sa_dispose_Int(_storage))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1427,7 +1217,6 @@ extension Unmanaged.AtomicOptionalRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
extension Unmanaged.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ storage: _Storage) -> Value {
|
||||
@@ -1444,22 +1233,6 @@ extension Unmanaged.AtomicOptionalRepresentation {
|
||||
return _Storage(bits._value)
|
||||
}
|
||||
}
|
||||
#else
|
||||
extension Unmanaged.AtomicOptionalRepresentation {
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _decode(_ bits: Int) -> Value {
|
||||
guard let opaque = UnsafeRawPointer(bitPattern: bits) else {
|
||||
return nil
|
||||
}
|
||||
return Unmanaged.fromOpaque(opaque)
|
||||
}
|
||||
|
||||
@_transparent @_alwaysEmitIntoClient
|
||||
internal static func _encode(_ value: Value) -> Int {
|
||||
return value.map { Int(bitPattern: $0.toOpaque())} ?? 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension Unmanaged.AtomicOptionalRepresentation: AtomicStorage {
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
|
||||
@@ -15,13 +15,6 @@
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
// FIXME: The conditionals below have been carefully constructed to
|
||||
// avoid confusing Swift 5.7; they can be sanitized once we drop support
|
||||
// for that version.
|
||||
#if compiler(>=5.9)
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
#error("swift-atomics requires native builtins on Swift 5.9")
|
||||
#endif
|
||||
import Builtin
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -282,9 +275,3 @@ extension UnsafeMutablePointer where Pointee == ${swiftType} {
|
||||
#else
|
||||
#error("Unexpected pointer bit width")
|
||||
#endif
|
||||
|
||||
#else // compiler(>=5.9)
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
#error("swift-atomics requires C shims on Swift versions below 5.9")
|
||||
#endif
|
||||
#endif // compiler(>=5.9)
|
||||
@@ -1,257 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2023 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
%{
|
||||
from gyb_utils import *
|
||||
}%
|
||||
${autogenerated_warning()}
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal func _atomicMemoryFence(
|
||||
ordering: AtomicUpdateOrdering
|
||||
) {
|
||||
switch ordering {
|
||||
case .relaxed:
|
||||
break
|
||||
% for (enumOrder, apiOrder, docOrder, llvmOrder, _) in updateOrderings:
|
||||
% if enumOrder != "relaxed":
|
||||
case .${enumOrder}:
|
||||
_sa_thread_fence_${shim_name(llvmOrder)}()
|
||||
% end
|
||||
% end
|
||||
default:
|
||||
fatalError("Unsupported ordering")
|
||||
}
|
||||
}
|
||||
|
||||
% for (storageType, valueType) in cPrimitives:
|
||||
extension UnsafeMutablePointer where Pointee == ${storageType} {
|
||||
/// Atomically loads a word starting at this address with the specified
|
||||
/// memory ordering.
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
@usableFromInline
|
||||
internal func _atomicLoad(ordering: AtomicLoadOrdering) -> ${valueType} {
|
||||
switch ordering {
|
||||
% for (enumOrder, apiOrder, docOrder, llvmOrder) in loadOrderings:
|
||||
case .${enumOrder}:
|
||||
return _sa_load_${shim_name(llvmOrder)}_${valueType}(self)
|
||||
% end
|
||||
default:
|
||||
fatalError("Unsupported ordering")
|
||||
}
|
||||
}
|
||||
|
||||
/// Atomically stores the specified value starting at the memory referenced by
|
||||
/// this pointer, with the specified memory ordering.
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
@usableFromInline
|
||||
internal func _atomicStore(
|
||||
_ desired: ${valueType},
|
||||
ordering: AtomicStoreOrdering
|
||||
) {
|
||||
switch ordering {
|
||||
% for (enumOrder, apiOrder, docOrder, llvmOrder) in storeOrderings:
|
||||
case .${enumOrder}:
|
||||
_sa_store_${shim_name(llvmOrder)}_${valueType}(self, desired)
|
||||
% end
|
||||
default:
|
||||
fatalError("Unsupported ordering")
|
||||
}
|
||||
}
|
||||
|
||||
/// Atomically stores the specified value starting at the memory referenced by
|
||||
/// this pointer, with the specified memory ordering.
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
public func _atomicExchange(
|
||||
_ desired: ${valueType},
|
||||
ordering: AtomicUpdateOrdering
|
||||
) -> ${valueType} {
|
||||
switch ordering {
|
||||
% for (enumOrder, apiOrder, docOrder, llvmOrder, failOrder) in updateOrderings:
|
||||
case .${enumOrder}:
|
||||
return _sa_exchange_${shim_name(llvmOrder)}_${valueType}(self, desired)
|
||||
% end
|
||||
default:
|
||||
fatalError("Unsupported ordering")
|
||||
}
|
||||
}
|
||||
|
||||
/// Perform an atomic compare and exchange operation with the specified memory
|
||||
/// ordering.
|
||||
///
|
||||
/// This operation is equivalent to the following pseudocode:
|
||||
///
|
||||
/// ```
|
||||
/// atomic(self, ordering) { currentValue in
|
||||
/// let original = currentValue
|
||||
/// guard original == expected else { return (false, original) }
|
||||
/// currentValue = desired
|
||||
/// return (true, original)
|
||||
/// }
|
||||
/// ```
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
public func _atomicCompareExchange(
|
||||
expected: ${valueType},
|
||||
desired: ${valueType},
|
||||
ordering: AtomicUpdateOrdering
|
||||
) -> (exchanged: Bool, original: ${valueType}) {
|
||||
var expected = expected
|
||||
let exchanged: Bool
|
||||
switch ordering {
|
||||
% for (enumOrder, apiOrder, docOrder, llvmOrder, failOrder) in updateOrderings:
|
||||
case .${enumOrder}:
|
||||
exchanged = _sa_cmpxchg_strong_${shim_name(llvmOrder)}_${shim_name(failOrder)}_${valueType}(
|
||||
self, &expected, desired)
|
||||
% end
|
||||
default:
|
||||
fatalError("Unsupported ordering")
|
||||
}
|
||||
return (exchanged, expected)
|
||||
}
|
||||
|
||||
/// Perform an atomic compare and exchange operation with the specified
|
||||
/// success/failure memory orderings.
|
||||
///
|
||||
/// This operation is equivalent to the following pseudocode:
|
||||
///
|
||||
/// ```
|
||||
/// atomic(self, ordering, failureOrdering) { currentValue in
|
||||
/// let original = currentValue
|
||||
/// guard original == expected else { return (false, original) }
|
||||
/// currentValue = desired
|
||||
/// return (true, original)
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// The `ordering` argument specifies the memory ordering to use when the
|
||||
/// operation manages to update the current value, while `failureOrdering`
|
||||
/// will be used when the operation leaves the value intact.
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
public func _atomicCompareExchange(
|
||||
expected: ${valueType},
|
||||
desired: ${valueType},
|
||||
successOrdering: AtomicUpdateOrdering,
|
||||
failureOrdering: AtomicLoadOrdering
|
||||
) -> (exchanged: Bool, original: ${valueType}) {
|
||||
// FIXME: LLVM doesn't support arbitrary ordering combinations
|
||||
// yet, so upgrade the success ordering when necessary so that it
|
||||
// is at least as "strong" as the failure case.
|
||||
var expected = expected
|
||||
let exchanged: Bool
|
||||
switch (successOrdering, failureOrdering) {
|
||||
% for (swiftSuccess, apiSuccess, _, llvmOrder, _) in updateOrderings:
|
||||
% for (swiftFailure, apiFailure, _, llvmFailure) in loadOrderings:
|
||||
case (.${swiftSuccess}, .${swiftFailure}):
|
||||
exchanged = _sa_cmpxchg_strong_${actualShimOrders(llvmOrder, llvmFailure)}_${valueType}(
|
||||
self, &expected, desired)
|
||||
% end
|
||||
% end
|
||||
default:
|
||||
preconditionFailure("Unsupported orderings")
|
||||
}
|
||||
return (exchanged, expected)
|
||||
}
|
||||
|
||||
/// Perform an atomic compare and exchange operation with the specified
|
||||
/// success/failure memory orderings.
|
||||
///
|
||||
/// This operation is equivalent to the following pseudocode:
|
||||
///
|
||||
/// ```
|
||||
/// atomic(self, ordering, failureOrdering) { currentValue in
|
||||
/// let original = currentValue
|
||||
/// guard original == expected else { return (false, original) }
|
||||
/// currentValue = desired
|
||||
/// return (true, original)
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// The `ordering` argument specifies the memory ordering to use when the
|
||||
/// operation manages to update the current value, while `failureOrdering`
|
||||
/// will be used when the operation leaves the value intact.
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
public func _atomicWeakCompareExchange(
|
||||
expected: ${valueType},
|
||||
desired: ${valueType},
|
||||
successOrdering: AtomicUpdateOrdering,
|
||||
failureOrdering: AtomicLoadOrdering
|
||||
) -> (exchanged: Bool, original: ${valueType}) {
|
||||
// FIXME: LLVM doesn't support arbitrary ordering combinations
|
||||
// yet, so upgrade the success ordering when necessary so that it
|
||||
// is at least as "strong" as the failure case.
|
||||
var expected = expected
|
||||
let exchanged: Bool
|
||||
switch (successOrdering, failureOrdering) {
|
||||
% for (swiftSuccess, apiSuccess, _, llvmOrder, _) in updateOrderings:
|
||||
% for (swiftFailure, apiFailure, _, llvmFailure) in loadOrderings:
|
||||
case (.${swiftSuccess}, .${swiftFailure}):
|
||||
exchanged = _sa_cmpxchg_weak_${actualShimOrders(llvmOrder, llvmFailure)}_${valueType}(
|
||||
self, &expected, desired)
|
||||
% end
|
||||
% end
|
||||
default:
|
||||
preconditionFailure("Unsupported orderings")
|
||||
}
|
||||
return (exchanged, expected)
|
||||
}
|
||||
|
||||
% if valueType != "DoubleWord":
|
||||
% for (swiftName, builtinName, operator, label, doc) in integerOperations:
|
||||
/// Perform an atomic ${doc} operation and return the new value,
|
||||
/// with the specified memory ordering.
|
||||
///
|
||||
% if "Wrapping" in swiftName:
|
||||
/// - Note: This operation silently wraps around on overflow, like the
|
||||
/// `${operator}` operator does on `UInt` values.
|
||||
///
|
||||
% end
|
||||
/// - Returns: The original value before the operation.
|
||||
@_semantics("atomics.requires_constant_orderings")
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent // Debug performance
|
||||
@usableFromInline
|
||||
internal
|
||||
func _atomicLoadThen${swiftName}(
|
||||
${label} operand: ${valueType},
|
||||
ordering: AtomicUpdateOrdering
|
||||
) -> ${valueType} {
|
||||
switch ordering {
|
||||
% for (enumOrder, apiOrder, docOrder, llvmOrder, failOrder) in updateOrderings:
|
||||
case .${enumOrder}:
|
||||
return _sa_fetch_${builtinName}_${shim_name(llvmOrder)}_${valueType}(
|
||||
self, operand)
|
||||
% end
|
||||
default:
|
||||
preconditionFailure("Unsupported ordering")
|
||||
}
|
||||
}
|
||||
% end
|
||||
% end
|
||||
}
|
||||
% end
|
||||
#endif // ATOMICS_NATIVE_BUILTINS
|
||||
@@ -18,13 +18,6 @@
|
||||
// #############################################################################
|
||||
|
||||
|
||||
// FIXME: The conditionals below have been carefully constructed to
|
||||
// avoid confusing Swift 5.7; they can be sanitized once we drop support
|
||||
// for that version.
|
||||
#if compiler(>=5.9)
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
#error("swift-atomics requires native builtins on Swift 5.9")
|
||||
#endif
|
||||
import Builtin
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -2453,9 +2446,3 @@ extension UnsafeMutablePointer where Pointee == _AtomicInt128Storage {
|
||||
#else
|
||||
#error("Unexpected pointer bit width")
|
||||
#endif
|
||||
|
||||
#else // compiler(>=5.9)
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
#error("swift-atomics requires C shims on Swift versions below 5.9")
|
||||
#endif
|
||||
#endif // compiler(>=5.9)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10,10 +10,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
#endif
|
||||
|
||||
/// A class type that supports atomic strong references.
|
||||
///
|
||||
/// class MyObject: AtomicReference {}
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// FIXME: The conditionals below have been carefully constructed to
|
||||
// avoid confusing Swift 5.7; they can be sanitized once we drop support
|
||||
// for that version.
|
||||
#if compiler(>=5.9)
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
#error("swift-atomics requires native builtins on Swift 5.9")
|
||||
#endif
|
||||
|
||||
import Builtin
|
||||
|
||||
#if _pointerBitWidth(_32)
|
||||
@@ -70,15 +62,6 @@ extension DoubleWord {
|
||||
}
|
||||
}
|
||||
|
||||
#else // compiler(>=5.9)
|
||||
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
#error("swift-atomics requires C shims on Swift versions below 5.9")
|
||||
#endif
|
||||
import _AtomicsShims
|
||||
public typealias DoubleWord = _AtomicsShims.DoubleWord
|
||||
#endif // compiler(>=5.9)
|
||||
|
||||
extension DoubleWord {
|
||||
/// Initialize a new `DoubleWord` value given its high- and
|
||||
/// low-order words.
|
||||
|
||||
@@ -17,12 +17,12 @@ internal func _sa_retain_n(_ object: UnsafeMutableRawPointer, _ delta: UInt32)
|
||||
@_silgen_name("_sa_release_n")
|
||||
internal func _sa_release_n(_ object: UnsafeMutableRawPointer, _ delta: UInt32)
|
||||
#else
|
||||
// Note: with ATOMICS_NATIVE_BUILTINS, this file contains the last remaining
|
||||
// import of the shims module, and we only need it to get the declarations for
|
||||
// _sa_retain_n/_sa_release_n. The import is unfortunately still problematic;
|
||||
// these functions need to be moved into the stdlib or (preferably) we need
|
||||
// a compiler-level fix for https://github.com/apple/swift/issues/56105 to get rid
|
||||
// of it.
|
||||
// Note: This file contains the last remaining import of the shims
|
||||
// module, and we only need it to get the declarations for
|
||||
// _sa_retain_n/_sa_release_n. The import is unfortunately still
|
||||
// problematic; these functions need to be moved into the stdlib or
|
||||
// (preferably) we need a compiler-level fix for
|
||||
// https://github.com/apple/swift/issues/56105 to get rid of it.
|
||||
//
|
||||
// Hiding the import using @_implementationOnly is not possible unless
|
||||
// Swift's library evolution dialect is enabled. (Which we cannot easily test
|
||||
|
||||
@@ -41,204 +41,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Swift-importable shims for C atomics.
|
||||
//
|
||||
// Swift cannot import C's atomic types or any operations over them, so we need
|
||||
// to meticulously wrap all of them in tiny importable types and functions.
|
||||
//
|
||||
// This file defines an atomic storage representation and 56 atomic operations
|
||||
// for each of the 10 standard integer types in the Standard Library, as well as
|
||||
// Bool and a double-word integer type. To prevent us from having to manually
|
||||
// write/maintain a thousand or so functions, we use the C preprocessor to stamp
|
||||
// these out.
|
||||
//
|
||||
// FIXME: Upgrading from the preprocessor to gyb would perhaps make things more
|
||||
// readable here.
|
||||
|
||||
|
||||
// The atomic primitives are only needed when this is compiled using Swift's
|
||||
// Clang Importer. This allows us to continue reling on some Clang extensions
|
||||
// (see https://github.com/apple/swift-atomics/issues/37).
|
||||
#if !defined(ATOMICS_NATIVE_BUILTINS) && defined(__swift__) && !defined(__cplusplus)
|
||||
# include <stdatomic.h>
|
||||
|
||||
// Atomic fences
|
||||
#define SWIFTATOMIC_THREAD_FENCE_FN(order) \
|
||||
SWIFTATOMIC_INLINE void _sa_thread_fence_##order(void) \
|
||||
{ \
|
||||
atomic_thread_fence(memory_order_##order); \
|
||||
}
|
||||
|
||||
SWIFTATOMIC_THREAD_FENCE_FN(acquire)
|
||||
SWIFTATOMIC_THREAD_FENCE_FN(release)
|
||||
SWIFTATOMIC_THREAD_FENCE_FN(acq_rel)
|
||||
SWIFTATOMIC_THREAD_FENCE_FN(seq_cst)
|
||||
|
||||
// Definition of an atomic storage type.
|
||||
#define SWIFTATOMIC_STORAGE_TYPE(swiftType, cType) \
|
||||
typedef struct { \
|
||||
_Atomic(cType) value; \
|
||||
} _sa_##swiftType \
|
||||
SWIFTATOMIC_SWIFT_NAME(_Atomic##swiftType##Storage);
|
||||
|
||||
// Storage value initializer
|
||||
#define SWIFTATOMIC_PREPARE_FN(swiftType, cType) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
_sa_##swiftType _sa_prepare_##swiftType(cType value) \
|
||||
{ \
|
||||
_sa_##swiftType storage = { value }; \
|
||||
assert(atomic_is_lock_free(&storage.value)); \
|
||||
return storage; \
|
||||
}
|
||||
|
||||
// Storage value disposal function
|
||||
#define SWIFTATOMIC_DISPOSE_FN(swiftType, cType) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
cType _sa_dispose_##swiftType(_sa_##swiftType storage) \
|
||||
{ \
|
||||
return storage.value; \
|
||||
}
|
||||
|
||||
// Atomic load
|
||||
#define SWIFTATOMIC_LOAD_FN(swiftType, cType, order) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
cType _sa_load_##order##_##swiftType(_sa_##swiftType *ptr) \
|
||||
{ \
|
||||
return atomic_load_explicit( \
|
||||
&ptr->value, memory_order_##order); \
|
||||
}
|
||||
|
||||
// Atomic store
|
||||
#define SWIFTATOMIC_STORE_FN(swiftType, cType, order) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
void _sa_store_##order##_##swiftType( \
|
||||
_sa_##swiftType *ptr, \
|
||||
cType desired) \
|
||||
{ \
|
||||
atomic_store_explicit( \
|
||||
&ptr->value, desired, memory_order_##order); \
|
||||
}
|
||||
|
||||
// Atomic exchange
|
||||
#define SWIFTATOMIC_EXCHANGE_FN(swiftType, cType, order) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
cType _sa_exchange_##order##_##swiftType( \
|
||||
_sa_##swiftType *ptr, \
|
||||
cType desired) \
|
||||
{ \
|
||||
return atomic_exchange_explicit( \
|
||||
&ptr->value, desired, memory_order_##order); \
|
||||
}
|
||||
|
||||
// Atomic compare/exchange
|
||||
#define SWIFTATOMIC_CMPXCHG_FN(_kind, swiftType, cType, succ, fail) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
bool \
|
||||
_sa_cmpxchg_##_kind##_##succ##_##fail##_##swiftType( \
|
||||
_sa_##swiftType *ptr, \
|
||||
cType *expected, \
|
||||
cType desired) \
|
||||
{ \
|
||||
return atomic_compare_exchange_##_kind##_explicit( \
|
||||
&ptr->value, \
|
||||
expected, \
|
||||
desired, \
|
||||
memory_order_##succ, \
|
||||
memory_order_##fail); \
|
||||
}
|
||||
|
||||
// Atomic integer operations
|
||||
#define SWIFTATOMIC_INTEGER_FN(op, swiftType, cType, order) \
|
||||
SWIFTATOMIC_INLINE \
|
||||
cType _sa_fetch_##op##_##order##_##swiftType( \
|
||||
_sa_##swiftType *ptr, \
|
||||
cType operand) \
|
||||
{ \
|
||||
return atomic_fetch_##op##_explicit( \
|
||||
&ptr->value, operand, memory_order_##order); \
|
||||
}
|
||||
|
||||
// Functions for each supported operation + memory ordering combination
|
||||
#define SWIFTATOMIC_STORE_FNS(swiftType, cType) \
|
||||
SWIFTATOMIC_STORE_FN(swiftType, cType, relaxed) \
|
||||
SWIFTATOMIC_STORE_FN(swiftType, cType, release) \
|
||||
SWIFTATOMIC_STORE_FN(swiftType, cType, seq_cst)
|
||||
|
||||
#define SWIFTATOMIC_LOAD_FNS(swiftType, cType) \
|
||||
SWIFTATOMIC_LOAD_FN(swiftType, cType, relaxed) \
|
||||
SWIFTATOMIC_LOAD_FN(swiftType, cType, acquire) \
|
||||
SWIFTATOMIC_LOAD_FN(swiftType, cType, seq_cst)
|
||||
|
||||
#define SWIFTATOMIC_EXCHANGE_FNS(swiftType, cType) \
|
||||
SWIFTATOMIC_EXCHANGE_FN(swiftType, cType, relaxed) \
|
||||
SWIFTATOMIC_EXCHANGE_FN(swiftType, cType, acquire) \
|
||||
SWIFTATOMIC_EXCHANGE_FN(swiftType, cType, release) \
|
||||
SWIFTATOMIC_EXCHANGE_FN(swiftType, cType, acq_rel) \
|
||||
SWIFTATOMIC_EXCHANGE_FN(swiftType, cType, seq_cst)
|
||||
|
||||
#define SWIFTATOMIC_CMPXCHG_FNS(kind, swiftType, cType) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, relaxed, relaxed) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, acquire, relaxed) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, release, relaxed) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, acq_rel, relaxed) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, seq_cst, relaxed) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, acquire, acquire) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, acq_rel, acquire) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, seq_cst, acquire) \
|
||||
SWIFTATOMIC_CMPXCHG_FN(kind, swiftType, cType, seq_cst, seq_cst)
|
||||
|
||||
#define SWIFTATOMIC_INTEGER_FNS(op, swiftType, cType) \
|
||||
SWIFTATOMIC_INTEGER_FN(op, swiftType, cType, relaxed) \
|
||||
SWIFTATOMIC_INTEGER_FN(op, swiftType, cType, acquire) \
|
||||
SWIFTATOMIC_INTEGER_FN(op, swiftType, cType, release) \
|
||||
SWIFTATOMIC_INTEGER_FN(op, swiftType, cType, acq_rel) \
|
||||
SWIFTATOMIC_INTEGER_FN(op, swiftType, cType, seq_cst)
|
||||
|
||||
#define SWIFTATOMIC_DEFINE_TYPE(swiftType, cType) \
|
||||
SWIFTATOMIC_STORAGE_TYPE(swiftType, cType) \
|
||||
SWIFTATOMIC_PREPARE_FN(swiftType, cType) \
|
||||
SWIFTATOMIC_DISPOSE_FN(swiftType, cType) \
|
||||
SWIFTATOMIC_LOAD_FNS(swiftType, cType) \
|
||||
SWIFTATOMIC_STORE_FNS(swiftType, cType) \
|
||||
SWIFTATOMIC_EXCHANGE_FNS(swiftType, cType) \
|
||||
SWIFTATOMIC_CMPXCHG_FNS(strong, swiftType, cType) \
|
||||
SWIFTATOMIC_CMPXCHG_FNS(weak, swiftType, cType)
|
||||
|
||||
#define SWIFTATOMIC_DEFINE_INTEGER_TYPE(swiftType, cType) \
|
||||
SWIFTATOMIC_DEFINE_TYPE(swiftType, cType) \
|
||||
SWIFTATOMIC_INTEGER_FNS(add, swiftType, cType) \
|
||||
SWIFTATOMIC_INTEGER_FNS(sub, swiftType, cType) \
|
||||
SWIFTATOMIC_INTEGER_FNS(or, swiftType, cType) \
|
||||
SWIFTATOMIC_INTEGER_FNS(xor, swiftType, cType) \
|
||||
SWIFTATOMIC_INTEGER_FNS(and, swiftType, cType)
|
||||
|
||||
// All known integer types
|
||||
SWIFTATOMIC_DEFINE_INTEGER_TYPE(Int, intptr_t)
|
||||
SWIFTATOMIC_DEFINE_INTEGER_TYPE(Int8, int8_t)
|
||||
SWIFTATOMIC_DEFINE_INTEGER_TYPE(Int16, int16_t)
|
||||
SWIFTATOMIC_DEFINE_INTEGER_TYPE(Int32, int32_t)
|
||||
SWIFTATOMIC_DEFINE_INTEGER_TYPE(Int64, int64_t)
|
||||
|
||||
// Double wide atomics
|
||||
|
||||
#if __SIZEOF_POINTER__ == 8
|
||||
# define SWIFTATOMIC_DWORD_ALIGNMENT SWIFTATOMIC_ALIGNED(16)
|
||||
#elif __SIZEOF_POINTER__ == 4
|
||||
# define SWIFTATOMIC_DWORD_ALIGNMENT SWIFTATOMIC_ALIGNED(8)
|
||||
#else
|
||||
# error "Unsupported Pointer Size"
|
||||
#endif
|
||||
|
||||
struct _sa_dword {
|
||||
uintptr_t first;
|
||||
uintptr_t second;
|
||||
} SWIFTATOMIC_DWORD_ALIGNMENT SWIFTATOMIC_SWIFT_NAME(DoubleWord);
|
||||
typedef struct _sa_dword _sa_dword;
|
||||
|
||||
SWIFTATOMIC_DEFINE_TYPE(DoubleWord, _sa_dword)
|
||||
|
||||
#endif //!defined(ATOMICS_NATIVE_BUILTINS) && defined(__swift__) && !defined(__cplusplus)
|
||||
|
||||
#if SWIFTATOMIC_SINGLE_MODULE
|
||||
// In the single-module configuration, declare _sa_retain_n/_sa_release_n with
|
||||
// the Swift calling convention, so that they can be easily picked up with
|
||||
|
||||
@@ -137,5 +137,3 @@ def lowerFirst(str):
|
||||
|
||||
def argLabel(label):
|
||||
return label + ": " if label != "_" else ""
|
||||
|
||||
ptrBitWidth32 = "(compiler(>=5.9) && _pointerBitWidth(_32)) || (compiler(<5.9) && (arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)))"
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# Xcode build files
|
||||
|
||||
The project file here can be used to build a variant of this package with Xcode. The project file is a regular Xcode project that builds the code base using the ATOMICS_NATIVE_BUILTINS configuration, producing a single framework bundle. Build settings are entirely configured via the provided xcconfig files.
|
||||
The project file here can be used to build a variant of this package with Xcode. The project file is a regular Xcode project that builds the code base producing a single framework bundle. Build settings are entirely configured via the provided xcconfig files.
|
||||
|
||||
Beware! The contents of this directory are not source stable. They are provided as is, with no compatibility promises across package releases. Future versions of this package can arbitrarily change these files or remove them, without any advance notice. (This can include patch releases.)
|
||||
@@ -20,8 +20,8 @@ CODE_SIGN_IDENTITY[sdk=appletvos*] = "iOS Developer"
|
||||
SWIFT_VERSION = 5.5
|
||||
ONLY_ACTIVE_ARCH[config=Debug] = YES
|
||||
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) ATOMICS_SINGLE_MODULE ATOMICS_NATIVE_BUILTINS
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) ATOMICS_SINGLE_MODULE=1 ATOMICS_NATIVE_BUILTINS=1
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) ATOMICS_SINGLE_MODULE
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) ATOMICS_SINGLE_MODULE=1
|
||||
|
||||
SWIFT_COMPILATION_MODE[config=Release] = wholemodule
|
||||
SWIFT_COMPILATION_MODE[config=Debug] = singlefile
|
||||
|
||||
Reference in new issue
Block a user