Skip to content

Commit c6a1dbf

Browse files
Merge pull request #5506 from swiftwasm/katei/cherry-pick-to-downstream/heapobject-cc-violation
2 parents 438d650 + e3b2c44 commit c6a1dbf

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

include/swift/Runtime/HeapObject.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,10 @@ void swift_nonatomic_release_n(HeapObject *object, uint32_t n);
194194

195195
// Refcounting observation hooks for memory tools. Don't use these.
196196
SWIFT_RUNTIME_EXPORT
197-
SWIFT_CC(swift)
198197
size_t swift_retainCount(HeapObject *object);
199198
SWIFT_RUNTIME_EXPORT
200-
SWIFT_CC(swift)
201199
size_t swift_unownedRetainCount(HeapObject *object);
202200
SWIFT_RUNTIME_EXPORT
203-
SWIFT_CC(swift)
204201
size_t swift_weakRetainCount(HeapObject *object);
205202

206203
/// Is this pointer a non-null unique reference to an object?

stdlib/public/SwiftShims/swift/shims/HeapObject.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,17 @@ struct HeapObject {
8181
#ifdef __cplusplus
8282
extern "C" {
8383
#endif
84-
#if __has_attribute(swiftcall)
85-
#define SWIFT_CC_swift __attribute__((swiftcall))
86-
#else
87-
#define SWIFT_CC_swift
88-
#endif
8984

9085
SWIFT_RUNTIME_STDLIB_API
9186
void _swift_instantiateInertHeapObject(void *address,
9287
const HeapMetadata *metadata);
9388

94-
SWIFT_CC_swift
9589
SWIFT_RUNTIME_STDLIB_API
9690
__swift_size_t swift_retainCount(HeapObject *obj);
9791

98-
SWIFT_CC_swift
9992
SWIFT_RUNTIME_STDLIB_API
10093
__swift_size_t swift_unownedRetainCount(HeapObject *obj);
10194

102-
SWIFT_CC_swift
10395
SWIFT_RUNTIME_STDLIB_API
10496
__swift_size_t swift_weakRetainCount(HeapObject *obj);
10597

stdlib/public/core/DebuggerSupport.swift

Lines changed: 9 additions & 6 deletions
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(swift_retainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
274+
}
275+
public func _getUnownedRetainCount(_ Value: AnyObject) -> UInt {
276+
return UInt(swift_unownedRetainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
277+
}
278+
public func _getWeakRetainCount(_ Value: AnyObject) -> UInt {
279+
return UInt(swift_weakRetainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
280+
}

0 commit comments

Comments
 (0)