Commit b1b6abb
committed
go/ir: emit field and index lvals on demand
This backports 1928cea0f0cc5f74e1840d00b5c809f7ed73402b from x/tools:
go/ssa: emit field and index lvals on demand
Adds a new lazyAddress construct. This is the same as an *address
except it emits a FieldAddr selection, Field selection, or IndexAddr
on demand.
This fixes issues with ordering on assignment statements. For example,
x.f = e panics on x being nil in phase 2 of assignment statements.
This change delays the introduction of the FieldAddr for x.f until it is
used instead of as a side effect of (*builder).addr. The nil deref panic
is from FieldAddr is now after side-effects of evaluating x and e but
before the assignment to x.f.1 parent 3e57c5d commit b1b6abb
2 files changed
+55
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
360 | 364 | | |
| 365 | + | |
361 | 366 | | |
362 | 367 | | |
363 | 368 | | |
| |||
411 | 416 | | |
412 | 417 | | |
413 | 418 | | |
414 | | - | |
415 | | - | |
416 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
417 | 430 | | |
418 | | - | |
419 | | - | |
| 431 | + | |
420 | 432 | | |
421 | 433 | | |
422 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
117 | 151 | | |
118 | 152 | | |
119 | 153 | | |
| |||
0 commit comments