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

Issue 10802025: Fuse compare with branch at graph building time. (Closed)

Created:
8 years, 5 months ago by srdjan
Modified:
8 years, 5 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Fuse compare with branch at graph building time. Committed: https://code.google.com/p/dart/source/detail?r=9762

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Total comments: 10

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+557 lines, -369 lines) Patch
M runtime/vm/flow_graph_builder.cc View 1 2 3 4 5 6 1 chunk +51 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_compiler.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.cc View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_optimizer.h View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 2 3 4 5 6 3 chunks +0 lines, -51 lines 0 comments Download
M runtime/vm/il_printer.cc View 1 2 3 4 5 6 2 chunks +9 lines, -7 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 3 4 5 6 11 chunks +54 lines, -48 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 5 6 5 chunks +17 lines, -62 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 2 3 4 5 6 18 chunks +213 lines, -98 lines 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 2 3 4 5 6 18 chunks +212 lines, -98 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
srdjan
8 years, 5 months ago (2012-07-19 01:07:25 UTC) #1
Kevin Millikin (Google)
My comments are all high-level ones---I agree that this still needs some improvement. As a ...
8 years, 5 months ago (2012-07-19 12:28:05 UTC) #2
srdjan
8 years, 5 months ago (2012-07-19 15:33:58 UTC) #3
https://chromiumcodereview.appspot.com/10802025/diff/14002/runtime/vm/flow_gr...
File runtime/vm/flow_graph_builder.cc (right):

https://chromiumcodereview.appspot.com/10802025/diff/14002/runtime/vm/flow_gr...
runtime/vm/flow_graph_builder.cc:269: compare_instr =
compare_instr->previous()->AsBind();
On 2012/07/19 12:28:05, kmillikin wrote:
> I guess previous() is non-NULL because boolean negate has an input operand and
> we always materialize constants so the operand is always in the instruction
> stream before the negate.
> 
> I'm a bit uncomfortable relying on that --- the graph is only partly
constructed
> so assuming too much about it constrains us.  (I'm actually uncomfortable
> rewriting the graph this way during construction in general.  My experience is
> that it leads to a lot of headaches.)

Agree.

Added another test:
if (compare_instr->previous() == NULL) return false;

Yes, the AST variations are pretty limited and known. I am also uncomfortable
doing it that way and will fix it. This way is too fragile as it depends too
much on how we exactly generate AST.

https://chromiumcodereview.appspot.com/10802025/diff/14002/runtime/vm/interme...
File runtime/vm/intermediate_language.h (right):

https://chromiumcodereview.appspot.com/10802025/diff/14002/runtime/vm/interme...
runtime/vm/intermediate_language.h:114: class ComparisonComp;
On 2012/07/19 12:28:05, kmillikin wrote:
> My high level comment is that we should look for a way to get rid of the
> distinction between ComparisonComp and BranchInstr.  There is some duplication
> there.  Many optimizations (e.g., type specialization) will apply to both of
> them.
> 
> One idea might be to get rid of ComparisonComp as test+materialize in the
> instruction stream.  Instead, there are only branches, and an instruction
> ToBoolean(branch) that wraps a branch to go in the instruction stream and is a
> definition.

I agree.

https://chromiumcodereview.appspot.com/10802025/diff/14002/runtime/vm/interme...
runtime/vm/intermediate_language.h:594: virtual Token::Kind kind() const = 0;
On 2012/07/19 12:28:05, kmillikin wrote:
> I would implement this as a member variable in class ComparisonComp instead of
a
> virtual function.  All (existing) subclasses except EqualityCompareComp
already
> store it in the instance anyway.

Done.

https://chromiumcodereview.appspot.com/10802025/diff/14002/runtime/vm/interme...
runtime/vm/intermediate_language.h:1771: instr->set_previous(this);
On 2012/07/19 12:28:05, kmillikin wrote:
> I see why you did this, but I think we should avoid it.  If set_next() for a
> doubly-linked list has the side effect of mutating the previous field of its
> argument it's error prone -- you always have to read previous of X before
> calling set_next(X).
> 
> Before this change, we did not maintain previous pointers during graph
> construction but computed them afterwards.  I'd be happy with maintaining them
> during graph construction (still not part of set_next), but then we should
also
> get rid of the computation of previous poitners in BuildGraph.

I will avoid it with the better way to construct the fused branch compare.

Powered by Google App Engine
This is Rietveld 408576698