Skip to content

Commit 7036784

Browse files
committed
[Runtime] Don't use custom retain/release calling convention in embedded Swift.
In embedded mode, some things call retain/release using the C++ declarations, but the implementations are in Swift. The Swift implementations don't use preservemost, so the C++ declarations must not declare preservemost in that context. rdar://163940783
1 parent 6dbe0cb commit 7036784

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

include/swift/Runtime/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
252252
// differs from the standard calling convention. Currently this is only used for
253253
// swift_retain, swift_release, and some internal helper functions that they
254254
// call.
255-
#if defined(__aarch64__)
255+
#if defined(__aarch64__) && !SWIFT_RUNTIME_EMBEDDED
256256
#define SWIFT_REFCOUNT_CC SWIFT_CC_PreserveMost
257257
#define SWIFT_REFCOUNT_CC_PRESERVEMOST 1
258258
#else

include/swift/Runtime/CustomRRABI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ namespace swift {
5959
template <typename Ret, typename Param>
6060
Param returnTypeHelper(Ret (*)(Param)) {}
6161

62+
#if SWIFT_REFCOUNT_CC_PRESERVEMOST
6263
template <typename Ret, typename Param>
6364
Param returnTypeHelper(SWIFT_REFCOUNT_CC Ret (*)(Param)) {}
65+
#endif
6466

6567
#if defined(__LP64__) || defined(_LP64)
6668
#define REGISTER_SUBSTITUTION_PREFIX ""

0 commit comments

Comments
 (0)