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

Issue 1841073003: VM: Fix receiver type propagation in presence of try-catch. (Closed)

Created:
4 years, 8 months ago by Florian Schneider
Modified:
4 years, 8 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM: Fix receiver type propagation in presence of try-catch. With catch blocks appearing as additional function entry blocks, there can be phis for the receiver (parameter 0). This CL fixes the problem that the receiver type information was lost in the presence of try-catch. BUG= R=vegorov@google.com Committed: https://github.com/dart-lang/sdk/commit/2783afd6072bd3937f0d3f1d99032f35a09de4be

Patch Set 1 #

Patch Set 2 : share code between jit_ and aot_optimizer #

Total comments: 6

Patch Set 3 : addressed comments, added test #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+168 lines, -84 lines) Patch
M runtime/vm/aot_optimizer.cc View 1 4 chunks +6 lines, -37 lines 0 comments Download
M runtime/vm/flow_graph.h View 1 2 2 chunks +6 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph.cc View 1 2 2 chunks +70 lines, -0 lines 2 comments Download
M runtime/vm/flow_graph_builder.h View 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 2 chunks +2 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_type_propagator.cc View 2 chunks +7 lines, -5 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 6 chunks +25 lines, -4 lines 0 comments Download
M runtime/vm/jit_optimizer.cc View 1 5 chunks +7 lines, -38 lines 0 comments Download
A tests/language/vm/optimized_try_catch_cha_test.dart View 1 2 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
Florian Schneider
4 years, 8 months ago (2016-03-29 23:41:47 UTC) #2
Vyacheslav Egorov (Google)
lgtm https://codereview.chromium.org/1841073003/diff/20001/runtime/vm/flow_graph.cc File runtime/vm/flow_graph.cc (right): https://codereview.chromium.org/1841073003/diff/20001/runtime/vm/flow_graph.cc#newcode377 runtime/vm/flow_graph.cc:377: if (def->IsParameter() && (def->AsParameter()->index() == 0)) return true; ...
4 years, 8 months ago (2016-03-30 16:59:21 UTC) #3
Florian Schneider
https://codereview.chromium.org/1841073003/diff/20001/runtime/vm/flow_graph.cc File runtime/vm/flow_graph.cc (right): https://codereview.chromium.org/1841073003/diff/20001/runtime/vm/flow_graph.cc#newcode377 runtime/vm/flow_graph.cc:377: if (def->IsParameter() && (def->AsParameter()->index() == 0)) return true; On ...
4 years, 8 months ago (2016-03-30 21:03:57 UTC) #4
Florian Schneider
Committed patchset #3 (id:40001) manually as 2783afd6072bd3937f0d3f1d99032f35a09de4be (presubmit successful).
4 years, 8 months ago (2016-03-30 22:55:16 UTC) #6
Vyacheslav Egorov (Google)
https://codereview.chromium.org/1841073003/diff/40001/runtime/vm/flow_graph.cc File runtime/vm/flow_graph.cc (right): https://codereview.chromium.org/1841073003/diff/40001/runtime/vm/flow_graph.cc#newcode388 runtime/vm/flow_graph.cc:388: ComputeIsReceiverRecursive(def->AsPhi(), processed); Something is not right here. Imagine situation: ...
4 years, 8 months ago (2016-03-31 05:00:58 UTC) #7
Florian Schneider
4 years, 8 months ago (2016-03-31 17:13:54 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/1841073003/diff/40001/runtime/vm/flow_graph.cc
File runtime/vm/flow_graph.cc (right):

https://codereview.chromium.org/1841073003/diff/40001/runtime/vm/flow_graph.c...
runtime/vm/flow_graph.cc:388: ComputeIsReceiverRecursive(def->AsPhi(),
processed);
On 2016/03/31 05:00:58, Vyacheslav Egorov (Google) wrote:
> Something is not right here. Imagine situation:
> 
> x <- phi (y, z)
> y <- phi (x, x)
> z <- not-receiver 
> 
> in this case we will mark y as a receiver phi as far as I can see. 
> 
> I think the right way to do it is to not use bitvector at all, but instead
mark
> phi optimistically PhiInstr::kReceiver before the loop and then when it proves
> to be wrong walk all uses of the phi and mark phis among them as kNotReceiver.

> 
> If possible it would be good to have a test case covering this corner case
too. 

You're right. The current way does not the compute the property correctly for
the phis visited. I could also only compute the property for the phi of the
initial call to ComputeRecursive, but I think I'll do a pass over all phis.

Powered by Google App Engine
This is Rietveld 408576698