Skip to content

[6.2] IRGen fixes to avoid using mangled names for metadata on older platforms #83013

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

Open
wants to merge 3 commits into
base: release/6.2
Choose a base branch
from

Conversation

DougGregor
Copy link
Member

  • Explanation: When we have type system changes that affect name mangling and are usable on older platforms, we cannot use the demangle-to-metadata path for creating metadata for those types, because those older platforms will fail to demangle the type. Fix two instances of this: (1) Span et al are in a back-deployed dylib, so make sure we don't use mangling for them when deploying back to a pre-Swift 6.0 runtime due to inverse generics, and (2) nonisolated(nonsending) function types were introduced in Swift 6.2.
  • Scope: Only affect back-deployment when used with these new features.
  • Issues: rdar://155639204
  • Original PRs: [IRGen] Don't use mangled names for metadata including Span et al when back-deploying #83012
  • Risk: Low. These are new features, and the changes only take affect when back-deploying and using them together. This is also a well-trod path of falling back to metadata accessors rather than using demangling to get metadata.
  • Testing: CI + separate app back-deploying to iOS 17.
  • Reviewers: @slavapestov

…n back-deploying

If back-deploying prior to the introduction of name mangling and
runtime support for invertible constraints (~Copyable, ~Escapable),
don't use mangled names to access metadata. The code already existed
for this, but had a carve-out that still used mangled names for
standard library types that have always existed but got generalized to
support non-copyable & non-escapable types.

Tweak that carve-out to not apply to types like Span that come from a
back-deployment library. Fixes crashes when using metadata for Span et
al on older platforms.

Fixes rdar://155639204.
…uced in Swift 6.2

We can't use mangled named when back-deploying earlier.
@DougGregor DougGregor requested a review from a team as a code owner July 11, 2025 21:32
@DougGregor
Copy link
Member Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant