Skip to content

[stdlib] Do not introduce any new ABI symbols for _get*RetainCount #71694

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 3 commits into from
Feb 28, 2024
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
6 changes: 3 additions & 3 deletions stdlib/public/core/DebuggerSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,19 @@ internal func _swift_unownedRetainCount(_: UnsafeMutableRawPointer) -> Int
internal func _swift_weakRetainCount(_: UnsafeMutableRawPointer) -> Int

// Utilities to get refcount(s) of class objects.
@backDeployed(before: SwiftStdlib 6.0)
@_alwaysEmitIntoClient
public func _getRetainCount(_ object: AnyObject) -> UInt {
let count = _withHeapObject(of: object) { _swift_retainCount($0) }
return UInt(bitPattern: count)
}

@backDeployed(before: SwiftStdlib 6.0)
@_alwaysEmitIntoClient
public func _getUnownedRetainCount(_ object: AnyObject) -> UInt {
let count = _withHeapObject(of: object) { _swift_unownedRetainCount($0) }
return UInt(bitPattern: count)
}

@backDeployed(before: SwiftStdlib 6.0)
@_alwaysEmitIntoClient
public func _getWeakRetainCount(_ object: AnyObject) -> UInt {
let count = _withHeapObject(of: object) { _swift_weakRetainCount($0) }
return UInt(bitPattern: count)
Expand Down
9 changes: 0 additions & 9 deletions test/abi/macOS/arm64/stdlib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@

// Standard Library Symbols

// Swift._getRetainCount(Swift.AnyObject) -> Swift.UInt
Added: _$ss15_getRetainCountySuyXlF

// Swift._getWeakRetainCount(Swift.AnyObject) -> Swift.UInt
Added: _$ss19_getWeakRetainCountySuyXlF

// Swift._getUnownedRetainCount(Swift.AnyObject) -> Swift.UInt
Added: _$ss22_getUnownedRetainCountySuyXlF

// Swift.String.init<A, B where A: Swift._UnicodeEncoding, B: Swift.Sequence, A.CodeUnit == B.Element>(validating: B, as: A.Type) -> Swift.String?
Added: _$sSS10validating2asSSSgq__xmtcs16_UnicodeEncodingRzSTR_7ElementQy_8CodeUnitRtzr0_lufC

Expand Down
9 changes: 0 additions & 9 deletions test/abi/macOS/x86_64/stdlib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@

// Standard Library Symbols

// Swift._getRetainCount(Swift.AnyObject) -> Swift.UInt
Added: _$ss15_getRetainCountySuyXlF

// Swift._getWeakRetainCount(Swift.AnyObject) -> Swift.UInt
Added: _$ss19_getWeakRetainCountySuyXlF

// Swift._getUnownedRetainCount(Swift.AnyObject) -> Swift.UInt
Added: _$ss22_getUnownedRetainCountySuyXlF

// Swift.String.init<A, B where A: Swift._UnicodeEncoding, B: Swift.Sequence, A.CodeUnit == B.Element>(validating: B, as: A.Type) -> Swift.String?
Added: _$sSS10validating2asSSSgq__xmtcs16_UnicodeEncodingRzSTR_7ElementQy_8CodeUnitRtzr0_lufC

Expand Down
6 changes: 6 additions & 0 deletions test/api-digester/stability-stdlib-abi-without-asserts.test
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ Func _diagnoseUnavailableCodeReached() is a new API without @available attribute
Func _swift_retainCount(_:) is a new API without @available attribute
Func _swift_unownedRetainCount(_:) is a new API without @available attribute
Func _swift_weakRetainCount(_:) is a new API without @available attribute
// And these were temporarily added as ABI in https://github.com/apple/swift/pull/69352,
// but then https://github.com/apple/swift/pull/71694 made them @_aeic before
// they shipped anywhere, but not before they got into the ABI baseline. Fun!
Func _getRetainCount(_:) has been removed
Func _getUnownedRetainCount(_:) has been removed
Func _getWeakRetainCount(_:) has been removed

Struct AnyHashable has added a conformance to an existing protocol _HasCustomAnyHashableRepresentation
Class AnyKeyPath has added a conformance to an existing protocol CustomDebugStringConvertible
Expand Down