Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Issue 2769313004: VM: [Kernel] Ensure that result of v.operator[]=(...) invocations is never used. (Closed)

Created:
3 years, 9 months ago by Vyacheslav Egorov (Google)
Modified:
3 years, 9 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM: [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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -0 lines) Patch
M runtime/vm/kernel_to_il.cc View 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (4 generated)
Vyacheslav Egorov (Google)
PTAL
3 years, 9 months ago (2017-03-24 12:53:50 UTC) #2
kustermann
lgtm
3 years, 9 months ago (2017-03-24 13:02:31 UTC) #5
Kevin Millikin (Google)
LGTM.
3 years, 9 months ago (2017-03-24 14:44:42 UTC) #6
Vyacheslav Egorov (Google)
3 years, 9 months ago (2017-03-24 16:35:10 UTC) #8
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
52e2dadea32fc6bb6f1626e7141462579a73c9fd (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698