[m-rev.] diff: fix -S

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Oct 25 16:30:47 AEST 2005


Fix an old bug: when invoking the compiler with -vS, many of the statistics
printed didn't say what they are for, because the relevant messages were
enabled only with -V.

compiler/options.m:
	Add a new option, detailed_statistics. This option is not visible
	to users.

compiler/handle_options.m:
	Set detailed_statistics only if -v and -S are both set.

compiler/mercury_compile.m:
compiler/modes.m:
compiler/modules.m:
compiler/optimize.m:
compiler/typecheck_errors.m:
	In a bunch of places where progress messages are enabled only with -V
	and not with -v, consult detailed_statistics instead of statistics
	to decide whether to print statistics, in order to make sure you
	get only interpretable statistics.

compiler/make_hlds_passes.m:
	Print messages before two statistics reports, because otherwise the
	statistics are not interpretable. Don't print stats for module
	optimization, since it is now a no-op.

compiler/cse_detection.m:
	Print statistics if detailed_statistics is set. This is useful because
	in some cases, cse_detection can be expensive (it reruns mode
	analysis).

compiler/simplify.m:
	Print statistics if detailed_statistics is set. This is useful because
	in some cases, simplify can be expensive.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.143
diff -u -b -r1.143 code_gen.m
--- compiler/code_gen.m	24 Oct 2005 04:13:56 -0000	1.143
+++ compiler/code_gen.m	24 Oct 2005 04:30:30 -0000
@@ -176,7 +176,8 @@
             io__write_string("% Generating code for ", !IO),
             hlds_out__write_pred_id(ModuleInfo, PredId, !IO),
             io__write_string("\n", !IO),
-            globals__lookup_bool_option(Globals, statistics, Statistics),
+            globals__lookup_bool_option(Globals, detailed_statistics,
+                Statistics),
             maybe_report_stats(Statistics, !IO)
         ;
             VeryVerbose = no
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.88
diff -u -b -r1.88 cse_detection.m
--- compiler/cse_detection.m	24 Oct 2005 04:13:58 -0000	1.88
+++ compiler/cse_detection.m	24 Oct 2005 04:30:31 -0000
@@ -52,6 +52,7 @@
 :- import_module libs__options.
 :- import_module parse_tree__error_util.
 :- import_module parse_tree__prog_data.
+:- import_module parse_tree__prog_out.
 :- import_module parse_tree__prog_type.
 
 :- import_module assoc_list.
@@ -103,6 +104,8 @@
 
 detect_cse_in_proc(ProcId, PredId, !ModuleInfo, !IO) :-
     detect_cse_in_proc_2(ProcId, PredId, Redo, !ModuleInfo),
+    globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
+    maybe_report_stats(Statistics, !IO),
     (
         Redo = no
     ;
@@ -117,6 +120,7 @@
             VeryVerbose = no
         ),
         modecheck_proc(ProcId, PredId, !ModuleInfo, Errs, _Changed, !IO),
+        maybe_report_stats(Statistics, !IO),
         ( Errs > 0 ->
             unexpected(this_file, "mode check fails when repeated")
         ;
@@ -131,6 +135,7 @@
             VeryVerbose = no
         ),
         detect_switches_in_proc(ProcId, PredId, !ModuleInfo),
+        maybe_report_stats(Statistics, !IO),
         (
             VeryVerbose = yes,
             io__write_string("% Repeating common " ++
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.239
diff -u -b -r1.239 handle_options.m
--- compiler/handle_options.m	24 Oct 2005 04:14:02 -0000	1.239
+++ compiler/handle_options.m	24 Oct 2005 04:30:32 -0000
@@ -780,6 +780,16 @@
 
         option_implies(very_verbose, verbose, bool(yes), !Globals),
         option_implies(verbose, verbose_commands, bool(yes), !Globals),
+        globals__lookup_bool_option(!.Globals, very_verbose, VeryVerbose),
+        globals__lookup_bool_option(!.Globals, statistics, Statistics),
+        (
+            VeryVerbose = yes,
+            Statistics = yes
+        ->
+            globals__set_option(detailed_statistics, bool(yes), !Globals)
+        ;
+            true
+        ),
 
         option_implies(debug_modes_minimal, debug_modes, bool(yes), !Globals),
         option_implies(debug_modes_verbose, debug_modes, bool(yes), !Globals),
@@ -1298,7 +1308,6 @@
 
         % --dump-hlds and --statistics require compilation by phases
         globals__lookup_accumulating_option(!.Globals, dump_hlds, DumpStages),
-        globals__lookup_bool_option(!.Globals, statistics, Statistics),
         (
             ( DumpStages = [_ | _]
             ; Statistics = yes
Index: compiler/make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.17
diff -u -b -r1.17 make_hlds_passes.m
--- compiler/make_hlds_passes.m	24 Oct 2005 04:14:11 -0000	1.17
+++ compiler/make_hlds_passes.m	25 Oct 2005 04:18:24 -0000
@@ -144,6 +144,8 @@
                 item_status(local, may_be_unqualified), !Module,
                 no, InvalidModes0, !IO),
         globals__io_lookup_bool_option(statistics, Statistics, !IO),
+        maybe_write_string(Statistics, "% Processed all items in pass 1\n",
+            !IO),
         maybe_report_stats(Statistics, !IO),
 
         check_for_errors(
@@ -186,9 +188,10 @@
             true
         ),
 
-        maybe_report_stats(Statistics, !IO),
             % Balance any data structures that need it.
         module_info_optimize(!Module),
+        maybe_write_string(Statistics, "% Processed all items in pass 2\n",
+            !IO),
         maybe_report_stats(Statistics, !IO),
         init_qual_info(MQInfo0, EqvMap, QualInfo0),
         add_item_list_clauses(Items, local, !Module, QualInfo0, QualInfo, !IO),
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.355
diff -u -b -r1.355 mercury_compile.m
--- compiler/mercury_compile.m	24 Oct 2005 04:14:11 -0000	1.355
+++ compiler/mercury_compile.m	25 Oct 2005 05:46:10 -0000
@@ -964,7 +964,7 @@
             true
         )
     ),
-    globals__io_lookup_bool_option(statistics, Stats, !IO),
+    globals__io_lookup_bool_option(detailed_statistics, Stats, !IO),
     maybe_report_stats(Stats, !IO),
     string__append(FileName, ".m", SourceFileName).
 
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.317
diff -u -b -r1.317 modes.m
--- compiler/modes.m	24 Oct 2005 04:14:18 -0000	1.317
+++ compiler/modes.m	24 Oct 2005 04:30:36 -0000
@@ -615,14 +615,8 @@
             module_info_remove_predid(PredId, !ModuleInfo)
         ),
         !:NumErrors = !.NumErrors + ErrsInThisPred,
