[m-rev.] diff: support more grade tests in trace goals
Zoltan Somogyi
zs at csse.unimelb.edu.au
Wed Aug 4 12:43:24 AEST 2010
Support more tests on the grade of compilation in the compile_time conditions
for trace goals. The immediate intented use of this capability is to allow
the disabling of progress messages in parallel grades, since in such grades
the whole notion of `progress' is quite different, and the usual sorts of
progress messages are much less useful.
doc/reference_manual.texi:
Document the new tests.
compiler/prog_data.m:
Update the data type representing these tests to include the new tests.
Add a predicate to convert from the name to the internal representation
and vice versa.
compiler/prog_io_goal.m:
compiler/mercury_to_mercury.m:
Handle the reading in and writing out of the new tests.
compiler/simplify.m:
Implement the new tests.
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/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.340
diff -u -b -r1.340 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m 5 Nov 2009 06:34:39 -0000 1.340
+++ compiler/mercury_to_mercury.m 3 Aug 2010 02:51:45 -0000
@@ -3252,11 +3252,9 @@
io.write_string(FlagName, !IO),
io.write_string(")", !IO).
mercury_output_trace_compiletime(trace_grade(Grade), !IO) :-
+ parse_trace_grade_name(GradeName, Grade),
io.write_string("grade(", !IO),
- (
- Grade = trace_grade_debug,
- io.write_string("debug", !IO)
- ),
+ io.write_string(GradeName, !IO),
io.write_string(")", !IO).
mercury_output_trace_compiletime(trace_trace_level(Level), !IO) :-
io.write_string("tracelevel(", !IO),
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.221
diff -u -b -r1.221 prog_data.m
--- compiler/prog_data.m 4 Nov 2009 03:44:50 -0000 1.221
+++ compiler/prog_data.m 4 Aug 2010 02:27:45 -0000
@@ -1351,7 +1351,19 @@
; trace_trace_level(trace_trace_level).
:- type trace_grade
- ---> trace_grade_debug.
+ ---> trace_grade_debug
+ ; trace_grade_ssdebug
+ ; trace_grade_prof
+ ; trace_grade_profdeep
+ ; trace_grade_par
+ ; trace_grade_trail
+ ; trace_grade_rbmm
+ ; trace_grade_llds
+ ; trace_grade_mlds
+ ; trace_grade_c
+ ; trace_grade_il
+ ; trace_grade_java
+ ; trace_grade_erlang.
:- type trace_trace_level
---> trace_level_shallow
@@ -1386,6 +1398,34 @@
%
:- type prog_context == term.context.
+:- pred parse_trace_grade_name(string, trace_grade).
+:- mode parse_trace_grade_name(in, out) is semidet.
+:- mode parse_trace_grade_name(out, in) is det.
+:- mode parse_trace_grade_name(out, out) is multi.
+
+:- pred valid_trace_grade_name(string::out) is multi.
+
+:- implementation.
+
+% If you update this, you also need to update the corresponding section
+% of doc/reference_manual.texi.
+parse_trace_grade_name("debug", trace_grade_debug).
+parse_trace_grade_name("ssdebug", trace_grade_ssdebug).
+parse_trace_grade_name("prof", trace_grade_prof).
+parse_trace_grade_name("profdeep", trace_grade_profdeep).
+parse_trace_grade_name("par", trace_grade_par).
+parse_trace_grade_name("trail", trace_grade_trail).
+parse_trace_grade_name("rbmm", trace_grade_rbmm).
+parse_trace_grade_name("llds", trace_grade_llds).
+parse_trace_grade_name("mlds", trace_grade_mlds).
+parse_trace_grade_name("c", trace_grade_c).
+parse_trace_grade_name("il", trace_grade_il).
+parse_trace_grade_name("java", trace_grade_java).
+parse_trace_grade_name("erlang", trace_grade_erlang).
+
+valid_trace_grade_name(GradeName) :-
+ parse_trace_grade_name(GradeName, _).
+
%-----------------------------------------------------------------------------%
%
% Renaming
Index: compiler/prog_io_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_goal.m,v
retrieving revision 1.61
diff -u -b -r1.61 prog_io_goal.m
--- compiler/prog_io_goal.m 8 Sep 2009 02:43:36 -0000 1.61
+++ compiler/prog_io_goal.m 4 Aug 2010 02:37:07 -0000
@@ -102,6 +102,7 @@
:- import_module char.
:- import_module maybe.
:- import_module pair.
+:- import_module solutions.
:- import_module string.
:- import_module term.
:- import_module varset.
@@ -972,15 +973,16 @@
( SubTerms = [SubTerm] ->
(
SubTerm = term.functor(term.atom(GradeName), [], _),
- GradeName = "debug"
+ parse_trace_grade_name(GradeName, TraceGrade)
->
- Compiletime = trace_grade(trace_grade_debug),
+ Compiletime = trace_grade(TraceGrade),
MaybeCompiletime = ok1(Compiletime)
;
- Pieces = [words("compile_time parameter"),
- quote("grade"), words("takes just"),
- quote("debug"), words("as argument (for now)."),
- nl],
+ solutions(valid_trace_grade_name, ValidGradeNames),
+ Pieces = [words("invalid grade test;"),
+ words("valid grade tests are")] ++
+ list_to_pieces(ValidGradeNames) ++
+ [suffix("."), nl],
Spec = error_spec(severity_error,
phase_term_to_parse_tree,
[simple_msg(TermContext, [always(Pieces)])]),
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.249
diff -u -b -r1.249 simplify.m
--- compiler/simplify.m 30 Jul 2010 05:16:15 -0000 1.249
+++ compiler/simplify.m 3 Aug 2010 02:47:04 -0000
@@ -2119,9 +2119,72 @@
)
;
Base = trace_grade(Grade),
+ (
Grade = trace_grade_debug,
globals.lookup_bool_option(Globals, exec_trace, Result)
;
+ Grade = trace_grade_ssdebug,
+ globals.lookup_bool_option(Globals, source_to_source_debug, Result)
+ % XXX Should we take into account force_disable_ssdebug as well?
+ ;
+ Grade = trace_grade_prof,
+ globals.lookup_bool_option(Globals, profile_calls, ProfCalls),
+ globals.lookup_bool_option(Globals, profile_time, ProfTime),
+ globals.lookup_bool_option(Globals, profile_memory, ProfMem),
+ bool.or_list([ProfCalls, ProfTime, ProfMem], Result)
+ ;
+ Grade = trace_grade_profdeep,
+ globals.lookup_bool_option(Globals, profile_deep, Result)
+ ;
+ Grade = trace_grade_par,
+ globals.lookup_bool_option(Globals, parallel, Result)
+ ;
+ Grade = trace_grade_trail,
+ globals.lookup_bool_option(Globals, use_trail, Result)
+ ;
+ Grade = trace_grade_rbmm,
+ globals.lookup_bool_option(Globals, use_regions, Result)
+ ;
+ Grade = trace_grade_llds,
+ globals.lookup_bool_option(Globals, highlevel_code, NotResult),
+ bool.not(NotResult, Result)
+ ;
+ Grade = trace_grade_mlds,
+ globals.lookup_bool_option(Globals, highlevel_code, Result)
+ ;
+ Grade = trace_grade_c,
+ globals.get_target(Globals, Target),
+ ( Target = target_c ->
+ Result = yes
+ ;
+ Result = no
+ )
+ ;
+ Grade = trace_grade_il,
+ globals.get_target(Globals, Target),
+ ( Target = target_il ->
+ Result = yes
+ ;
+ Result = no
+ )
+ ;
+ Grade = trace_grade_java,
+ globals.get_target(Globals, Target),
+ ( Target = target_java ->
+ Result = yes
+ ;
+ Result = no
+ )
+ ;
+ Grade = trace_grade_erlang,
+ globals.get_target(Globals, Target),
+ ( Target = target_erlang ->
+ Result = yes
+ ;
+ Result = no
+ )
+ )
+ ;
Base = trace_trace_level(Level),
globals.get_trace_level(Globals, TraceLevel),
simplify_info_get_pred_proc_info(Info, PredInfo, ProcInfo),
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.446
diff -u -b -r1.446 reference_manual.texi
--- doc/reference_manual.texi 14 Jul 2010 15:47:58 -0000 1.446
+++ doc/reference_manual.texi 4 Aug 2010 02:26:52 -0000
@@ -9643,13 +9643,41 @@
where @var{FlagName} is an arbitrary name picked by the programmer;
this condition is true
if the module is compiled with the option @samp{--trace-flag=@var{FlagName}}.
-The second has the form @samp{grade(debug)};
-this condition is true
-if the module is compiled in a debugging grade.
-(We may support the specification of other kinds of grades in the future.)
-The third has the form @samp{tracelevel(shallow)}, or @samp{tracelevel(deep)};
+The second has the form @samp{tracelevel(shallow)}, or @samp{tracelevel(deep)};
this condition is true (irrespective of grade)
if the module is compiled with at least the specified trace level.
+The third has the form @samp{grade(GradeTest)}.
+The supported @samp{GradeTests}s and their meanings are as follows.
+
+ at table @asis
+ at item @samp{debug}
+True if the module is compiled with execution tracing enabled.
+ at item @samp{ssdebug}
+True if the module is compiled with source-to-source debugging enabled.
+ at item @samp{prof}
+True if the module is compiled with non-deep profiling enabled.
+ at item @samp{profdeep}
+True if the module is compiled with deep profiling enabled.
+ at item @samp{par}
+True if the module is compiled with parallel execution enabled.
+ at item @samp{trail}
+True if the module is compiled with trailing enabled.
+ at item @samp{rbmm}
+True if the module is compiled with region based memory management enabled.
+ at item @samp{llds}
+True if the module is compiled with --highlevel-code disabled.
+ at item @samp{mlds}
+True if the module is compiled with --highlevel-code enabled.
+ at item @samp{c}
+True if the target language of the compilation is C.
+ at item @samp{il}
+True if the target language of the compilation is MS IL.
+ at item @samp{java}
+True if the target language of the compilation is Java.
+ at item @samp{erlang}
+True if the target language of the compilation is Erlang.
+ at end table
+ at c (We may support the specification of other kinds of grades in the future.)
The @samp{run_time} parameter says under what circumstances the trace goal,
if included in the executable program, should actually be executed.
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
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/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
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/log4m
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/mopenssl
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/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
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/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
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/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
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 ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
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/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
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 messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list