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

Issue 10446116: Add flow graph printing into a .cfg file with flag --print-flow-graph-file. (Closed)

Created:
8 years, 6 months ago by Florian Schneider
Modified:
8 years, 6 months ago
Reviewers:
srdjan, siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Add flow graph printing into a .cfg file with flag --print-flow-graph-file. This CL adds a flag --print-flow-graph-file which produces one .cfg-file per isolate when enabled. Currently it prints the final flow graph before code generation. I also added SuccessorAt and SuccessorCount to allow easy iteration over the successors of a basic block. Committed: https://code.google.com/p/dart/source/detail?r=8322

Patch Set 1 #

Total comments: 5

Patch Set 2 : #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+319 lines, -10 lines) Patch
M bin/main.cc View 1 5 chunks +22 lines, -0 lines 4 comments Download
M include/dart_api.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M vm/dart.h View 1 1 chunk +7 lines, -0 lines 4 comments Download
M vm/dart.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M vm/dart_api_impl.cc View 1 1 chunk +5 lines, -0 lines 0 comments Download
M vm/flow_graph_builder.cc View 1 1 chunk +11 lines, -3 lines 1 comment Download
M vm/il_printer.h View 1 3 chunks +22 lines, -2 lines 0 comments Download
M vm/il_printer.cc View 1 3 chunks +191 lines, -4 lines 0 comments Download
M vm/intermediate_language.h View 5 chunks +15 lines, -1 line 0 comments Download
M vm/intermediate_language.cc View 2 chunks +41 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Florian Schneider
8 years, 6 months ago (2012-06-01 08:39:27 UTC) #1
srdjan
LGTM with comments once FILE access OKd by asiva https://chromiumcodereview.appspot.com/10446116/diff/1/vm/il_printer.h File vm/il_printer.h (right): https://chromiumcodereview.appspot.com/10446116/diff/1/vm/il_printer.h#newcode65 vm/il_printer.h:65: ...
8 years, 6 months ago (2012-06-01 15:35:26 UTC) #2
siva
We don't allow access to files from within the VM this is because we link ...
8 years, 6 months ago (2012-06-01 16:51:55 UTC) #3
Florian Schneider
New patchset uploaded that uses the exisiting API for file I/O.
8 years, 6 months ago (2012-06-04 12:29:06 UTC) #4
srdjan
LGTM but wait also on Siva's LGTM please.
8 years, 6 months ago (2012-06-04 15:15:01 UTC) #5
siva
LGTM with some comments. https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc File bin/main.cc (right): https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc#newcode139 bin/main.cc:139: ASSERT(flow_graph_file != NULL); Where is ...
8 years, 6 months ago (2012-06-04 18:23:57 UTC) #6
Florian Schneider
https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc File bin/main.cc (right): https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc#newcode139 bin/main.cc:139: ASSERT(flow_graph_file != NULL); On 2012/06/04 18:23:57, asiva wrote: > ...
8 years, 6 months ago (2012-06-06 11:06:10 UTC) #7
siva
https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc File bin/main.cc (right): https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc#newcode139 bin/main.cc:139: ASSERT(flow_graph_file != NULL); I disagree, correctness not conciseness is ...
8 years, 6 months ago (2012-06-06 17:02:47 UTC) #8
Florian Schneider
8 years, 6 months ago (2012-06-07 09:32:26 UTC) #9
https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc
File bin/main.cc (right):

https://chromiumcodereview.appspot.com/10446116/diff/11001/bin/main.cc#newcod...
bin/main.cc:139: ASSERT(flow_graph_file != NULL);
On 2012/06/06 17:02:47, asiva wrote:
> I disagree, correctness not conciseness is the yardstick to use. If a file is
> opened it needs to be closed properly. You cannot rely on process exit doing
the
> right thing here.
> 
> Especially if you create these files on a per isolate basis then you should
> close them when shutting down the isolate.
> 
> 
> On 2012/06/06 11:06:10, Florian Schneider wrote:
> > On 2012/06/04 18:23:57, asiva wrote:
> > > Where is flow_graph_file closed?
> > 
> > At process exit.  I could close it explicitly right before every possible
exit
> > of main() which is currently in four different places.  Since it is only
> opened
> > when the --generate-flow-graph flag is on, I prefer not explicitly closing
it
> > for conciseness.
> 

I view this as an experimental flag.

How about abnormal exit (SIGSEGV, SIGTERM, SIGKILL, etc.) then? We rely the
OS/library to clean up in this case.

https://chromiumcodereview.appspot.com/10446116/diff/11001/vm/dart.h
File vm/dart.h (right):

https://chromiumcodereview.appspot.com/10446116/diff/11001/vm/dart.h#newcode46
vm/dart.h:46: static FileWriterFunction flow_graph_writer_;
On 2012/06/06 17:02:47, asiva wrote:
> Having one file per isolate is probably the way to go.
> I think in your current case you might think it is fine if it works only for a
> single isolate but somebody else might come in try this flag on a test which
has
> multiple isolates and without realizing that the implementation of this flag
is
> broken might spend hours trying to debug why the visualizer is not displaying
> stuff correctly.
> 
> If you intend to leave it as is, at least put a warning when this option is
used
> which states "this option is only partially implemented and does not work at
all
> when the application uses multiple isolates". 
> 
> On 2012/06/06 11:06:10, Florian Schneider wrote:
> > On 2012/06/04 18:23:57, asiva wrote:
> > > If you have this as a static function with a static file handle, how does
it
> > > work in multiple isolate situations? Is it ok if you get multiple flow
> graphs
> > > from different isolates intertwined in the same output file?
> > 
> > It does not work.  I'm fine for now with it working only for the
> single-isolate
> > case: The tests and benchmarks we're looking at do not create multiple
> isolate.
> > 
> > Alternative would be to either have one file per isolate or control file
> access
> > using a lock so that only one isolate at a time can write a flow graph.
> 

I can add a TODO. I don't think this is a typical use case. If there is a large
number of isolates though it may be very confusing to have one file per isolate.
- i.e. finding the method of interest would involve grepping the files first.

Powered by Google App Engine
This is Rietveld 408576698