swift
394d6a85 - Back-deploy @objc actor types.

Commit
4 years ago
Back-deploy @objc actor types. @objc actors implicitly inherit from the new, hidden `SwiftNativeNSObject` class that inherits from `NSObject` yet provides Swift-native reference counting, which is important for the actor runtime's handling of zombies. However, `SwiftNativeNSObject` is only available in the Swift runtime in newer OS versions (e.g., macOS 12.0/iOS 15.0), and is available in the back-deployed _Concurrency library, but there is no stable place to link against for back-deployed code. Tricky, tricky. When back-deploying @objc actors, record `NSObject` as the superclass in the metadata in the binary, because we cannot reference `SwiftNativeNSObject`. Then, emit a static initializer to dynamically look up `SwiftNativeNSObject` by name (which will find it in either the back-deployment library, on older systems, or in the runtime for newer systems), then swizzle that in as the superclass of the @objc actor. Fixes rdar://83919973.
Author
Committer
Parents
Loading