Skip to content

[5.9][Runtime] Fix _swift_refCountBytesForMetatype for reference types #67600

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

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Jul 28, 2023

_swift_addRefCountStringForMetatype and _swift_refCountBytesForMetatype diverged in the code that determines whether a type is a reference, causing the size number of ref count bytes to differ from the actually used bytes. This can cause early termination of the runtime interpreter functions, which in turn causes unbalanced reference counts.

Risk: Low. Experimental feature.
Scope: Narrow. This only affects runtime instantiation of layout strings when an ObjC class is used in a generic position.
Original PR: #67599
Reviewed By: @tbkka
Testing: Added a test case that covers this particular situation and failed before the fix.
Resolves: rdar://112474091

@drexin drexin requested a review from a team as a code owner July 28, 2023 19:08
@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test

@drexin drexin changed the title [Runtime] Fix _swift_refCountBytesForMetatype for reference types [5.9][Runtime] Fix _swift_refCountBytesForMetatype for reference types Jul 28, 2023
@drexin drexin added swift 5.9 🍒 release cherry pick Flag: Release branch cherry picks labels Jul 28, 2023
@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test linux

@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test

@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test

@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test

@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test

_swift_addRefCountStringForMetatype and _swift_refCountBytesForMetatype diverged in the code that determines whether a type is a reference, causing the size number of ref count bytes to differ from the actually used bytes. This can cause early termination of the runtime interpreter functions, which in turn causes unbalanced reference counts.

rdar://112474091
@drexin
Copy link
Contributor Author

drexin commented Jul 28, 2023

@swift-ci test

@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2023

@swift-ci test linux

@drexin
Copy link
Contributor Author

drexin commented Jul 29, 2023

@swift-ci test windows

@drexin drexin merged commit 149e8e4 into swiftlang:release/5.9 Aug 3, 2023
@drexin drexin deleted the release/5.9 branch August 3, 2023 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants