-
Notifications
You must be signed in to change notification settings - Fork 10.5k
IRGen: Don't emit capture descriptor for stack allocated closures #22096
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
IRGen: Don't emit capture descriptor for stack allocated closures #22096
Conversation
@swift-ci Please test and merge |
Does this affect debugging? |
lldb does not use the closure context capture descriptor as far as I can tell: The only place that I found that reads the capture descriptor is ReflectionContext::getInstanceTypeInfo. The only place where lldb uses this function is in SwiftLanguageRuntime::GetMemberVariableOffset to get the offset of a member by name. You would need this information if you wanted to display what is captured by closure. I don't see that we are currently doing this. No tests fail. |
I don't know how many tests we have for optimized code, but I guess that's because we haven't made that a focus yet. It's possible we're regressing that behavior, but it's probably worth it for this optimization. |
This is unrelated to optimized or unoptimized code. We can have stack allocated closures under either mode. The pass that makes closures stack allocated runs in the mandatory pipeline. |
Ah, then it may be worth adding explicit checks to LLDB for printing a stack-allocated closure's captures. We shouldn't regress on that. |
You can print the captured variables inside of a closure during executing of the closure without the capture descriptor - they are passed as arguments to the function that implements the closure:
lldb does not seem to print a closure's captures when you print the closure itself which would require the capture descriptor:
When you print an escaping closure it does not seem to print the captures either:
|
Ahh, thanks for the clarification! |
No description provided.