[m-rev.] for review: --trace-table-io-all

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Sep 2 13:43:22 AEST 2002


This is the second diff that may affect event numbers.

Zoltan.

Make debug grades require tabling of I/O primitives.

compiler/options.m:
	Add an option, trace_table_io_all, whose semantics is that if it is
	set, then all I/O primitives will be tabled. It is meant to be set in
	debug grades. It is not meant to be used explicitly, even by
	developers, except for benchmarking and to create consistency in tests.

compiler/handle_options.m:
	Make debug grades imply trace_table_io_all.

compiler/table_gen.m:
	Implement the new option.

tests/debugger/Mercury.options:
tests/debugger/declarative/Mercury.options:
	Specify the new option, to avoid one source of differences between
	the expected outputs in debug and non-debug grades.

cvs diff: Diffing .
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
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/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.151
diff -u -b -r1.151 handle_options.m
--- compiler/handle_options.m	2002/09/01 06:04:58	1.151
+++ compiler/handle_options.m	2002/09/01 07:10:56
@@ -626,6 +626,10 @@
 		[]
 	),
 
+	% In debugging grades, we want to generate executables in which
+	% one can do retries across I/O safely.
+	option_implies(require_tracing, trace_table_io_all, bool(yes)),
+
 	% --trace-table-io-decl is an extension of --trace-table-io
 	option_implies(trace_table_io_decl, trace_table_io, bool(yes)),
 	% --trace-table-io-require is compulsory application of --trace-table-io
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.386
diff -u -b -r1.386 options.m
--- compiler/options.m	2002/09/01 06:05:00	1.386
+++ compiler/options.m	2002/09/02 03:32:30
@@ -130,6 +130,7 @@
 		;	trace_table_io_decl
 		;	trace_table_io_states
 		;	trace_table_io_require
+		;	trace_table_io_all
 		;	delay_death
 		;	suppress_trace
 		;	stack_trace_higher_order
@@ -699,6 +700,7 @@
 	trace_table_io_decl	-	bool(no),
 	trace_table_io_states	-	bool(no),
 	trace_table_io_require	-	bool(no),
+	trace_table_io_all	-	bool(no),
 	suppress_trace		-	string(""),
 	delay_death		-	bool(yes),
 	stack_trace_higher_order -	bool(no),
@@ -1265,6 +1267,7 @@
 long_option("trace-table-io-decl",	trace_table_io_decl).
 long_option("trace-table-io-states",	trace_table_io_states).
 long_option("trace-table-io-require",	trace_table_io_require).
+long_option("trace-table-io-all",	trace_table_io_all).
 long_option("suppress-trace",		suppress_trace).
 long_option("delay-death",		delay_death).
 long_option("stack-trace-higher-order",	stack_trace_higher_order).
@@ -2415,7 +2418,8 @@
 %		"\tSuppress the named aspects of the execution tracing system.",
 		"--trace-optimized",
 		"\tDo not disable optimizations that can change the trace.",
-% tabling io is not documented yet, since it is still experimental
+% tabling io is documented yet, since it is mean to be switched on only
+% automatically (in certain grades)
 %		"--trace-table-io",
 %		"\tEnable the tabling of I/O actions, to allow the debugger",
 %		"\tto execute retry commands across I/O actions.",
@@ -2430,6 +2434,11 @@
 %		"\tRequire the tabling of I/O actions, i.e. generate an error",
 %		"\tif an I/O primitive does not have the tabled_for_io",
 %		"\tannotation.",
+%		"--trace-table-io-all",
+%		"\tTable all I/O actions even in the absence of annotations.",
+%		"\tIf a primitive has no annotation specifying the type of",
+%		"\ttabling required, deduce it from the values of the other",
+%		"\tannotations.",
 		"--no-delay-death",
 		"\tWhen the trace level is `deep', the compiler normally",
 		"\tpreserves the values of variables as long as possible, even",
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.37
diff -u -b -r1.37 table_gen.m
--- compiler/table_gen.m	2002/07/26 04:18:29	1.37
+++ compiler/table_gen.m	2002/08/23 01:49:16
@@ -335,12 +335,14 @@
 %				[i(PredIdInt)]),
 %			error(Msg)
 %		),
+		globals__lookup_bool_option(Globals, trace_table_io_all,
+			TransformAll),
 		globals__lookup_bool_option(Globals, trace_table_io_require,
 			Require),
 		proc_info_goal(ProcInfo0, BodyGoal),
 		predicate_module(ModuleInfo0, PredId, PredModuleName),
