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

Issue 10857016: Refactored FlowGraphBuilder into a separate FlowGraph representation. (Closed)

Created:
8 years, 4 months ago by zerny-google
Modified:
8 years, 4 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Refactored FlowGraphBuilder into a separate FlowGraph representation. R=kmillikin@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=10807

Patch Set 1 #

Patch Set 2 : Added flow_graph.{h,cc} #

Total comments: 27

Patch Set 3 : Revision based on Kevin's review. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+682 lines, -552 lines) Patch
M runtime/vm/compiler.cc View 1 2 5 chunks +27 lines, -17 lines 0 comments Download
A runtime/vm/flow_graph.h View 1 2 1 chunk +116 lines, -0 lines 0 comments Download
A runtime/vm/flow_graph.cc View 1 2 1 chunk +468 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_allocator.h View 1 2 2 chunks +3 lines, -7 lines 0 comments Download
M runtime/vm/flow_graph_allocator.cc View 1 2 10 chunks +25 lines, -28 lines 0 comments Download
M runtime/vm/flow_graph_builder.h View 1 2 4 chunks +9 lines, -35 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 4 chunks +3 lines, -437 lines 0 comments Download
M runtime/vm/flow_graph_compiler.cc View 1 2 1 chunk +4 lines, -5 lines 0 comments Download
M runtime/vm/flow_graph_compiler_arm.h View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.h View 1 2 4 chunks +8 lines, -8 lines 0 comments Download
M runtime/vm/il_printer.h View 1 2 3 chunks +8 lines, -7 lines 0 comments Download
M runtime/vm/vm_sources.gypi View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
zerny-google
There are still many things that can be cleaned but the structure here should be ...
8 years, 4 months ago (2012-08-15 15:28:10 UTC) #1
srdjan
Please add flow_graph.{cc,h} to the CL
8 years, 4 months ago (2012-08-15 22:02:46 UTC) #2
zerny-google
Added flow_graph.{h,cc}
8 years, 4 months ago (2012-08-16 06:14:40 UTC) #3
Kevin Millikin (Google)
I have a bunch of style comments. LGTM when they are addressed. https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/compiler.cc File runtime/vm/compiler.cc ...
8 years, 4 months ago (2012-08-16 08:09:57 UTC) #4
zerny-google
8 years, 4 months ago (2012-08-16 11:52:26 UTC) #5
Revision based on Kevin's review.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/compiler.cc
File runtime/vm/compiler.cc (right):

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/compiler...
runtime/vm/compiler.cc:136: FlowGraph flow_graph(parsed_function);
On 2012/08/16 08:09:57, kmillikin wrote:
> It's a bit strange (to me) that there is such a thing as an unbuilt graph. 
For
> some reason I expect something more like:
> 
> FlowGraphBuilder builder(...);
> FlowGraph* graph = builder.BuildGraph();

Sure.

> Also, I'd put this declaration down closer to its first use (after the
> TimerScope).

Unfortunately the graph/block_order is used after the TimerScope.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/compiler...
runtime/vm/compiler.cc:168: // Print flow graph to stdout.
On 2012/08/16 08:09:57, kmillikin wrote:
> Did we lose a "Before Optimizations:\n" that used to be printed here?

I can't seem to find that in git-svn, but will be happy to add it.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/compiler...
runtime/vm/compiler.cc:169: FlowGraphPrinter printer(parsed_function.function(),
On 2012/08/16 08:09:57, kmillikin wrote:
> I seems like this constructor could just take the graph as input, but feel
free
> to make that in a separate cleanup change.

Yes. The other utilities should really take the graph instead of the block entry
arrays.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/compiler...
runtime/vm/compiler.cc:175: FlowGraphVisualizer
printer(parsed_function.function(),
On 2012/08/16 08:09:57, kmillikin wrote:
> Also here and most of the constructors below, the graph could be the input.
> 
> It's just a bit weird that a class that mutates the graph (e.g.,
> FlowGraphOptimizer) does not take the graph itself as an argument.

Yes.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
File runtime/vm/flow_graph.cc (right):

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph.cc:57: reverse_postorder_.Add(postorder_[block_count - i -
1]);
On 2012/08/16 08:09:57, kmillikin wrote:
> I don't think a reversed copy of the other list adds much value.  I wonder if
> anyone would complain if we removed it?

Differing to a later CL.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph.cc:472: }
On 2012/08/16 08:09:57, kmillikin wrote:
> There should be one or two lines of whitespace before the closing brace and it
> should have a "// namespace dart" end-of-line comment.

Done.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
File runtime/vm/flow_graph.h (right):

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph.h:8: #include "vm/ast.h"
On 2012/08/16 08:09:57, kmillikin wrote:
> Are you sure you need to include this?  I can't immediately see why.

Thanks. It was the parser.h I needed.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph.h:64: void ComputeOrders();
On 2012/08/16 08:09:57, kmillikin wrote:
> I like the name DiscoverBlocks better.  It seems more central that this is the
> unique function that makes the implicit basic-block structure explicit.

Ok

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph.h:66: const ParsedFunction& parsed_function_;
On 2012/08/16 08:09:57, kmillikin wrote:
> Member variables should all be at the end of the private: section and grouped
> together.

Done.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph.h:103: GrowableArray<intptr_t> parent_;
On 2012/08/16 08:09:57, kmillikin wrote:
> These variables (parent_ and assigned_vars_) should have a comment that they
are
> used for SSA computation and but not maintained afterward.

Done.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
File runtime/vm/flow_graph_allocator.cc (right):

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph_allocator.cc:61:
block_order_(flow_graph->reverse_postorder()),
On 2012/08/16 08:09:57, kmillikin wrote:
> Instead of reading these fields out of the flow graph, it's probably better to
> just use the values in the graph.  You can still define convenience accessors
in
> FlowGraphAllocator.

Postponing to a later CL.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph_allocator.cc:518:
ASSERT(flow_graph_->copied_parameter_count() == 0 ||
On 2012/08/16 08:09:57, kmillikin wrote:
> This assert should have a comment explaining it.

Done.

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
File runtime/vm/flow_graph_allocator.h (right):

https://chromiumcodereview.appspot.com/10857016/diff/4001/runtime/vm/flow_gra...
runtime/vm/flow_graph_allocator.h:176: // TODO(vegorov): this field is used only
to call Bailout. Remove when
On 2012/08/16 08:09:57, kmillikin wrote:
> I don't think the TODO comment is accurate anymore (flow_graph_ is used for
more
> than calling Bailout).  The comment can be deleted.

Done.

Powered by Google App Engine
This is Rietveld 408576698