-        globals__io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
-        globals__io_lookup_bool_option(statistics, Statistics, !IO),
-        (
-            VeryVerbose = yes,
+        globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
             maybe_report_stats(Statistics, !IO)
-        ;
-            VeryVerbose = no
-        )
     ).
 
 :- pred write_modes_progress_message(pred_id::in, pred_info::in,
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.351
diff -u -b -r1.351 modules.m
--- compiler/modules.m	24 Oct 2005 04:14:19 -0000	1.351
+++ compiler/modules.m	25 Oct 2005 05:54:23 -0000
@@ -6437,7 +6437,7 @@
             PrivateIntItems, Items),
         maybe_add_int_error(PrivateIntError, ModError0, ModError),
 
-        globals__io_lookup_bool_option(statistics, Statistics, !IO),
+        globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
         maybe_report_stats(Statistics, !IO),
 
         ( PrivateIntError = fatal_module_errors ->
@@ -6449,9 +6449,9 @@
         !:DirectImports = !.DirectImports ++ AncDirectImports,
         !:DirectUses = !.DirectUses ++ AncDirectUses,
         ModItems = ModItems0 ++ Items,
-        !:Module = ((!.Module ^ items := ModItems)
-            ^ parent_deps := ModAncestors)
-            ^ error := ModError,
+        !:Module = !.Module ^ items := ModItems,
+        !:Module = !.Module ^ parent_deps := ModAncestors,
+        !:Module = !.Module ^ error := ModError,
         process_module_private_interfaces(ReadModules, Ancestors,
             IntStatusItem, ImpStatusItem,
             !DirectImports, !DirectUses, !Module, !IO)
@@ -6493,7 +6493,7 @@
             LongIntItems, Items),
         maybe_add_int_error(LongIntError, ModError0, ModError),
 
-        globals__io_lookup_bool_option(statistics, Statistics, !IO),
+        globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
         maybe_report_stats(Statistics, !IO),
 
         ( LongIntError = fatal_module_errors ->
@@ -6508,9 +6508,9 @@
         !:ImplIndirectImports = !.ImplIndirectImports
             ++ ImplIndirectImports1 ++ ImplIndirectUses1,
         list__append(ModItems0, Items, ModItems),
-        !:Module = ((!.Module ^ impl_deps := ModImplementationImports)
-            ^ items := ModItems)
-            ^ error := ModError,
+        !:Module = !.Module ^ impl_deps := ModImplementationImports,
+        !:Module = !.Module ^ items := ModItems,
+        !:Module = !.Module ^ error := ModError,
 
         process_module_long_interfaces(ReadModules, NeedQualifier,
             Imports, Ext, IntStatusItem, ImpStatusItem,
@@ -6696,16 +6696,16 @@
             ShortIntItems, Items),
         maybe_add_int_error(ShortIntError, ModError0, ModError),
 
-        globals__io_lookup_bool_option(statistics, Statistics, !IO),
+        globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
         maybe_report_stats(Statistics, !IO),
 
         ModIndirectImports = [Import | ModIndirectImports0],
         !:IndirectImports = !.IndirectImports ++ IntImports1 ++ IntUses1,
         !:ImpIndirectImports = !.ImpIndirectImports ++ ImpImports1 ++ ImpUses1,
         ModItems = ModItems0 ++ Items,
-        !:Module = ((!.Module ^ indirect_deps := ModIndirectImports)
-            ^ items := ModItems)
-            ^ error := ModError,
+        !:Module = !.Module ^ indirect_deps := ModIndirectImports,
+        !:Module = !.Module ^ items := ModItems,
+        !:Module = !.Module ^ error := ModError,
         process_module_short_interfaces(ReadModules, Imports, Ext,
             IntStatusItem, ImpStatusItem, !IndirectImports,
             !ImpIndirectImports, !Module, !IO)
Index: compiler/optimize.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/optimize.m,v
retrieving revision 1.49
diff -u -b -r1.49 optimize.m
--- compiler/optimize.m	14 Sep 2005 01:29:10 -0000	1.49
+++ compiler/optimize.m	17 Oct 2005 10:00:44 -0000
@@ -377,7 +377,7 @@
     ;
         Mod = yes
     ),
