Skip to content

[stdib] Audit @_fixed_layout on collection storage classes #20519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions stdlib/public/core/DictionaryStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SwiftShims
/// Enough bytes are allocated to hold the bitmap for marking valid entries,
/// keys, and values. The data layout starts with the bitmap, followed by the
/// keys, followed by the values.
@_fixed_layout // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
@_objc_non_lazy_realization
internal class _RawDictionaryStorage: __SwiftNativeNSDictionary {
Expand Down Expand Up @@ -192,7 +192,6 @@ extension _RawDictionaryStorage {
}
}

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline
final internal class _DictionaryStorage<Key: Hashable, Value>
: _RawDictionaryStorage, _NSDictionaryCore {
Expand Down
57 changes: 25 additions & 32 deletions stdlib/public/core/Runtime.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -312,57 +312,50 @@ internal func _rawPointerToString(_ value: Builtin.RawPointer) -> String {
// coexist, so they were renamed. The old names must not be used in the
// new runtime.

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSArrayBase)
internal class __SwiftNativeNSArray {
@inlinable // FIXME(sil-serialize-all)
@inlinable
@nonobjc
internal init() {}
@inlinable // FIXME(sil-serialize-all)
@inlinable
deinit {}
}

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSDictionaryBase)
internal class __SwiftNativeNSDictionary {
@inlinable // FIXME(sil-serialize-all)
@nonobjc
internal init() {}
@inlinable // FIXME(sil-serialize-all)
deinit {}
}

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSSetBase)
internal class __SwiftNativeNSSet {
@inlinable // FIXME(sil-serialize-all)
@nonobjc
internal init() {}
@inlinable // FIXME(sil-serialize-all)
deinit {}
}

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSEnumeratorBase)
@objc
@_swift_native_objc_runtime_base(__SwiftNativeNSEnumeratorBase)
internal class __SwiftNativeNSEnumerator {
@inlinable // FIXME(sil-serialize-all)
@nonobjc
internal init() {}
@inlinable // FIXME(sil-serialize-all)
deinit {}
}

// FIXME(ABI)#60 : move into the Foundation overlay and remove 'open'
@_fixed_layout // FIXME(sil-serialize-all)
@_fixed_layout
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSDataBase)
open class __SwiftNativeNSData {
@inlinable // FIXME(sil-serialize-all)
@inlinable
@objc public init() {}
@inlinable // FIXME(sil-serialize-all)
@inlinable
deinit {}
}

Expand Down Expand Up @@ -405,28 +398,28 @@ public func _stdlib_initializeReturnAutoreleased() {
}
#else

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
internal class __SwiftNativeNSArray {
@inlinable // FIXME(sil-serialize-all)
@inlinable
internal init() {}
@inlinable // FIXME(sil-serialize-all)
@inlinable
deinit {}
}
@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
internal class __SwiftNativeNSDictionary {
@inlinable // FIXME(sil-serialize-all)
@inlinable
internal init() {}
@inlinable // FIXME(sil-serialize-all)
@inlinable
deinit {}
}
@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
internal class __SwiftNativeNSSet {
@inlinable // FIXME(sil-serialize-all)
@inlinable
internal init() {}
@inlinable // FIXME(sil-serialize-all)
@inlinable
deinit {}
}

Expand Down
3 changes: 1 addition & 2 deletions stdlib/public/core/SetStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SwiftShims
/// Enough bytes are allocated to hold the bitmap for marking valid entries,
/// keys, and values. The data layout starts with the bitmap, followed by the
/// keys, followed by the values.
@_fixed_layout // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
@_objc_non_lazy_realization
internal class _RawSetStorage: __SwiftNativeNSSet {
Expand Down Expand Up @@ -175,7 +175,6 @@ extension _EmptySetSingleton: _NSSetCore {
#endif
}

@_fixed_layout // FIXME(sil-serialize-all)
@usableFromInline
final internal class _SetStorage<Element: Hashable>
: _RawSetStorage, _NSSetCore {
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/core/SwiftNativeNSArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ internal func _isValidArraySubscript(_ index: Int, count: Int) -> Bool {
/// NOTE: older runtimes called this
/// _SwiftNativeNSArrayWithContiguousStorage. The two must coexist, so
/// it was renamed. The old name must not be used in the new runtime.
@_fixed_layout // FIXME(sil-serialize-all)
@_fixed_layout
@usableFromInline
internal class __SwiftNativeNSArrayWithContiguousStorage
: __SwiftNativeNSArray { // Provides NSArray inheritance and native refcounting

@inlinable // FIXME(sil-serialize-all)
@inlinable
@nonobjc internal override init() {}

@inlinable // FIXME(sil-serialize-all)
@inlinable
deinit {}

// Operate on our contiguous storage
Expand Down
8 changes: 8 additions & 0 deletions test/api-digester/Outputs/stability-stdlib-abi.swift.expected
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ Func SystemRandomNumberGenerator._fill(bytes:) has been removed
Func _createStringTableCache(_:) has been removed
Struct _StringSwitchContext has been removed

Class __SwiftNativeNSEnumerator has been removed
Constructor _RawDictionaryStorage.init() has been removed
Constructor _RawSetStorage.init() has been removed
Constructor __SwiftNativeNSDictionary.init() has been removed
Constructor __SwiftNativeNSSet.init() has been removed
Class _DictionaryStorage is now without @_fixed_layout
Class _SetStorage is now without @_fixed_layout

Protocol Numeric has generic signature change from <τ_0_0 : Equatable, τ_0_0 : ExpressibleByIntegerLiteral, τ_0_0.Magnitude : Comparable, τ_0_0.Magnitude : Numeric> to <τ_0_0 : AdditiveArithmetic, τ_0_0 : ExpressibleByIntegerLiteral, τ_0_0.Magnitude : Comparable, τ_0_0.Magnitude : Numeric>
Func Numeric.+(_:) has been removed
Func Numeric.+(_:_:) has been removed
Expand Down