Skip to content

IRGen: Perform completely fragile layout for all classes, not just @objc ancestry [4.2 6/11] #17211

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jun 14, 2018

  • Description: In 4.2 we enabled resilience for value types. If a class has fields of resilient type the class metadata has to be initialized dynamically since the size of those fields is not known. Dynamic initialization of this form is not supported by the Objective-C runtime. We added a workaround so that classes with @objc ancestry bypass resilience when doing layout, allowing them to be referenced from Objective-C code. However classes without @objc ancestry can also have Objective-C categories and Objective-C protocol conformances. So broaden the workaround for all classes when Objective-C interop is enabled.

  • Scope of the issue: Reported by users testing beta 1.

  • Origination: New in 4.2.

  • Tested: Existing test change changed to have a non-NSObject subclass.

  • Risk: Low, the existing workaround is already known to work in the wild.

  • Radar: Fixes rdar://problem/40819319

  • Reviewed by: @jckarter

 ancestry

Otherwise, Objective C categories don't work for classes with
resilient fields, such as the value types defined in the Foundation
overlay.

Fixes <rdar://problem/40819319>, <https://bugs.swift.org/browse/SR-7882>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov merged commit 67e28ac into swiftlang:swift-4.2-branch-06-11-2018 Jun 14, 2018
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