-    globals__io_lookup_bool_option(statistics, Statistics, !IO),
+    globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
     maybe_report_stats(Statistics, !IO).
 
 :- pred optimize__middle(bool::in, set(label)::in, proc_label::in,
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.470
diff -u -b -r1.470 options.m
--- compiler/options.m	17 Oct 2005 07:43:24 -0000	1.470
+++ compiler/options.m	17 Oct 2005 09:52:45 -0000
@@ -117,6 +117,7 @@
     ;       verbose_commands
     ;       output_compile_error_lines
     ;       statistics
+    ;       detailed_statistics
     ;       debug_types
     ;       debug_modes
     ;       debug_modes_statistics
@@ -847,6 +848,7 @@
     verbose_commands                    -   bool(no),
     output_compile_error_lines          -   int(15),
     statistics                          -   bool(no),
+    detailed_statistics                 -   bool(no),
     debug_types                         -   bool(no),
     debug_modes                         -   bool(no),
     debug_modes_statistics              -   bool(no),
@@ -1534,6 +1536,7 @@
 long_option("verbose-commands",     verbose_commands).
 long_option("output-compile-error-lines", output_compile_error_lines).
 long_option("statistics",           statistics).
+long_option("detailed-statistics",  detailed_statistics).
 long_option("debug-types",          debug_types).
 long_option("debug-modes",          debug_modes).
 long_option("debug-modes-statistics",   debug_modes_statistics).
@@ -2835,6 +2838,11 @@
         "\tOutput messages about the compiler's time/space usage.",
         "\tAt the moment this option implies `--no-trad-passes', so you get",
         "\tinformation at the boundaries between phases of the compiler.",
+% The only sensible way to use --detailed-statistics, based on --very-verbose,
+% is implemented automatically in handle_options, so users shouldn't need to be
+% aware of it.
+%       "--detailed-statistics",
+%       "\tOutput more detailed messages about the compiler's time/space usage.",
         "-T, --debug-types",
         "\tOutput detailed debugging traces of the type checking.",
         "-N, --debug-modes",
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.157
diff -u -b -r1.157 simplify.m
--- compiler/simplify.m	24 Oct 2005 04:14:28 -0000	1.157
+++ compiler/simplify.m	24 Oct 2005 04:30:39 -0000
@@ -88,8 +88,8 @@
 
 :- import_module check_hlds__det_analysis.
 :- import_module check_hlds__inst_match.
-:- import_module check_hlds__mode_util.
 :- import_module check_hlds__modes.
+:- import_module check_hlds__mode_util.
 :- import_module check_hlds__polymorphism.
 :- import_module check_hlds__purity.
 :- import_module check_hlds__type_util.
@@ -107,8 +107,9 @@
 :- import_module parse_tree__error_util.
 :- import_module parse_tree__prog_data.
 :- import_module parse_tree__prog_mode.
-:- import_module parse_tree__prog_util.
+:- import_module parse_tree__prog_out.
 :- import_module parse_tree__prog_type.
+:- import_module parse_tree__prog_util.
 :- import_module transform_hlds__const_prop.
 :- import_module transform_hlds__pd_cost.
 
@@ -148,7 +149,9 @@
         MaybeMsgs = no,
         WarnCnt = 0,
         ErrCnt = 0
-    ).
+    ),
+    globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
+    maybe_report_stats(Statistics, !IO).
 
 :- pred simplify_procs(list(simplification)::in, pred_id::in,
     list(proc_id)::in, module_info::in, module_info::out,
Index: compiler/typecheck_errors.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck_errors.m,v
retrieving revision 1.8
diff -u -b -r1.8 typecheck_errors.m
--- compiler/typecheck_errors.m	24 Oct 2005 04:14:32 -0000	1.8
+++ compiler/typecheck_errors.m	24 Oct 2005 04:30:40 -0000
@@ -1830,7 +1830,7 @@
 	io__write_string("At ", !IO),
 	io__write_string(Msg, !IO),
 	io__write_string(": ", !IO),
-	globals__io_lookup_bool_option(statistics, Statistics, !IO),
+	globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
 	maybe_report_stats(Statistics, !IO),
 	io__write_string("\n", !IO),
 	typecheck_info_get_type_assign_set(T0, TypeAssignSet),
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list