Skip to content

Commit 671de07

Browse files
committed
[stdlib] Audit @_fixed_layout usage in collection storage classes
- Remove __SwiftNativeNSEnumerator from the ABI. (It’s only used in internal classes and in the Objective-C runtime.) - Remove inlinability of init() and deinit for all the __SwiftNativeNSFoo superclasses except Array’s and Data’s.
1 parent 41e9dab commit 671de07

File tree

5 files changed

+38
-37
lines changed

5 files changed

+38
-37
lines changed

stdlib/public/core/DictionaryStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import SwiftShims
1616
/// Enough bytes are allocated to hold the bitmap for marking valid entries,
1717
/// keys, and values. The data layout starts with the bitmap, followed by the
1818
/// keys, followed by the values.
19-
@_fixed_layout // FIXME(sil-serialize-all)
19+
@_fixed_layout
2020
@usableFromInline
2121
@_objc_non_lazy_realization
2222
internal class _RawDictionaryStorage: __SwiftNativeNSDictionary {

stdlib/public/core/Runtime.swift.gyb

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -312,57 +312,50 @@ internal func _rawPointerToString(_ value: Builtin.RawPointer) -> String {
312312
// coexist, so they were renamed. The old names must not be used in the
313313
// new runtime.
314314

315-
@_fixed_layout // FIXME(sil-serialize-all)
316-
@usableFromInline // FIXME(sil-serialize-all)
315+
@_fixed_layout
316+
@usableFromInline
317317
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSArrayBase)
318318
internal class __SwiftNativeNSArray {
319-
@inlinable // FIXME(sil-serialize-all)
319+
@inlinable
320320
@nonobjc
321321
internal init() {}
322-
@inlinable // FIXME(sil-serialize-all)
322+
@inlinable
323323
deinit {}
324324
}
325325

326-
@_fixed_layout // FIXME(sil-serialize-all)
327-
@usableFromInline // FIXME(sil-serialize-all)
326+
@_fixed_layout
327+
@usableFromInline
328328
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSDictionaryBase)
329329
internal class __SwiftNativeNSDictionary {
330-
@inlinable // FIXME(sil-serialize-all)
331330
@nonobjc
332331
internal init() {}
333-
@inlinable // FIXME(sil-serialize-all)
334332
deinit {}
335333
}
336334

337-
@_fixed_layout // FIXME(sil-serialize-all)
338-
@usableFromInline // FIXME(sil-serialize-all)
335+
@_fixed_layout
336+
@usableFromInline
339337
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSSetBase)
340338
internal class __SwiftNativeNSSet {
341-
@inlinable // FIXME(sil-serialize-all)
342339
@nonobjc
343340
internal init() {}
344-
@inlinable // FIXME(sil-serialize-all)
345341
deinit {}
346342
}
347343

348-
@_fixed_layout // FIXME(sil-serialize-all)
349-
@usableFromInline // FIXME(sil-serialize-all)
350-
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSEnumeratorBase)
344+
@objc
345+
@_swift_native_objc_runtime_base(__SwiftNativeNSEnumeratorBase)
351346
internal class __SwiftNativeNSEnumerator {
352-
@inlinable // FIXME(sil-serialize-all)
353347
@nonobjc
354348
internal init() {}
355-
@inlinable // FIXME(sil-serialize-all)
356349
deinit {}
357350
}
358351

359352
// FIXME(ABI)#60 : move into the Foundation overlay and remove 'open'
360-
@_fixed_layout // FIXME(sil-serialize-all)
353+
@_fixed_layout
361354
@objc @_swift_native_objc_runtime_base(__SwiftNativeNSDataBase)
362355
open class __SwiftNativeNSData {
363-
@inlinable // FIXME(sil-serialize-all)
356+
@inlinable
364357
@objc public init() {}
365-
@inlinable // FIXME(sil-serialize-all)
358+
@inlinable
366359
deinit {}
367360
}
368361

@@ -405,28 +398,28 @@ public func _stdlib_initializeReturnAutoreleased() {
405398
}
406399
#else
407400

408-
@_fixed_layout // FIXME(sil-serialize-all)
409-
@usableFromInline // FIXME(sil-serialize-all)
401+
@_fixed_layout
402+
@usableFromInline
410403
internal class __SwiftNativeNSArray {
411-
@inlinable // FIXME(sil-serialize-all)
404+
@inlinable
412405
internal init() {}
413-
@inlinable // FIXME(sil-serialize-all)
406+
@inlinable
414407
deinit {}
415408
}
416-
@_fixed_layout // FIXME(sil-serialize-all)
417-
@usableFromInline // FIXME(sil-serialize-all)
409+
@_fixed_layout
410+
@usableFromInline
418411
internal class __SwiftNativeNSDictionary {
419-
@inlinable // FIXME(sil-serialize-all)
412+
@inlinable
420413
internal init() {}
421-
@inlinable // FIXME(sil-serialize-all)
414+
@inlinable
422415
deinit {}
423416
}
424-
@_fixed_layout // FIXME(sil-serialize-all)
425-
@usableFromInline // FIXME(sil-serialize-all)
417+
@_fixed_layout
418+
@usableFromInline
426419
internal class __SwiftNativeNSSet {
427-
@inlinable // FIXME(sil-serialize-all)
420+
@inlinable
428421
internal init() {}
429-
@inlinable // FIXME(sil-serialize-all)
422+
@inlinable
430423
deinit {}
431424
}
432425

stdlib/public/core/SetStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import SwiftShims
1616
/// Enough bytes are allocated to hold the bitmap for marking valid entries,
1717
/// keys, and values. The data layout starts with the bitmap, followed by the
1818
/// keys, followed by the values.
19-
@_fixed_layout // FIXME(sil-serialize-all)
19+
@_fixed_layout
2020
@usableFromInline
2121
@_objc_non_lazy_realization
2222
internal class _RawSetStorage: __SwiftNativeNSSet {

stdlib/public/core/SwiftNativeNSArray.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ internal func _isValidArraySubscript(_ index: Int, count: Int) -> Bool {
4141
/// NOTE: older runtimes called this
4242
/// _SwiftNativeNSArrayWithContiguousStorage. The two must coexist, so
4343
/// it was renamed. The old name must not be used in the new runtime.
44-
@_fixed_layout // FIXME(sil-serialize-all)
44+
@_fixed_layout
4545
@usableFromInline
4646
internal class __SwiftNativeNSArrayWithContiguousStorage
4747
: __SwiftNativeNSArray { // Provides NSArray inheritance and native refcounting
4848

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

52-
@inlinable // FIXME(sil-serialize-all)
52+
@inlinable
5353
deinit {}
5454

5555
// Operate on our contiguous storage

test/api-digester/Outputs/stability-stdlib-abi.swift.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ Func SystemRandomNumberGenerator._fill(bytes:) has been removed
161161
Func _createStringTableCache(_:) has been removed
162162
Struct _StringSwitchContext has been removed
163163

164+
Class __SwiftNativeNSEnumerator has been removed
165+
Constructor _RawDictionaryStorage.init() has been removed
166+
Constructor _RawSetStorage.init() has been removed
167+
Constructor __SwiftNativeNSDictionary.init() has been removed
168+
Constructor __SwiftNativeNSSet.init() has been removed
169+
Class _DictionaryStorage is now without @_fixed_layout
170+
Class _SetStorage is now without @_fixed_layout
171+
164172
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>
165173
Func Numeric.+(_:) has been removed
166174
Func Numeric.+(_:_:) has been removed

0 commit comments

Comments
 (0)