Uh oh!
There was an error while loading. Please reload this page.
Improve liveness analysis for generators - #84333
Conversation
rust-highfive
commented
Apr 19, 2021
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
tmandry
commented
Aug 14, 2021
eholk
commented
Aug 17, 2021
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 |
tmiasko
commented
Aug 18, 2021
Yes, that's correct. Variables captured by reference are already marked as live in the exit node at the beginning of |
bors
commented
Aug 24, 2021
☔ 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.
tmiasko
commented
Aug 24, 2021
Rebased to resolve conflicts with #85556. |
Uh oh!
There was an error while loading. Please reload this page.
tmandry
commented
Aug 25, 2021
Looks good, thanks! @bors r+ |
bors
commented
Aug 25, 2021
📌 Commit 9f6f862 has been approved by |
bors
commented
Aug 25, 2021
bors
commented
Aug 25, 2021
☀️ Test successful - checks-actions |
tmiasko
commented
Aug 25, 2021
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.