Commit ff1838f
committed
relocate upvars with saved locals for analysis
... and treat coroutine upvar captures as saved locals as well. This allows the liveness analysis to determine which captures are truly saved across a yield point and which are initially used but discarded at first yield points. In the event that upvar captures are promoted, most certainly because a coroutine suspends at least once, the slots in the promotion prefix shall be reused. This means that the copies emitted in the upvar relocation MIR pass will eventually elided and eliminated in the codegen phase, hence no additional runtime cost is realised. Additional MIR dumps are inserted so that it is easier to inspect the bodies of async closures, including those that captures the state by-value. Debug information is updated to point at the correct location for upvars in borrow checking errors and final debuginfo. A language change that this patch enables is now actually reverted, so that lifetimes on relocated upvars are invariant with the upvars outside of the coroutine body. We are deferring the language change to a later discussion. Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net> Signed-off-by: Xiangfei Ding <dingxiangfei2009@protonmail.ch>1 parent ea49d7c commit ff1838f
File tree
94 files changed
+2408
-490
lines changed- compiler
- rustc_abi/src
- layout
- rustc_borrowck/src
- rustc_codegen_cranelift/src
- rustc_codegen_llvm/src/debuginfo/metadata/enums
- rustc_codegen_ssa/src/mir
- rustc_const_eval/src/interpret
- rustc_index/src
- rustc_middle/src
- mir
- ty
- rustc_mir_transform/src
- coroutine
- shim
- rustc_session/src
- rustc_trait_selection/src
- error_reporting/traits
- traits/query
- rustc_traits/src
- rustc_ty_utils/src
- src/tools
- clippy/tests/ui
- miri/tests/pass
- tests
- codegen-llvm
- debuginfo
- mir-opt
- building
- ui
- async-await
- async-drop
- future-sizes
- cmse-nonsecure/cmse-nonsecure-entry
- coroutine
- lint/large_assignments
- mir/lint
- print_type_sizes
- rustc_public-ir-print
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
94 files changed
+2408
-490
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
213 | | - | |
| 214 | + | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
220 | 223 | | |
221 | | - | |
| 224 | + | |
| 225 | + | |
222 | 226 | | |
223 | 227 | | |
| 228 | + | |
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
| |||
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
| 89 | + | |
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
| |||
103 | 116 | | |
104 | 117 | | |
105 | 118 | | |
| 119 | + | |
106 | 120 | | |
107 | 121 | | |
108 | 122 | | |
| |||
122 | 136 | | |
123 | 137 | | |
124 | 138 | | |
| 139 | + | |
125 | 140 | | |
126 | 141 | | |
127 | 142 | | |
| |||
145 | 160 | | |
146 | 161 | | |
147 | 162 | | |
148 | | - | |
| 163 | + | |
| 164 | + | |
149 | 165 | | |
150 | 166 | | |
| 167 | + | |
151 | 168 | | |
152 | 169 | | |
153 | 170 | | |
154 | 171 | | |
155 | 172 | | |
156 | 173 | | |
| 174 | + | |
157 | 175 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
162 | 181 | | |
163 | 182 | | |
164 | 183 | | |
| |||
168 | 187 | | |
169 | 188 | | |
170 | 189 | | |
171 | | - | |
172 | | - | |
173 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
174 | 213 | | |
175 | 214 | | |
176 | 215 | | |
177 | 216 | | |
178 | 217 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
183 | 222 | | |
184 | 223 | | |
185 | 224 | | |
| |||
213 | 252 | | |
214 | 253 | | |
215 | 254 | | |
| 255 | + | |
216 | 256 | | |
217 | 257 | | |
218 | 258 | | |
219 | 259 | | |
220 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
221 | 314 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
229 | 319 | | |
230 | | - | |
| 320 | + | |
231 | 321 | | |
232 | 322 | | |
233 | | - | |
| 323 | + | |
234 | 324 | | |
235 | 325 | | |
236 | 326 | | |
| |||
254 | 344 | | |
255 | 345 | | |
256 | 346 | | |
257 | | - | |
| 347 | + | |
258 | 348 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
270 | 355 | | |
271 | 356 | | |
272 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2478 | 2478 | | |
2479 | 2479 | | |
2480 | 2480 | | |
2481 | | - | |
| 2481 | + | |
2482 | 2482 | | |
2483 | 2483 | | |
2484 | 2484 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
894 | 897 | | |
895 | 898 | | |
896 | 899 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
725 | 724 | | |
726 | 725 | | |
727 | 726 | | |
| |||
761 | 760 | | |
762 | 761 | | |
763 | 762 | | |
764 | | - | |
765 | 763 | | |
766 | 764 | | |
767 | 765 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | 189 | | |
193 | 190 | | |
194 | 191 | | |
| |||
216 | 213 | | |
217 | 214 | | |
218 | 215 | | |
219 | | - | |
220 | 216 | | |
221 | 217 | | |
222 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
934 | 934 | | |
935 | 935 | | |
936 | 936 | | |
| 937 | + | |
937 | 938 | | |
938 | 939 | | |
939 | 940 | | |
940 | 941 | | |
941 | 942 | | |
942 | | - | |
943 | | - | |
944 | 943 | | |
945 | 944 | | |
946 | 945 | | |
| |||
980 | 979 | | |
981 | 980 | | |
982 | 981 | | |
| 982 | + | |
983 | 983 | | |
984 | 984 | | |
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
989 | | - | |
990 | 988 | | |
991 | 989 | | |
992 | 990 | | |
| |||
1005 | 1003 | | |
1006 | 1004 | | |
1007 | 1005 | | |
| 1006 | + | |
1008 | 1007 | | |
1009 | 1008 | | |
1010 | 1009 | | |
1011 | 1010 | | |
1012 | 1011 | | |
1013 | | - | |
1014 | | - | |
1015 | 1012 | | |
1016 | 1013 | | |
1017 | 1014 | | |
| |||
0 commit comments