Skip to content

ClosureSpecializer: don't specialize captures of stack-allocated Objective-C blocks #82537

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
Jun 27, 2025

Conversation

eeckstein
Copy link
Contributor

Bail if the closure captures an ObjectiveC block which might not be copied onto the heap, i.e optimized by SimplifyCopyBlock. We can't do this because the optimization inserts retains+releases for captured arguments. That's not possible for stack-allocated blocks.

Fixes a mis-compile
rdar://154241245

…ctive-C blocks

Bail if the closure captures an ObjectiveC block which might _not_ be copied onto the heap, i.e optimized by SimplifyCopyBlock.
We can't do this because the optimization inserts retains+releases for captured arguments.
That's not possible for stack-allocated blocks.

Fixes a mis-compile
rdar://154241245
@eeckstein
Copy link
Contributor Author

@swift-ci test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eeckstein
Copy link
Contributor Author

@swift-ci test macos

@eeckstein eeckstein merged commit ea6ed2f into swiftlang:main Jun 27, 2025
5 checks passed
@eeckstein eeckstein deleted the fix-closure-specializer branch June 27, 2025 04:46
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.

2 participants