Skip to content

[stdlib] Expunge FixedArray from ABI #20480

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 1 commit into from
Nov 10, 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
20 changes: 0 additions & 20 deletions stdlib/public/core/FixedArray.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@

% for N in sizes:

@usableFromInline // FIXME(sil-serialize-all)
@_fixed_layout // FIXME(sil-serialize-all)
internal struct _FixedArray${N}<T> {
// ABI TODO: The has assumptions about tuple layout in the ABI, namely that
// they are laid out contiguously and individually addressable (i.e. strided).
//
@usableFromInline // FIXME(sil-serialize-all)
internal var storage: (
// A ${N}-wide tuple of type T
% for i in range(0, N-1):
Expand All @@ -36,44 +33,35 @@ internal struct _FixedArray${N}<T> {
T
)

@usableFromInline // FIXME(sil-serialize-all)
var _count: Int8
}


extension _FixedArray${N} {
@inlinable // FIXME(sil-serialize-all)
internal static var capacity: Int {
@inline(__always) get { return ${N} }
}

@inlinable // FIXME(sil-serialize-all)
internal var capacity: Int {
@inline(__always) get { return ${N} }
}

@inlinable // FIXME(sil-serialize-all)
internal var count: Int {
@inline(__always) get { return Int(truncatingIfNeeded: _count) }
@inline(__always) set { _count = Int8(newValue) }
}
}

extension _FixedArray${N} : RandomAccessCollection, MutableCollection {
@usableFromInline
internal typealias Index = Int

@inlinable // FIXME(sil-serialize-all)
internal var startIndex : Index {
return 0
}

@inlinable // FIXME(sil-serialize-all)
internal var endIndex : Index {
return count
}

@inlinable // FIXME(sil-serialize-all)
internal subscript(i: Index) -> T {
@inline(__always)
get {
Expand All @@ -99,21 +87,18 @@ extension _FixedArray${N} : RandomAccessCollection, MutableCollection {
}
}

@inlinable // FIXME(sil-serialize-all)
@inline(__always)
internal func index(after i: Index) -> Index {
return i+1
}

@inlinable // FIXME(sil-serialize-all)
@inline(__always)
internal func index(before i: Index) -> Index {
return i-1
}
}

extension _FixedArray${N} {
@inlinable // FIXME(sil-serialize-all)
internal mutating func append(_ newElement: T) {
_sanityCheck(count < capacity)
_count += 1
Expand All @@ -122,7 +107,6 @@ extension _FixedArray${N} {
}

extension _FixedArray${N} where T : ExpressibleByIntegerLiteral {
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
internal init(count: Int) {
_sanityCheck(count >= 0 && count <= _FixedArray${N}.capacity)
Expand All @@ -135,21 +119,18 @@ extension _FixedArray${N} where T : ExpressibleByIntegerLiteral {
self._count = Int8(truncatingIfNeeded: count)
}

@inlinable // FIXME(sil-serialize-all)
@inline(__always)
internal init() {
self.init(count: 0)
}

@inlinable // FIXME(sil-serialize-all)
@inline(__always)
internal init(allZeros: ()) {
self.init(count: ${N})
}
}

extension _FixedArray${N} {
@inlinable // FIXME(sil-serialize-all)
internal mutating func withUnsafeMutableBufferPointer<R>(
_ body: (UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R {
Expand All @@ -165,7 +146,6 @@ extension _FixedArray${N} {
}
}

@inlinable // FIXME(sil-serialize-all)
internal mutating func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R {
Expand Down
65 changes: 65 additions & 0 deletions test/api-digester/Outputs/stability-stdlib-abi.swift.expected
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,71 @@ Func _swift_stdlib_atomicStoreInt64(object:desired:) has been removed
Func _swift_stdlib_atomicStoreUInt32(object:desired:) has been removed
Func _swift_stdlib_atomicStoreUInt64(object:desired:) has been removed

Var _FixedArray16._count has been removed
Var _FixedArray16.capacity has been removed
Var _FixedArray16.count has been removed
Var _FixedArray16.endIndex has been removed
Var _FixedArray16.startIndex has been removed
Var _FixedArray16.storage has been removed
Var _FixedArray2._count has been removed
Var _FixedArray2.capacity has been removed
Var _FixedArray2.count has been removed
Var _FixedArray2.endIndex has been removed
Var _FixedArray2.startIndex has been removed
Var _FixedArray2.storage has been removed
Var _FixedArray4._count has been removed
Var _FixedArray4.capacity has been removed
Var _FixedArray4.count has been removed
Var _FixedArray4.endIndex has been removed
Var _FixedArray4.startIndex has been removed
Var _FixedArray4.storage has been removed
Var _FixedArray8._count has been removed
Var _FixedArray8.capacity has been removed
Var _FixedArray8.count has been removed
Var _FixedArray8.endIndex has been removed
Var _FixedArray8.startIndex has been removed
Var _FixedArray8.storage has been removed
Subscript _FixedArray16.subscript(_:) has been removed
Subscript _FixedArray2.subscript(_:) has been removed
Subscript _FixedArray4.subscript(_:) has been removed
Subscript _FixedArray8.subscript(_:) has been removed
Struct _FixedArray16 is now without @_fixed_layout
Struct _FixedArray2 is now without @_fixed_layout
Struct _FixedArray4 is now without @_fixed_layout
Struct _FixedArray8 is now without @_fixed_layout
Func _FixedArray16.append(_:) has been removed
Func _FixedArray16.index(after:) has been removed
Func _FixedArray16.index(before:) has been removed
Func _FixedArray16.withUnsafeBufferPointer(_:) has been removed
Func _FixedArray16.withUnsafeMutableBufferPointer(_:) has been removed
Func _FixedArray2.append(_:) has been removed
Func _FixedArray2.index(after:) has been removed
Func _FixedArray2.index(before:) has been removed
Func _FixedArray2.withUnsafeBufferPointer(_:) has been removed
Func _FixedArray2.withUnsafeMutableBufferPointer(_:) has been removed
Func _FixedArray4.append(_:) has been removed
Func _FixedArray4.index(after:) has been removed
Func _FixedArray4.index(before:) has been removed
Func _FixedArray4.withUnsafeBufferPointer(_:) has been removed
Func _FixedArray4.withUnsafeMutableBufferPointer(_:) has been removed
Func _FixedArray8.append(_:) has been removed
Func _FixedArray8.index(after:) has been removed
Func _FixedArray8.index(before:) has been removed
Func _FixedArray8.withUnsafeBufferPointer(_:) has been removed
Func _FixedArray8.withUnsafeMutableBufferPointer(_:) has been removed
Constructor _FixedArray16.init() has been removed
Constructor _FixedArray16.init(allZeros:) has been removed
Constructor _FixedArray16.init(count:) has been removed
Constructor _FixedArray2.init() has been removed
Constructor _FixedArray2.init(allZeros:) has been removed
Constructor _FixedArray2.init(count:) has been removed
Constructor _FixedArray4.init() has been removed
Constructor _FixedArray4.init(allZeros:) has been removed
Constructor _FixedArray4.init(count:) has been removed
Constructor _FixedArray8.init() has been removed
Constructor _FixedArray8.init(allZeros:) has been removed
Constructor _FixedArray8.init(count:) has been removed

Struct Hasher._Core has removed conformance to _HasherCore
Protocol _HasherCore has been removed
Struct _BufferingHasher has been removed
Expand Down