[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
This commit is contained in:
Mike Ash
2025-11-04 13:30:11 -05:00
parent 6dbe0cb0da
commit 7036784480
2 changed files with 3 additions and 1 deletions

View File

@@ -252,7 +252,7 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL
// differs from the standard calling convention. Currently this is only used for
// swift_retain, swift_release, and some internal helper functions that they
// call.
#if defined(__aarch64__)
#if defined(__aarch64__) && !SWIFT_RUNTIME_EMBEDDED
#define SWIFT_REFCOUNT_CC SWIFT_CC_PreserveMost
#define SWIFT_REFCOUNT_CC_PRESERVEMOST 1
#else

View File

@@ -59,8 +59,10 @@ namespace swift {
template <typename Ret, typename Param>
Param returnTypeHelper(Ret (*)(Param)) {}
#if SWIFT_REFCOUNT_CC_PRESERVEMOST
template <typename Ret, typename Param>
Param returnTypeHelper(SWIFT_REFCOUNT_CC Ret (*)(Param)) {}
#endif
#if defined(__LP64__) || defined(_LP64)
#define REGISTER_SUBSTITUTION_PREFIX ""