-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Improve liveness analysis for generators #84333
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
This looks good to me. To make sure I understand it, it looks like the main thing this does is adds an edge from every |
Yes, that's correct. Variables captured by reference are already marked as live in the exit node at the beginning of |
☔ The latest upstream changes (presumably #85556) made this pull request unmergeable. Please resolve the merge conflicts. |
Liveness analysis for generators assumes that execution always continues normally after a yield point, not accounting for the fact that generator could be dropped before completion. If generators captures any variables by reference, those variables could be used within a generator, or when the generator completes, but also after each yield point in the case the generator is dropped. Account for the case when generator is dropped after yielding, but before running to the completion. This effectively considers all variables captured by reference to be used after a yield point.
b9c8c0f
to
9f6f862
Compare
Rebased to resolve conflicts with #85556. |
Looks good, thanks! @bors r+ |
📌 Commit 9f6f862 has been approved by |
☀️ Test successful - checks-actions |
This borrows some code from rust-lang#84333
Liveness analysis for generators assumes that execution always continues
normally after a yield point, not accounting for the fact that generator
could be dropped before completion.
If generators captures any variables by reference, those variables could
be used within a generator, or when the generator completes, but also
after each yield point in the case the generator is dropped.
Account for the case when generator is dropped after yielding, but
before running to the completion. This effectively considers all
variables captured by reference to be used after a yield point.
Fixes #84292.