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

Issue 2412653002: VM Propagate receiver type from calls to unique selectors in AOT compilation. (Closed)

Created:
4 years, 2 months ago by Florian Schneider
Modified:
4 years, 1 month ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM Propagate receiver type from calls to unique selectors in AOT compilation. If there is no override of noSuchMethod in any class, we can propagate the receiver type downwards from calls that call a unique selector. This speeds up dart2js by around 3%, a particle simulation benchmark by around 10%. BUG= R=rmacnak@google.com Committed: https://github.com/dart-lang/sdk/commit/e25461c1519cb323f182ec4373f159c9bf7909c4

Patch Set 1 #

Total comments: 2

Patch Set 2 : addressed comments, added test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+148 lines, -44 lines) Patch
M runtime/vm/aot_optimizer.h View 3 chunks +7 lines, -10 lines 0 comments Download
M runtime/vm/aot_optimizer.cc View 4 chunks +73 lines, -24 lines 0 comments Download
M runtime/vm/flow_graph_type_propagator.h View 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_type_propagator.cc View 2 chunks +19 lines, -3 lines 0 comments Download
M runtime/vm/intermediate_language.h View 5 chunks +10 lines, -2 lines 0 comments Download
M runtime/vm/precompiler.cc View 1 2 chunks +2 lines, -5 lines 0 comments Download
A tests/language/vm/unique_selector_test.dart View 1 1 chunk +34 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (3 generated)
Florian Schneider
4 years, 2 months ago (2016-10-11 18:06:19 UTC) #2
rmacnak
lgtm w/test class A { foo() => "foo"; bar() => "A"; } class B { ...
4 years, 2 months ago (2016-10-11 19:53:58 UTC) #3
Florian Schneider
Added test https://codereview.chromium.org/2412653002/diff/1/runtime/vm/precompiler.cc File runtime/vm/precompiler.cc (right): https://codereview.chromium.org/2412653002/diff/1/runtime/vm/precompiler.cc#newcode1498 runtime/vm/precompiler.cc:1498: // Locate all entries with one function ...
4 years, 2 months ago (2016-10-11 20:13:54 UTC) #4
Florian Schneider
Committed patchset #2 (id:20001) manually as e25461c1519cb323f182ec4373f159c9bf7909c4 (presubmit successful).
4 years, 2 months ago (2016-10-11 20:17:53 UTC) #6
Vyacheslav Egorov (Google)
This optimization is not safe in it's current form because it does not take LICM ...
4 years, 1 month ago (2016-11-15 20:48:48 UTC) #8
Florian Schneider
4 years, 1 month ago (2016-11-15 22:08:12 UTC) #9
Message was sent while issue was closed.
On 2016/11/15 20:48:48, Vyacheslav Egorov (Google) wrote:
> This optimization is not safe in it's current form because it does not take
LICM
> into account (remember that we had to disable/revert similar downwards type
> propagation from branches). Here is a crashing test:
> 
> class A {
>   uniqueSelector() {
> 
>   }
> 
>   final uniqueField = 10;
> }
> 
> foofoo(obj) {
>     var res = 0;
>     for (var i = 0; i < 2; i++) {
>       obj.uniqueSelector();
>       res += obj.uniqueField;  // this load will be hoisted out of the loop
>     }
>     return res;
> }
> 
> var foofoo_ = foofoo;
> 
> main () {
>   foofoo_(new A());
>   foofoo_(0);
> }

Thanks for catching this! We used to insert redefinitions to prevent LICM. I
think this works here as well, if we replace all uses of the receiver dominated
by the unique call by uses of the redefinition.

Powered by Google App Engine
This is Rietveld 408576698