-		should_io_procedure_be_transformed(Require, BodyGoal,
-			PredModuleName, AnnotationIsMissing,
+		should_io_procedure_be_transformed(TransformAll, Require,
+			BodyGoal, PredModuleName, AnnotationIsMissing,
 			TransformPrimitive),
 		(
 			AnnotationIsMissing = yes,
@@ -380,11 +382,11 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred should_io_procedure_be_transformed(bool::in, hlds_goal::in,
+:- pred should_io_procedure_be_transformed(bool::in, bool::in, hlds_goal::in,
 	sym_name::in, bool::out, maybe(table_io_is_unitize)::out) is det.
 
-should_io_procedure_be_transformed(Require, BodyGoal, PredModuleName,
-		AnnotationIsMissing, TransformInfo) :-
+should_io_procedure_be_transformed(TransformAll, Require, BodyGoal,
+		PredModuleName, AnnotationIsMissing, TransformInfo) :-
 	tabled_for_io_attributes(BodyGoal, TabledForIoAttrs),
 	( TabledForIoAttrs = [] ->
 		AnnotationIsMissing = no,
@@ -396,12 +398,29 @@
 				Require = yes,
 				\+ any_mercury_builtin_module(PredModuleName)
 			->
-				AnnotationIsMissing = yes
+				AnnotationIsMissing = yes,
+				TransformInfo = no
 			;
-				AnnotationIsMissing = no
-			),
+				AnnotationIsMissing = no,
+				(
+					TransformAll = no,
+					TransformInfo = no
+				;
+					TransformAll = yes,
+					may_call_mercury_attributes(BodyGoal,
+						MayCallMercuryAttrs),
+					(
+						MayCallMercuryAttrs =
+							[may_call_mercury]
+					->
 			TransformInfo = no
 		;
+						TransformInfo =
+							yes(table_io_alone)
+					)
+				)
+			)
+		;
 			TabledForIoAttr = tabled_for_descendant_io,
 			AnnotationIsMissing = no,
 			% The procedure itself doesn't do any I/O, so don't
@@ -420,6 +439,23 @@
 		% Since table_gen is run before inlining, each procedure
 		% should contain at most one foreign_proc goal.
 		error("should_io_procedure_be_transformed: different tabled_for_io attributes in one procedure")
+	).
+
+:- pred may_call_mercury_attributes(hlds_goal::in, list(may_call_mercury)::out)
+	is det.
+
+may_call_mercury_attributes(Goal, MayCallMercuryAttrs) :-
+	solutions(subgoal_may_call_mercury_attribute(Goal),
+		MayCallMercuryAttrs).
+
+:- pred subgoal_may_call_mercury_attribute(hlds_goal::in,
+	may_call_mercury::out) is nondet.
+
+subgoal_may_call_mercury_attribute(Goal, MayCallMercuryAttr) :-
+	some [SubGoal,Attrs] (
+		goal_contains_goal(Goal, SubGoal),
+		SubGoal = foreign_proc(Attrs, _,_,_,_,_,_) - _,
+		may_call_mercury(Attrs, MayCallMercuryAttr)
 	).
 
 :- pred tabled_for_io_attributes(hlds_goal::in, list(tabled_for_io)::out)
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
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/graphics
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/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/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
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/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 java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
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 tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mercury.options,v
retrieving revision 1.1
diff -u -b -r1.1 Mercury.options
--- tests/debugger/Mercury.options	2002/08/17 13:52:00	1.1
+++ tests/debugger/Mercury.options	2002/08/23 02:04:27
@@ -5,9 +5,9 @@
 
 MCFLAGS-queens_rep = --trace rep
 MCFLAGS-shallow = --trace shallow
-MCFLAGS-tabled_read = --trace-table-io
-MCFLAGS-tabled_read_unitize = --trace-table-io
-MCFLAGS-tabled_read_decl = --trace-table-io-decl
+MCFLAGS-tabled_read = --trace-table-io --trace-table-io-all
+MCFLAGS-tabled_read_unitize = --trace-table-io --trace-table-io-all
+MCFLAGS-tabled_read_decl = --trace-table-io-decl --trace-table-io-all
 # By default, we reclaim heap on failure in non-Boehm-gc grades.
 # The extra stack slots required for this reclamation cause spurious
 # differences from the expected output on the nondet_stack test case.
cvs diff: Diffing tests/debugger/declarative
Index: tests/debugger/declarative/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mercury.options,v
retrieving revision 1.2
diff -u -b -r1.2 Mercury.options
--- tests/debugger/declarative/Mercury.options	2002/08/29 16:15:53	1.2
+++ tests/debugger/declarative/Mercury.options	2002/08/30 01:27:38
@@ -6,5 +6,5 @@
 MCFLAGS-output_term_dep=--trace rep
 MCFLAGS-shallow_2=--trace shallow
 MCFLAGS-special_term_dep=--trace rep
-MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-decl
+MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-decl --trace-table-io-all
 MCFLAGS-untraced_subgoal_sub=--trace minimum
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
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/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