Skip to content

[stdlib] Fix calling convention mismatch for debugger utility functions #5506

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
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
3 changes: 0 additions & 3 deletions include/swift/Runtime/HeapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,10 @@ void swift_nonatomic_release_n(HeapObject *object, uint32_t n);

// Refcounting observation hooks for memory tools. Don't use these.
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
size_t swift_retainCount(HeapObject *object);
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
size_t swift_unownedRetainCount(HeapObject *object);
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
size_t swift_weakRetainCount(HeapObject *object);

/// Is this pointer a non-null unique reference to an object?
Expand Down
8 changes: 0 additions & 8 deletions stdlib/public/SwiftShims/swift/shims/HeapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,17 @@ struct HeapObject {
#ifdef __cplusplus
extern "C" {
#endif
#if __has_attribute(swiftcall)
#define SWIFT_CC_swift __attribute__((swiftcall))
#else
#define SWIFT_CC_swift
#endif

SWIFT_RUNTIME_STDLIB_API
void _swift_instantiateInertHeapObject(void *address,
const HeapMetadata *metadata);

SWIFT_CC_swift
SWIFT_RUNTIME_STDLIB_API
__swift_size_t swift_retainCount(HeapObject *obj);

SWIFT_CC_swift
SWIFT_RUNTIME_STDLIB_API
__swift_size_t swift_unownedRetainCount(HeapObject *obj);

SWIFT_CC_swift
SWIFT_RUNTIME_STDLIB_API
__swift_size_t swift_weakRetainCount(HeapObject *obj);

Expand Down
15 changes: 9 additions & 6 deletions stdlib/public/core/DebuggerSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,12 @@ public func _stringForPrintObject(_ value: Any) -> String {
public func _debuggerTestingCheckExpect(_: String, _: String) { }

// Utilities to get refcount(s) of class objects.
@_silgen_name("swift_retainCount")
public func _getRetainCount(_ Value: AnyObject) -> UInt
@_silgen_name("swift_unownedRetainCount")
public func _getUnownedRetainCount(_ Value: AnyObject) -> UInt
@_silgen_name("swift_weakRetainCount")
public func _getWeakRetainCount(_ Value: AnyObject) -> UInt
public func _getRetainCount(_ Value: AnyObject) -> UInt {
return UInt(swift_retainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
}
public func _getUnownedRetainCount(_ Value: AnyObject) -> UInt {
return UInt(swift_unownedRetainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
}
public func _getWeakRetainCount(_ Value: AnyObject) -> UInt {
return UInt(swift_weakRetainCount(unsafeBitCast(Value, to: UnsafeMutablePointer<HeapObject>.self)))
}