DescriptionVM: [Kernel] Ensure that result of v.operator[]=(...) invocations is never used.
Currently Fasta translates cascade of indexed assignments into a cascade of
let-statements.
For example code like
```dart
indices
..[0] = 0
..[_schemeEndIndex] = start - 1
..[_hostStartIndex] = start - 1
..[_notSimpleIndex] = start - 1
..[_portStartIndex] = start
..[_pathStartIndex] = start
..[_queryStartIndex] = end
..[_fragmentStartIndex] = end;
```
gets translated to
```
let final dynamic #t826 = indices in
let final dynamic #t827 = #t826.[]=(0, 0) in
let final dynamic #t828 = #t826.[]=(core::_schemeEndIndex, start.-(1)) in
let final dynamic #t829 = #t826.[]=(core::_hostStartIndex, start.-(1)) in
let final dynamic #t830 = #t826.[]=(core::_notSimpleIndex, start.-(1)) in
let final dynamic #t831 = #t826.[]=(core::_portStartIndex, start) in
let final dynamic #t832 = #t826.[]=(core::_pathStartIndex, start) in
let final dynamic #t833 = #t826.[]=(core::_queryStartIndex, end) in
let final dynamic #t834 = #t826.[]=(core::_fragmentStartIndex, end) in
#t826;
```
This later becomes in IL (on the example of `#t826.[]=(0, 0)`):
```
t0 <- InstanceCall:120( []=, t0, t0, t0)
StoreLocal(:var1 @-19, t0)
```
After SSA construction if locals liveness analysis is disabled
(`--no-prune-dead-locals`) we get essentially redundant phis constructed for
temporary let-variables which actually use result of the instance call:
```
v25 <- InstanceCall:120( []=, v22, v24, v24)
...
v629 <- phi(v636, v25)
```
These phis are redundant because their values can never be observed by the
program because they correspond to dead stores. In fact these phis only have
environment uses.
However subsequent optimization passes assume that result of a `v.[]=(...)`
invocation can never be used and replace `v.[]=(...)` with IL sequences that
don't actually produce any value - leading to malformed graphs where phis
refer to instructions outside of the graph.
To workaround the issue we explicitly drop the actual result of `v.[]=(...)`
and push a null-value to be used instead.
Fixes https://github.com/dart-lang/sdk/issues/29135
R=kmillikin@google.com, kustermann@google.com
Committed: https://github.com/dart-lang/sdk/commit/52e2dadea32fc6bb6f1626e7141462579a73c9fd
Patch Set 1 #
Messages
Total messages: 8 (4 generated)
|