Skip to content

Commit cc72301

Browse files
authored
Merge pull request #66531 from swiftwasm/pr-8addaa1d85ba6750d500373b55bd9451e869c8e6
[stdlib] Fix calling convention mismatch for debugger utility functions
2 parents 1af18c3 + 819d984 commit cc72301

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

stdlib/public/core/DebuggerSupport.swift

+9-6
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,12 @@ public func _stringForPrintObject(_ value: Any) -> String {
269269
public func _debuggerTestingCheckExpect(_: String, _: String) { }
270270

271271
// Utilities to get refcount(s) of class objects.
272-
@_silgen_name("swift_retainCount")
273-
public func _getRetainCount(_ Value: AnyObject) -> UInt
274-
@_silgen_name("swift_unownedRetainCount")
275-
public func _getUnownedRetainCount(_ Value: AnyObject) -> UInt
276-
@_silgen_name("swift_weakRetainCount")
277-
public func _getWeakRetainCount(_ Value: AnyObject) -> UInt
272+
public func _getRetainCount(_ Value: AnyObject) -> UInt {
273+
return UInt(bitPattern: swift_retainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
274+
}
275+
public func _getUnownedRetainCount(_ Value: AnyObject) -> UInt {
276+
return UInt(bitPattern: swift_unownedRetainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
277+
}
278+
public func _getWeakRetainCount(_ Value: AnyObject) -> UInt {
279+
return UInt(bitPattern: swift_weakRetainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
280+
}

0 commit comments

Comments
 (0)