[m-dev.] for review: --suppress-trace

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Sep 29 19:44:24 AEDT 2000


Sorry, here is the diff.

Implement a general mechanism for suppressing selected aspects of execution
tracing.

compiler/trace_params.m:
	This new file contains two abstract data types that define the
	parameters of the execution tracing system, and the operations
	on them.

	The two ADTs are the trace level (moved from globals.m) and a new one,
	trace_suppress_items, which replaces --no-trace-internal,
	--no-trace-redo and --no-trace-return, and provides additional
	capabilities requested by Erwan.

	Basically any given port can now be suppressed, with the exception of
	call (because the call event's layout structure is needed for
	implementing redo from any other event) and excp (because they are
	created on the fly by exception.m, and are not put into object
	code in the first place).

compiler/globals.m:
	Delete the stuff now migrated to trace_params.m. Make
	trace_suppress_items part of the globals structure.

compiler/code_gen.m:
compiler/trace.m:
	Allow the suppression of individual ports.

compiler/stack_layout.m:
	Allow the suppression of parts of layout structures.

compiler/*.m:
	Minor changes, mainly importing trace_params, to conform to the main
	modifications.

compiler/options.m:
	Delete --no-trace-internal, --no-trace-redo and --no-trace-return.
	Add --suppress-trace, but do not document it, since it is really
	intended only for implementors.

doc/user_guide.texi:
	Delete the documentation of --no-trace-internal, --no-trace-redo and
	--no-trace-return. Do not document it --suppress-trace, since it is
	really intended only for implementors. (The only reason why other three
	were documented is that most consumers of the users' guide then *were*
	implementors.)

Zoltan.

cvs diff: Diffing .
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/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.84
diff -u -r1.84 code_gen.m
--- compiler/code_gen.m	2000/09/27 05:21:56	1.84
+++ compiler/code_gen.m	2000/09/27 10:07:26
@@ -399,8 +399,15 @@
 		code_info__get_maybe_trace_info(MaybeTraceInfo),
 		( { MaybeTraceInfo = yes(TraceInfo) } ->
 			trace__generate_external_event_code(call, TraceInfo,
-				BodyContext, TraceCallLabel, _TypeInfos,
-				TraceCallCode),
+				BodyContext, MaybeCallExternalInfo),
+			{
+				MaybeCallExternalInfo = yes(CallExternalInfo),
+				CallExternalInfo = external_event_info(
+					TraceCallLabel, _, TraceCallCode)
+			;
+				MaybeCallExternalInfo = no,
+				error("generate_category_code: call events suppressed")
+			},
 			{ MaybeTraceCallLabel = yes(TraceCallLabel) }
 		;
 			{ TraceCallCode = empty },
@@ -432,8 +439,15 @@
 	code_info__get_maybe_trace_info(MaybeTraceInfo),
 	( { MaybeTraceInfo = yes(TraceInfo) } ->
 		trace__generate_external_event_code(call, TraceInfo,
-			BodyContext, TraceCallLabel, _TypeInfos,
-			TraceCallCode),
+			BodyContext, MaybeCallExternalInfo),
+		{
+			MaybeCallExternalInfo = yes(CallExternalInfo),
+			CallExternalInfo = external_event_info(
+				TraceCallLabel, _, TraceCallCode)
+		;
+			MaybeCallExternalInfo = no,
+			error("generate_category_code: call events suppressed")
+		},
 		{ MaybeTraceCallLabel = yes(TraceCallLabel) },
 		code_gen__generate_goal(model_semi, Goal, BodyCode),
 		code_gen__generate_entry(model_semi, Goal, ResumePoint,
@@ -448,7 +462,15 @@
 			% XXX A context that gives the end of the procedure
 			% definition would be better than BodyContext.
 		trace__generate_external_event_code(fail, TraceInfo,
-			BodyContext, _, _, TraceFailCode),
+			BodyContext, MaybeFailExternalInfo),
+		{
+			MaybeFailExternalInfo = yes(FailExternalInfo),
+			FailExternalInfo = external_event_info(
+				_, _, TraceFailCode)
+		;
+			MaybeFailExternalInfo = no,
+			TraceFailCode = empty
+		},
 		{ Code =
 			tree(EntryCode,
 			tree(TraceCallCode,
@@ -484,8 +506,15 @@
 	{ goal_info_get_context(GoalInfo, BodyContext) },
 	( { MaybeTraceInfo = yes(TraceInfo) } ->
 		trace__generate_external_event_code(call, TraceInfo,
-			BodyContext, TraceCallLabel, _TypeInfos,
-			TraceCallCode),
+			BodyContext, MaybeCallExternalInfo),
+		{
+			MaybeCallExternalInfo = yes(CallExternalInfo),
+			CallExternalInfo = external_event_info(
+				TraceCallLabel, _, TraceCallCode)
+		;
+			MaybeCallExternalInfo = no,
+			error("generate_category_code: call events suppressed")
+		},
 		{ MaybeTraceCallLabel = yes(TraceCallLabel) },
 		code_gen__generate_goal(model_non, Goal, BodyCode),
 		code_gen__generate_entry(model_non, Goal, ResumePoint,
@@ -500,7 +529,15 @@
 			% XXX A context that gives the end of the procedure
 			% definition would be better than BodyContext.
 		trace__generate_external_event_code(fail, TraceInfo,
-			BodyContext, _, _, TraceFailCode),
+			BodyContext, MaybeFailExternalInfo),
+		{
+			MaybeFailExternalInfo = yes(FailExternalInfo),
+			FailExternalInfo = external_event_info(
+				_, _, TraceFailCode)
+		;
+			MaybeFailExternalInfo = no,
+			TraceFailCode = empty
+		},
 		{ TraceSlotInfo = trace_slot_info(_, _, yes(_)) ->
 			DiscardTraceTicketCode = node([
 				discard_ticket - "discard retry ticket"
@@ -787,7 +824,16 @@
 				% procedure definition would be better than
 				% CallContext.
 			trace__generate_external_event_code(exit, TraceInfo,
-				BodyContext, _, TypeInfoDatas, TraceExitCode),
+				BodyContext, MaybeExitExternalInfo),
+			{
+				MaybeExitExternalInfo = yes(ExitExternalInfo),
+				ExitExternalInfo = external_event_info(
+					_, TypeInfoDatas, TraceExitCode)
+			;
+				MaybeExitExternalInfo = no,
+				TypeInfoDatas = map__init,
+				TraceExitCode = empty
+			},
 			{ map__values(TypeInfoDatas, TypeInfoLocnSets) },
 			{ FindBaseLvals = lambda([Lval::out] is nondet, (
 				list__member(LocnSet, TypeInfoLocnSets),
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.255
diff -u -r1.255 code_info.m
--- compiler/code_info.m	2000/09/27 05:21:57	1.255
+++ compiler/code_info.m	2000/09/27 11:36:52
@@ -37,7 +37,8 @@
 :- implementation.
 
 :- import_module code_util, code_exprn, var_locn, llds_out, prog_out.
-:- import_module exprn_aux, arg_info, type_util, mode_util, options.
+:- import_module exprn_aux, arg_info, type_util, mode_util.
+:- import_module trace_params, options.
 
 :- import_module term, varset.
 :- import_module set, stack.
Index: compiler/globals.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.36
diff -u -r1.36 globals.m
--- compiler/globals.m	2000/09/27 05:22:02	1.36
+++ compiler/globals.m	2000/09/27 08:08:12
@@ -16,7 +16,7 @@
 %-----------------------------------------------------------------------------%
 
 :- interface.
-:- import_module options.
+:- import_module options, trace_params.
 :- import_module bool, getopt, list.
 
 :- type globals.
@@ -49,26 +49,11 @@
 	;	num_data_elems
 	;	size_data_elems.
 
-:- type trace_level.
-
 :- pred convert_target(string::in, compilation_target::out) is semidet.
 :- pred convert_gc_method(string::in, gc_method::out) is semidet.
 :- pred convert_tags_method(string::in, tags_method::out) is semidet.
 :- pred convert_prolog_dialect(string::in, prolog_dialect::out) is semidet.
 :- pred convert_termination_norm(string::in, termination_norm::out) is semidet.
-:- pred convert_trace_level(string::in, bool::in, trace_level::out) is semidet.
-	% the bool should be the setting of the `require_tracing' option.
-
-	% These functions check for various properties of the trace level.
-:- func trace_level_is_none(trace_level) = bool.
-:- func trace_level_needs_fixed_slots(trace_level) = bool.
-:- func trace_level_needs_from_full_slot(trace_level) = bool.
-:- func trace_level_needs_decl_debug_slots(trace_level) = bool.
-:- func trace_level_needs_interface_events(trace_level) = bool.
-:- func trace_level_needs_internal_events(trace_level) = bool.
-:- func trace_level_needs_neg_context_events(trace_level) = bool.
-:- func trace_level_needs_all_var_names(trace_level) = bool.
-:- func trace_level_needs_proc_body_reps(trace_level) = bool.
 
 %-----------------------------------------------------------------------------%
 
@@ -76,7 +61,7 @@
 
 :- pred globals__init(option_table::di, compilation_target::di, gc_method::di,
 	tags_method::di, prolog_dialect::di, termination_norm::di,
-	trace_level::di, globals::uo) is det.
+	trace_level::di, trace_suppress_items::di, globals::uo) is det.
 
 :- pred globals__get_options(globals::in, option_table::out) is det.
 :- pred globals__get_target(globals::in, compilation_target::out) is det.
@@ -86,6 +71,8 @@
 :- pred globals__get_termination_norm(globals::in, termination_norm::out) 
 	is det.
 :- pred globals__get_trace_level(globals::in, trace_level::out) is det.
+:- pred globals__get_trace_suppress(globals::in, trace_suppress_items::out)
+	is det.
 
 :- pred globals__set_options(globals::in, option_table::in, globals::out)
 	is det.
@@ -127,7 +114,7 @@
 
 :- pred globals__io_init(option_table::di, compilation_target::in,
 	gc_method::in, tags_method::in, prolog_dialect::in,
-	termination_norm::in, trace_level::in,
+	termination_norm::in, trace_level::in, trace_suppress_items::in,
 	io__state::di, io__state::uo) is det.
 
 :- pred globals__io_get_target(compilation_target::out,
@@ -148,6 +135,9 @@
 :- pred globals__io_get_trace_level(trace_level::out,
 	io__state::di, io__state::uo) is det.
 
+:- pred globals__io_get_trace_suppress(trace_suppress_items::out,
+	io__state::di, io__state::uo) is det.
+
 :- pred globals__io_get_globals(globals::out, io__state::di, io__state::uo)
 	is det.
 
@@ -224,76 +214,6 @@
 convert_termination_norm("num-data-elems", num_data_elems).
 convert_termination_norm("size-data-elems", size_data_elems).
 
-convert_trace_level("minimum", no, none).
-convert_trace_level("minimum", yes, shallow).
-convert_trace_level("shallow", _, shallow).
-convert_trace_level("deep", _, deep).
-convert_trace_level("decl", _, decl).
-convert_trace_level("rep", _, decl_rep).
-convert_trace_level("default", no, none).
-convert_trace_level("default", yes, deep).
-
-:- type trace_level
-	--->	none
-	;	shallow
-	;	deep
-	;	decl
-	;	decl_rep.
-
-trace_level_is_none(none) = yes.
-trace_level_is_none(shallow) = no.
-trace_level_is_none(deep) = no.
-trace_level_is_none(decl) = no.
-trace_level_is_none(decl_rep) = no.
-
-trace_level_needs_fixed_slots(none) = no.
-trace_level_needs_fixed_slots(shallow) = yes.
-trace_level_needs_fixed_slots(deep) = yes.
-trace_level_needs_fixed_slots(decl) = yes.
-trace_level_needs_fixed_slots(decl_rep) = yes.
-
-trace_level_needs_from_full_slot(none) = no.
-trace_level_needs_from_full_slot(shallow) = yes.
-trace_level_needs_from_full_slot(deep) = no.
-trace_level_needs_from_full_slot(decl) = no.
-trace_level_needs_from_full_slot(decl_rep) = no.
-
-trace_level_needs_decl_debug_slots(none) = no.
-trace_level_needs_decl_debug_slots(shallow) = no.
-trace_level_needs_decl_debug_slots(deep) = no.
-trace_level_needs_decl_debug_slots(decl) = yes.
-trace_level_needs_decl_debug_slots(decl_rep) = yes.
-
-trace_level_needs_interface_events(none) = no.
-trace_level_needs_interface_events(shallow) = yes.
-trace_level_needs_interface_events(deep) = yes.
-trace_level_needs_interface_events(decl) = yes.
-trace_level_needs_interface_events(decl_rep) = yes.
-
-trace_level_needs_internal_events(none) = no.
-trace_level_needs_internal_events(shallow) = no.
-trace_level_needs_internal_events(deep) = yes.
-trace_level_needs_internal_events(decl) = yes.
-trace_level_needs_internal_events(decl_rep) = yes.
-
-trace_level_needs_neg_context_events(none) = no.
-trace_level_needs_neg_context_events(shallow) = no.
-trace_level_needs_neg_context_events(deep) = no.
-trace_level_needs_neg_context_events(decl) = yes.
-trace_level_needs_neg_context_events(decl_rep) = yes.
-
-trace_level_needs_all_var_names(none) = no.
-trace_level_needs_all_var_names(shallow) = no.
-trace_level_needs_all_var_names(deep) = no.
-trace_level_needs_all_var_names(decl) = yes.
-trace_level_needs_all_var_names(decl_rep) = yes.
-
-trace_level_needs_proc_body_reps(none) = no.
-trace_level_needs_proc_body_reps(shallow) = no.
-trace_level_needs_proc_body_reps(deep) = no.
-trace_level_needs_proc_body_reps(decl) = no.
-trace_level_needs_proc_body_reps(decl_rep) = yes.
-
 %-----------------------------------------------------------------------------%
 
 :- type globals
@@ -304,13 +224,14 @@
 			tags_method 		:: tags_method,
 			prolog_dialect 		:: prolog_dialect,
 			termination_norm 	:: termination_norm,
-			trace_level 		:: trace_level
+			trace_level 		:: trace_level,
+			trace_suppress_items	:: trace_suppress_items
 		).
 
 globals__init(Options, Target, GC_Method, TagsMethod,
-		PrologDialect, TerminationNorm, TraceLevel,
+		PrologDialect, TerminationNorm, TraceLevel, TraceSuppress,
 	globals(Options, Target, GC_Method, TagsMethod,
-		PrologDialect, TerminationNorm, TraceLevel)).
+		PrologDialect, TerminationNorm, TraceLevel, TraceSuppress)).
 
 globals__get_options(Globals, Globals ^ options).
 globals__get_target(Globals, Globals ^ target).
@@ -319,12 +240,14 @@
 globals__get_prolog_dialect(Globals, Globals ^ prolog_dialect).
 globals__get_termination_norm(Globals, Globals ^ termination_norm).
 globals__get_trace_level(Globals, Globals ^ trace_level).
+globals__get_trace_suppress(Globals, Globals ^ trace_suppress_items).
 
 globals__set_options(Globals, Options, Globals ^ options := Options).
 
 globals__set_trace_level(Globals, TraceLevel,
 	Globals ^ trace_level := TraceLevel).
-globals__set_trace_level_none(Globals, Globals ^ trace_level := none).
+globals__set_trace_level_none(Globals,
+	Globals ^ trace_level := trace_level_none).
 
 globals__lookup_option(Globals, Option, OptionData) :-
 	globals__get_options(Globals, OptionTable),
@@ -387,11 +310,10 @@
 			globals__get_gc_method(Globals, GC_Method),
 			GC_Method = accurate
 		;
-			globals__lookup_bool_option(Globals, trace_return,
-				TraceReturn),
-			TraceReturn = yes,
 			globals__get_trace_level(Globals, TraceLevel),
-			TraceLevel \= none
+			globals__get_trace_suppress(Globals, TraceSuppress),
+			trace_needs_return_info(TraceLevel, TraceSuppress)
+				= yes
 		)
 	->
 		WantReturnLayouts = yes
@@ -403,15 +325,17 @@
 %-----------------------------------------------------------------------------%
 
 globals__io_init(Options, Target, GC_Method, TagsMethod,
-		PrologDialect, TerminationNorm, TraceLevel) -->
+		PrologDialect, TerminationNorm, TraceLevel, TraceSuppress) -->
 	{ copy(Target, Target1) },
 	{ copy(GC_Method, GC_Method1) },
 	{ copy(TagsMethod, TagsMethod1) },
 	{ copy(PrologDialect, PrologDialect1) },
 	{ copy(TerminationNorm, TerminationNorm1) },
 	{ copy(TraceLevel, TraceLevel1) },
+	{ copy(TraceSuppress, TraceSuppress1) },
 	{ globals__init(Options, Target1, GC_Method1, TagsMethod1,
-		PrologDialect1, TerminationNorm1, TraceLevel1, Globals) },
+		PrologDialect1, TerminationNorm1, TraceLevel1, TraceSuppress1,
+		Globals) },
 	globals__io_set_globals(Globals).
 
 globals__io_get_target(Target) -->
@@ -438,6 +362,10 @@
 	globals__io_get_globals(Globals),
 	{ globals__get_trace_level(Globals, TraceLevel) }.
 
+globals__io_get_trace_suppress(TraceSuppress) -->
+	globals__io_get_globals(Globals),
+	{ globals__get_trace_suppress(Globals, TraceSuppress) }.
+
 globals__io_get_globals(Globals) -->
 	io__get_globals(UnivGlobals),
 	{
@@ -480,7 +408,7 @@
 	% This predicate is needed because mercury_compile.m doesn't know
 	% anything about type trace_level.
 globals__io_set_trace_level_none -->
-	globals__io_set_trace_level(none).
+	globals__io_set_trace_level(trace_level_none).
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.91
diff -u -r1.91 handle_options.m
--- compiler/handle_options.m	2000/09/27 05:22:03	1.91
+++ compiler/handle_options.m	2000/09/27 08:17:20
@@ -45,7 +45,7 @@
 
 :- implementation.
 
-:- import_module options, globals, prog_io_util.
+:- import_module options, globals, prog_io_util, trace_params.
 :- import_module char, int, string, map, set, getopt, library.
 
 handle_options(MaybeError, Args, Link) -->
@@ -160,30 +160,42 @@
                                 { convert_trace_level(TraceStr, RequireTracing,
                                     TraceLevel) }
                             ->
-                                { map__lookup(OptionTable, dump_hlds_alias,
-                                    DumpAliasOption) },
+                                { map__lookup(OptionTable, suppress_trace,
+                                    Suppress) },
                                 (
-                                    { DumpAliasOption = string(DumpAlias) },
-                                    { DumpAlias = "" }
+                                    { Suppress = string(SuppressStr) },
+                                    { convert_trace_suppress(SuppressStr,
+                                        TraceSuppress) }
                                 ->
-                                    postprocess_options_2(OptionTable,
-                                        Target, GC_Method, TagsMethod,
-				        PrologDialect, TermNorm, TraceLevel,
-					Error)
+                                    { map__lookup(OptionTable, dump_hlds_alias,
+                                        DumpAliasOption) },
+                                    (
+                                        { DumpAliasOption = string(DumpAlias) },
+                                        { DumpAlias = "" }
+                                    ->
+                                        postprocess_options_2(OptionTable,
+                                            Target, GC_Method, TagsMethod,
+                                            PrologDialect, TermNorm, TraceLevel,
+                                            TraceSuppress, Error)
+                                    ;
+                                        { DumpAliasOption = string(DumpAlias) },
+                                        { convert_dump_alias(DumpAlias,
+                                            DumpOptions) }
+                                    ->
+                                        { map__set(OptionTable,
+                                            dump_hlds_options,
+                                            string(DumpOptions),
+                                            NewOptionTable) },
+                                        postprocess_options_2(NewOptionTable,
+                                            Target, GC_Method, TagsMethod,
+                                            PrologDialect, TermNorm,
+                                            TraceLevel, TraceSuppress, Error)
+                                    ;
+                                        { Error = yes("Invalid argument to option `--hlds-dump-alias'.") }
+                                    )
                                 ;
-                                    { DumpAliasOption = string(DumpAlias) },
-                                    { convert_dump_alias(DumpAlias,
-                                        DumpOptions) }
-                                ->
-                                    { map__set(OptionTable, dump_hlds_options,
-                                        string(DumpOptions), NewOptionTable) },
-                                    postprocess_options_2(NewOptionTable,
-                                        Target, GC_Method, TagsMethod,
-				        PrologDialect, TermNorm, TraceLevel,
-					Error)
-                                ;
-                                    { Error = yes("Invalid argument to option `--hlds-dump-alias'.") }
-                                )
+                                    { Error = yes("Invalid argument to option `--suppress-trace'.") }
+				)
                             ;
                                 { Error = yes("Invalid argument to option `--trace'\n\t(must be `minimum', `shallow', `deep', or `default').") }
                             )
@@ -205,17 +217,18 @@
     ;
         { Error = yes("Invalid target option (must be `c' or `il')") }
     ).
+    
 
-:- pred postprocess_options_2(option_table, compilation_target, gc_method,
-	tags_method, prolog_dialect, termination_norm, trace_level,
-	maybe(string), io__state, io__state).
-:- mode postprocess_options_2(in, in, in, in, in, in, in, out, di, uo) is det.
+:- pred postprocess_options_2(option_table::in, compilation_target::in,
+    gc_method::in, tags_method::in, prolog_dialect::in, termination_norm::in,
+    trace_level::in, trace_suppress_items::in, maybe(string)::out,
+    io__state::di, io__state::uo) is det.
 
 postprocess_options_2(OptionTable, Target, GC_Method, TagsMethod,
-		PrologDialect, TermNorm, TraceLevel, Error) -->
+		PrologDialect, TermNorm, TraceLevel, TraceSuppress, Error) -->
 	{ unsafe_promise_unique(OptionTable, OptionTable1) }, % XXX
 	globals__io_init(OptionTable1, Target, GC_Method, TagsMethod,
-		PrologDialect, TermNorm, TraceLevel),
+		PrologDialect, TermNorm, TraceLevel, TraceSuppress),
 
 	% --gc conservative implies --no-reclaim-heap-*
 	( { GC_Method = conservative } ->
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.53
diff -u -r1.53 jumpopt.m
--- compiler/jumpopt.m	2000/09/27 05:22:05	1.53
+++ compiler/jumpopt.m	2000/09/27 11:37:06
@@ -14,7 +14,7 @@
 
 :- interface.
 
-:- import_module llds, globals.
+:- import_module llds, trace_params.
 :- import_module list, set, bool, counter.
 
 	% Take an instruction list and optimize jumps. This includes jumps
Index: compiler/live_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.91
diff -u -r1.91 live_vars.m
--- compiler/live_vars.m	2000/09/27 05:22:06	1.91
+++ compiler/live_vars.m	2000/09/27 11:37:53
@@ -34,8 +34,8 @@
 :- implementation.
 
 :- import_module llds, arg_info, prog_data, hlds_goal, hlds_data, mode_util.
-:- import_module liveness, code_aux, globals, graph_colour, instmap, options.
-:- import_module trace.
+:- import_module liveness, code_aux, globals, trace_params, trace.
+:- import_module graph_colour, instmap, options.
 :- import_module list, map, set, std_util, assoc_list, bool.
 :- import_module int, require.
 
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.111
diff -u -r1.111 liveness.m
--- compiler/liveness.m	2000/09/27 05:22:09	1.111
+++ compiler/liveness.m	2000/09/27 11:38:36
@@ -162,11 +162,11 @@
 
 :- import_module hlds_goal, hlds_data, llds, quantification, (inst), instmap.
 :- import_module hlds_out, mode_util, code_util, quantification, options.
-:- import_module trace, globals, polymorphism, passes_aux, prog_util.
-:- import_module term, varset.
+:- import_module polymorphism, passes_aux, prog_util.
+:- import_module trace_params, trace, globals.
 
-:- import_module bool, map, std_util, list, assoc_list, require.
-:- import_module string.
+:- import_module bool, string, map, std_util, list, assoc_list, require.
+:- import_module term, varset.
 
 detect_liveness_proc(ProcInfo0, PredId, ModuleInfo, ProcInfo) :-
 	requantify_proc(ProcInfo0, ProcInfo1),
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.156
diff -u -r1.156 llds_out.m
--- compiler/llds_out.m	2000/09/27 05:22:13	1.156
+++ compiler/llds_out.m	2000/09/27 11:39:00
@@ -262,7 +262,7 @@
 
 :- implementation.
 
-:- import_module rtti, rtti_out, options.
+:- import_module rtti, rtti_out, options, trace_params.
 :- import_module exprn_aux, prog_util, prog_out, hlds_pred.
 :- import_module export, mercury_to_mercury, modules.
 :- import_module c_util.
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.178
diff -u -r1.178 mercury_compile.m
--- compiler/mercury_compile.m	2000/09/27 05:22:18	1.178
+++ compiler/mercury_compile.m	2000/09/27 11:40:04
@@ -24,11 +24,6 @@
 
 :- implementation.
 
-	% library modules
-:- import_module int, list, map, set, std_util, dir, require, string, bool.
-:- import_module library, getopt, set_bbbtree, term, varset.
-:- import_module gc.
-
 	%
 	% the main compiler passes (mostly in order of execution)
 	%
@@ -67,12 +62,16 @@
 :- import_module ml_optimize.			% MLDS -> MLDS
 :- import_module mlds_to_c.			% MLDS -> C
 
-
 	% miscellaneous compiler modules
 :- import_module prog_data, hlds_module, hlds_pred, hlds_out, llds, rl.
 :- import_module mercury_to_mercury, mercury_to_goedel.
 :- import_module dependency_graph, prog_util, rl_dump, rl_file.
-:- import_module options, globals, passes_aux.
+:- import_module options, globals, trace_params, passes_aux.
+
+	% library modules
+:- import_module int, list, map, set, std_util, dir, require, string, bool.
+:- import_module library, getopt, set_bbbtree, term, varset.
+:- import_module gc.
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.291
diff -u -r1.291 options.m
--- compiler/options.m	2000/09/27 05:22:29	1.291
+++ compiler/options.m	2000/09/29 02:40:57
@@ -95,10 +95,8 @@
 	% Auxiliary output options
 		;	assume_gmake
 		;	trace
-		;	trace_internal
-		;	trace_return
-		;	trace_redo
 		;	trace_optimized
+		;	suppress_trace
 		;	stack_trace_higher_order
 		;	generate_bytecode
 		;	generate_prolog		% Currently not used
@@ -485,10 +483,8 @@
 		% Auxiliary Output Options
 	assume_gmake		-	bool(yes),
 	trace			-	string("default"),
-	trace_internal		-	bool(yes),
-	trace_return		-	bool(yes),
-	trace_redo		-	bool(yes),
 	trace_optimized		-	bool(no),
+	suppress_trace		-	string(""),
 	stack_trace_higher_order -	bool(no),
 	generate_bytecode	-	bool(no),
 	generate_prolog		-	bool(no),
@@ -870,11 +866,9 @@
 % aux output options
 long_option("assume-gmake",		assume_gmake).
 long_option("trace",			trace).
-long_option("trace-internal",		trace_internal).
-long_option("trace-return",		trace_return).
-long_option("trace-redo",		trace_redo).
 long_option("trace-optimised",		trace_optimized).
 long_option("trace-optimized",		trace_optimized).
+long_option("suppress-trace",		suppress_trace).
 long_option("stack-trace-higher-order",	stack_trace_higher_order).
 long_option("generate-bytecode",	generate_bytecode).
 long_option("generate-prolog",		generate_prolog).
@@ -1661,15 +1655,9 @@
 		"\tof execution tracing.",
 		"\tSee the Debugging chapter of the Mercury User's Guide",
 		"\tfor details.",
-		"--no-trace-internal",
-		"\tDo not generate code for internal events even if the trace",
-		"\tlevel would normally require it.",
-		"--no-trace-return",
-		"\tDo not generate trace information for call return sites.",
-		"\tPrevents the printing of the values of variables in ancestors",
-		"\tof the current call.",
+%		"--suppress-trace <suppress-items>,",
+%		"\tSuppress the named aspects of the execution tracing system.",
-		"--no-trace-redo",
-		"\tDo not generate code to trace REDO events.",
 		"--trace-optimized",
 		"\tDo not disable optimizations that can change the trace.",
 		"--stack-trace-higher-order",
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.52
diff -u -r1.52 stack_layout.m
--- compiler/stack_layout.m	2000/09/27 05:22:36	1.52
+++ compiler/stack_layout.m	2000/09/27 11:56:10
@@ -261,7 +261,7 @@
 
 :- implementation.
 
-:- import_module globals, options, llds_out, trace.
+:- import_module globals, options, llds_out, trace_params, trace.
 :- import_module hlds_data, hlds_goal, hlds_pred.
 :- import_module prog_data, prog_util, prog_out, instmap.
 :- import_module prog_rep, static_term.
@@ -286,6 +286,7 @@
 	globals__lookup_bool_option(Globals, procid_stack_layout,
 		ProcIdLayout),
 	globals__get_trace_level(Globals, TraceLevel),
+	globals__get_trace_suppress(Globals, TraceSuppress),
 	globals__have_static_code_addresses(Globals, StaticCodeAddr),
 	set_bbbtree__init(LayoutLabels0),
 
@@ -293,7 +294,8 @@
 	map__init(LabelTables0),
 	StringTable0 = string_table(StringMap0, [], 0),
 	LayoutInfo0 = stack_layout_info(ModuleInfo0,
-		AgcLayout, TraceLayout, ProcIdLayout, TraceLevel,
+		AgcLayout, TraceLayout, ProcIdLayout,
+		TraceLevel, TraceSuppress,
 		StaticCodeAddr, [], [], LayoutLabels0, [],
 		StringTable0, LabelTables0, map__init),
 	stack_layout__lookup_string_in_table("", _, LayoutInfo0, LayoutInfo1),
@@ -764,7 +766,9 @@
 		stack_layout__construct_var_name_vector(VarSet, UsedVarNameMap,
 			VarNameCount, VarNameVector),
 		stack_layout__get_trace_level(TraceLevel),
-		{ trace_level_needs_proc_body_reps(TraceLevel) = BodyReps },
+		stack_layout__get_trace_suppress(TraceSuppress),
+		{ trace_needs_proc_body_reps(TraceLevel, TraceSuppress)
+			= BodyReps },
 		(
 			{ BodyReps = no },
 			{ GoalRepRval = yes(const(int_const(0))) }
@@ -831,7 +835,9 @@
 stack_layout__construct_var_name_vector(VarSet, UsedVarNameMap, Count, Vector)
 		-->
 	stack_layout__get_trace_level(TraceLevel),
-	{ trace_level_needs_all_var_names(TraceLevel) = NeedsAllNames },
+	stack_layout__get_trace_suppress(TraceSuppress),
+	{ trace_needs_all_var_names(TraceLevel, TraceSuppress)
+		= NeedsAllNames },
 	(
 		{ NeedsAllNames = yes },
 		{ varset__var_name_list(VarSet, VarNameList) },
@@ -1751,6 +1757,7 @@
 		trace_stack_layout	:: bool, % generate tracing info?
 		procid_stack_layout	:: bool, % generate proc id info?
 		trace_level		:: trace_level,
+		trace_suppress_items	:: trace_suppress_items,
 		static_code_addresses	:: bool, % have static code addresses?
 		proc_layouts		:: list(comp_gen_c_data),
 		internal_layouts	:: list(comp_gen_c_data),
@@ -1790,6 +1797,9 @@
 :- pred stack_layout__get_trace_level(trace_level::out,
 	stack_layout_info::in, stack_layout_info::out) is det.
 
+:- pred stack_layout__get_trace_suppress(trace_suppress_items::out,
+	stack_layout_info::in, stack_layout_info::out) is det.
+
 :- pred stack_layout__get_static_code_addresses(bool::out,
 	stack_layout_info::in, stack_layout_info::out) is det.
 
@@ -1816,6 +1826,7 @@
 stack_layout__get_trace_stack_layout(LI ^ trace_stack_layout, LI, LI).
 stack_layout__get_procid_stack_layout(LI ^ procid_stack_layout, LI, LI).
 stack_layout__get_trace_level(LI ^ trace_level, LI, LI).
+stack_layout__get_trace_suppress(LI ^ trace_suppress_items, LI, LI).
 stack_layout__get_static_code_addresses(LI ^ static_code_addresses, LI, LI).
 stack_layout__get_proc_layout_data(LI ^ proc_layouts, LI, LI).
 stack_layout__get_internal_layout_data(LI ^ internal_layouts, LI, LI).
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.73
diff -u -r1.73 store_alloc.m
--- compiler/store_alloc.m	2000/09/27 05:22:40	1.73
+++ compiler/store_alloc.m	2000/09/27 11:40:47
@@ -37,7 +37,8 @@
 :- implementation.
 
 :- import_module follow_vars, liveness, hlds_goal, llds, prog_data.
-:- import_module options, globals, goal_util, mode_util, instmap, trace.
+:- import_module options, globals, trace_params, trace.
+:- import_module goal_util, mode_util, instmap.
 :- import_module list, map, set, std_util, assoc_list.
 :- import_module bool, int, require.
 
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.35
diff -u -r1.35 trace.m
--- compiler/trace.m	2000/09/27 05:22:41	1.35
+++ compiler/trace.m	2000/09/27 10:16:41
@@ -145,14 +145,25 @@
 	prog_context::in, code_tree::out, code_info::in, code_info::out)
 	is det.
 
+:- type external_event_info
+	--->	external_event_info(
+			label,		% The label associated with the
+					% external event.
+			map(tvar, set(layout_locn)),
+					% The map saying where the typeinfo
+					% variables needed to describe the
+					% types of the variables live at the
+					% event are.
+			code_tree	% The code generated for the event.
+		).
+
 	% Generate code for an external trace event.
 	% Besides the trace code, we return the label on which we have hung
 	% the trace liveness information and data on the type variables in the
 	% liveness information, since some of our callers also need this
 	% information.
 :- pred trace__generate_external_event_code(external_trace_port::in,
-	trace_info::in, prog_context::in, label::out,
-	map(tvar, set(layout_locn))::out, code_tree::out,
+	trace_info::in, prog_context::in, maybe(external_event_info)::out,
 	code_info::in, code_info::out) is det.
 
 	% If the trace level calls for redo events, generate code that pushes
@@ -167,9 +178,9 @@
 
 :- implementation.
 
-:- import_module continuation_info, type_util, llds_out, tree, varset.
+:- import_module continuation_info, trace_params, type_util, llds_out, tree.
 :- import_module (inst), instmap, inst_match, mode_util, options.
-:- import_module list, bool, int, string, map, std_util, require, term.
+:- import_module list, bool, int, string, map, std_util, require, term, varset.
 
 	% Information specific to a trace port.
 :- type trace_port_info
@@ -257,6 +268,7 @@
 
 trace__reserved_slots(ProcInfo, Globals, ReservedSlots) :-
 	globals__get_trace_level(Globals, TraceLevel),
+	globals__get_trace_suppress(Globals, TraceSuppress),
 	FixedSlots = trace_level_needs_fixed_slots(TraceLevel),
 	(
 		FixedSlots = no,
@@ -265,8 +277,8 @@
 		FixedSlots = yes,
 		Fixed = 3, % event#, call#, call depth
 		(
-			globals__lookup_bool_option(Globals, trace_redo, yes),
-			proc_info_interface_code_model(ProcInfo, model_non)
+			proc_info_interface_code_model(ProcInfo, model_non),
+			trace_needs_port(TraceLevel, TraceSuppress, redo) = yes
 		->
 			RedoLayout = 1
 		;
@@ -294,7 +306,9 @@
 
 trace__setup(Globals, TraceSlotInfo, TraceInfo) -->
 	code_info__get_proc_model(CodeModel),
-	{ globals__lookup_bool_option(Globals, trace_redo, TraceRedo) },
+	{ globals__get_trace_level(Globals, TraceLevel) },
+	{ globals__get_trace_suppress(Globals, TraceSuppress) },
+	{ trace_needs_port(TraceLevel, TraceSuppress, redo) = TraceRedo },
 	(
 		{ TraceRedo = yes },
 		{ CodeModel = model_non }
@@ -306,7 +320,6 @@
 		{ MaybeRedoLayout = no },
 		{ NextSlotAfterRedoLayout = 4 }
 	),
-	{ globals__get_trace_level(Globals, TraceLevel) },
 	{ trace_level_needs_from_full_slot(TraceLevel) = FromFullSlot },
 	{
 		FromFullSlot = no,
@@ -324,15 +337,6 @@
 		MaybeFromFullSlotLval = yes(CallFromFullSlot),
 		NextSlotAfterFromFull is NextSlotAfterRedoLayout + 1
 	},
-	{ trace_level_needs_internal_events(TraceLevel) = TraceInternal0 },
-	{
-		TraceInternal0 = no,
-		TraceInternal = no
-	;
-		TraceInternal0 = yes,
-		globals__lookup_bool_option(Globals, trace_internal,
-			TraceInternal)
-	},
 	{ trace_level_needs_decl_debug_slots(TraceLevel) = DeclDebugSlots },
 	{
 		DeclDebugSlots = yes,
@@ -359,15 +363,15 @@
 	},
 	{ TraceSlotInfo = trace_slot_info(MaybeFromFullSlot,
 		MaybeDeclSlots, MaybeTrailSlot) },
-	{ init_trace_info(TraceLevel, TraceInternal, MaybeFromFullSlotLval,
-		MaybeTrailLvals, MaybeRedoLayout, TraceInfo) }.
+	{ TraceInfo = trace_info(TraceLevel, TraceSuppress,
+		MaybeFromFullSlotLval, MaybeTrailLvals, MaybeRedoLayout) }.
 
 trace__generate_slot_fill_code(TraceInfo, TraceCode) -->
 	code_info__get_proc_model(CodeModel),
 	{
-	trace_info_get_maybe_from_full_slot(TraceInfo, MaybeFromFullSlot),
-	trace_info_get_maybe_redo_layout_slot(TraceInfo, MaybeRedoLayoutSlot),
-	trace_info_get_maybe_trail_slots(TraceInfo, MaybeTrailLvals),
+	MaybeFromFullSlot = TraceInfo ^ from_full_lval,
+	MaybeRedoLabel = TraceInfo ^ redo_label,
+	MaybeTrailLvals = TraceInfo ^ trail_lvals,
 	trace__event_num_slot(CodeModel, EventNumLval),
 	trace__call_num_slot(CodeModel, CallNumLval),
 	trace__call_depth_slot(CodeModel, CallDepthLval),
@@ -379,7 +383,7 @@
 		"\t\t", CallNumStr, " = MR_trace_incr_seq();\n",
 		"\t\t", CallDepthStr, " = MR_trace_incr_depth();"
 	], FillThreeSlots),
-	( MaybeRedoLayoutSlot = yes(RedoLayoutLabel) ->
+	( MaybeRedoLabel = yes(RedoLayoutLabel) ->
 		trace__redo_layout_slot(CodeModel, RedoLayoutLval),
 		trace__stackref_to_string(RedoLayoutLval, RedoLayoutStr),
 		llds_out__make_stack_layout_name(RedoLayoutLabel,
@@ -440,8 +444,7 @@
 	{
 		MaybeTraceInfo = yes(TraceInfo)
 	->
-		trace_info_get_maybe_from_full_slot(TraceInfo,
-			MaybeFromFullSlot),
+		MaybeFromFullSlot = TraceInfo ^ from_full_lval,
 		trace__call_depth_slot(CodeModel, CallDepthLval),
 		trace__stackref_to_string(CallDepthLval, CallDepthStr),
 		string__append_list([
@@ -465,8 +468,7 @@
 trace__maybe_generate_internal_event_code(Goal, Code) -->
 	code_info__get_maybe_trace_info(MaybeTraceInfo),
 	(
-		{ MaybeTraceInfo = yes(TraceInfo) },
-		{ trace_info_get_trace_internal(TraceInfo, yes) }
+		{ MaybeTraceInfo = yes(TraceInfo) }
 	->
 		{ Goal = _ - GoalInfo },
 		{ goal_info_get_goal_path(GoalInfo, Path) },
@@ -497,18 +499,16 @@
 			error("trace__generate_internal_event_code: bad path")
 		},
 		(
-			{ ( Port = ite_cond ; Port = neg_enter ) },
-			{ trace_info_get_trace_level(TraceInfo, TraceLevel) },
-			{ trace_level_needs_neg_context_events(TraceLevel)
-				= no }
+			{ trace_needs_port(TraceInfo ^ trace_level,
+				TraceInfo ^ trace_suppress_items, Port) = yes }
 		->
-			{ Code = empty }
-		;
 			{ goal_info_get_pre_deaths(GoalInfo, PreDeaths) },
 			{ goal_info_get_context(GoalInfo, Context) },
 			trace__generate_event_code(Port,
 				internal(Path, PreDeaths), TraceInfo,
 				Context, _, _, Code)
+		;
+			{ Code = empty }
 		)
 	;
 		{ Code = empty }
@@ -518,10 +518,6 @@
 	code_info__get_maybe_trace_info(MaybeTraceInfo),
 	(
 		{ MaybeTraceInfo = yes(TraceInfo) },
-		{ trace_info_get_trace_internal(TraceInfo, yes) },
-		{ trace_info_get_trace_level(TraceInfo, TraceLevel) },
-		{ trace_level_needs_neg_context_events(TraceLevel) = yes }
-	->
 		{
 			NegPort = neg_failure,
 			Port = neg_failure
@@ -529,6 +525,9 @@
 			NegPort = neg_success,
 			Port = neg_success
 		},
+		{ trace_needs_port(TraceInfo ^ trace_level,
+			TraceInfo ^ trace_suppress_items, Port) = yes }
+	->
 		{ Goal = _ - GoalInfo },
 		{ goal_info_get_goal_path(GoalInfo, Path) },
 		{ goal_info_get_context(GoalInfo, Context) },
@@ -542,9 +541,10 @@
 	code_info__get_maybe_trace_info(MaybeTraceInfo),
 	(
 		{ MaybeTraceInfo = yes(TraceInfo) },
-		{ trace_info_get_trace_internal(TraceInfo, yes) }
-	->
 		{ trace__convert_nondet_pragma_port_type(PragmaPort, Port) },
+		{ trace_needs_port(TraceInfo ^ trace_level,
+			TraceInfo ^ trace_suppress_items, Port) = yes }
+	->
 		trace__generate_event_code(Port, nondet_pragma, TraceInfo,
 			Context, _, _, Code)
 	;
@@ -552,10 +552,19 @@
 	).
 
 trace__generate_external_event_code(ExternalPort, TraceInfo, Context,
-		Label, TvarDataMap, Code) -->
+		MaybeExternalInfo) -->
 	{ trace__convert_external_port_type(ExternalPort, Port) },
-	trace__generate_event_code(Port, external, TraceInfo,
-		Context, Label, TvarDataMap, Code).
+	(
+		{ trace_needs_port(TraceInfo ^ trace_level,
+			TraceInfo ^ trace_suppress_items, Port) = yes }
+	->
+		trace__generate_event_code(Port, external, TraceInfo,
+			Context, Label, TvarDataMap, Code),
+		{ MaybeExternalInfo = yes(external_event_info(Label,
+			TvarDataMap, Code)) }
+	;
+		{ MaybeExternalInfo = no }
+	).
 
 :- pred trace__generate_event_code(trace_port::in, trace_port_info::in,
 	trace_info::in, prog_context::in, label::out,
@@ -625,8 +634,7 @@
 		LayoutLabelInfo),
 	(
 		{ Port = fail },
-		{ trace_info_get_maybe_redo_layout_slot(TraceInfo,
-			yes(RedoLabel)) }
+		{ TraceInfo ^ redo_label = yes(RedoLabel) }
 	->
 		% The layout information for the redo event is the same as
 		% for the fail event; all the non-clobbered inputs in their
@@ -665,10 +673,9 @@
 	}.
 
 trace__maybe_setup_redo_event(TraceInfo, Code) :-
-	trace_info_get_maybe_redo_layout_slot(TraceInfo, TraceRedoLayout),
-	( TraceRedoLayout = yes(_) ->
-		trace_info_get_maybe_from_full_slot(TraceInfo,
-			MaybeFromFullSlot),
+	TraceRedoLabel = TraceInfo ^ redo_label,
+	( TraceRedoLabel = yes(_) ->
+		MaybeFromFullSlot = TraceInfo ^ from_full_lval,
 		(
 			MaybeFromFullSlot = yes(Lval),
 			% The code in the runtime looks for the from-full
@@ -851,19 +858,21 @@
 
 	% Information for tracing that is valid throughout the execution
 	% of a procedure.
-:- type trace_info
-	--->	trace_info(
-			trace_level,	% The trace level.
-			bool,		% Whether we generate internal events.
-			maybe(lval),	% If the trace level is shallow,
+:- type trace_info --->
+	trace_info(
+		trace_level		:: trace_level,
+		trace_suppress_items	:: trace_suppress_items,
+		from_full_lval		:: maybe(lval),
+					% If the trace level is shallow,
 					% the lval of the slot that holds the
 					% from-full flag.
-			maybe(pair(lval)),
+		trail_lvals		:: maybe(pair(lval)),
 					% If trailing is enabled, the lvals
 					% of the slots that hold the value
 					% of the trail pointer and the ticket
 					% counter at the time of the call.
-			maybe(label)	% If we are generating redo events,
+		redo_label		:: maybe(label)
+					% If we are generating redo events,
 					% this has the label associated with
 					% the fail event, which we then reserve
 					% in advance, so we can put the
@@ -871,31 +880,4 @@
 					% into the slot which holds the
 					% layout for the redo event (the
 					% two events have identical layouts).
-		).
-
-:- pred init_trace_info(trace_level::in, bool::in, maybe(lval)::in,
-	maybe(pair(lval))::in, maybe(label)::in, trace_info::out) is det.
-
-:- pred trace_info_get_trace_level(trace_info::in, trace_level::out) is det.
-:- pred trace_info_get_trace_internal(trace_info::in, bool::out) is det.
-:- pred trace_info_get_maybe_from_full_slot(trace_info::in, maybe(lval)::out)
-	is det.
-:- pred trace_info_get_maybe_trail_slots(trace_info::in,
-	maybe(pair(lval))::out) is det.
-:- pred trace_info_get_maybe_redo_layout_slot(trace_info::in,
-	maybe(label)::out) is det.
-
-init_trace_info(TraceLevel, TraceInternal, MaybeFromFullSlot,
-	MaybeTrailSlot, MaybeRedoLayoutSlot,
-	trace_info(TraceLevel, TraceInternal, MaybeFromFullSlot,
-		MaybeTrailSlot, MaybeRedoLayoutSlot)).
-
-trace_info_get_trace_level(trace_info(TraceLevel, _, _, _, _), TraceLevel).
-trace_info_get_maybe_from_full_slot(trace_info(_, _, MaybeFromFullSlot, _, _),
-	MaybeFromFullSlot).
-trace_info_get_trace_internal(trace_info(_, TraceInternal, _, _, _),
-	TraceInternal).
-trace_info_get_maybe_trail_slots(trace_info(_, _, _, MaybesTrailSlot, _),
-	MaybesTrailSlot).
-trace_info_get_maybe_redo_layout_slot(trace_info(_, _, _, _,
-	MaybeRedoLayoutSlot), MaybeRedoLayoutSlot).
+	).
Index: compiler/trace_params.m
===================================================================
RCS file: trace_params.m
diff -N trace_params.m
--- /dev/null	Thu Sep  2 15:00:04 1999
+++ trace_params.m	Fri Sep 29 13:37:25 2000
@@ -0,0 +1,282 @@
+%-----------------------------------------------------------------------------%
+% Copyright (C) 2000 The University of Melbourne.
+% This file may only be copied under the terms of the GNU General
+% Public License - see the file COPYING in the Mercury distribution.
+%-----------------------------------------------------------------------------%
+%
+% File: trace_params.m.
+%
+% Author: zs.
+%
+% This module defines the parameters of execution tracing at various trace
+% levels and with various settings of the --suppress-trace option.
+
+%-----------------------------------------------------------------------------%
+
+:- module trace_params.
+
+:- interface.
+
+:- import_module llds.
+:- import_module bool.
+
+:- type trace_level.
+:- type trace_suppress_items.
+
+	% the bool should be the setting of the `require_tracing' option.
+:- pred convert_trace_level(string::in, bool::in, trace_level::out) is semidet.
+
+:- pred convert_trace_suppress(string::in, trace_suppress_items::out)
+	is semidet.
+
+	% These functions check for various properties of the trace level.
+:- func trace_level_is_none(trace_level) = bool.
+:- func trace_level_needs_fixed_slots(trace_level) = bool.
+:- func trace_level_needs_from_full_slot(trace_level) = bool.
+:- func trace_level_needs_decl_debug_slots(trace_level) = bool.
+:- func trace_needs_return_info(trace_level, trace_suppress_items) = bool.
+:- func trace_needs_all_var_names(trace_level, trace_suppress_items) = bool.
+:- func trace_needs_proc_body_reps(trace_level, trace_suppress_items) = bool.
+:- func trace_needs_port(trace_level, trace_suppress_items, trace_port) = bool.
+
+:- func trace_level_none = trace_level.
+
+:- implementation.
+
+:- import_module char, string, list, set.
+
+:- type trace_level
+	--->	none
+	;	shallow
+	;	deep
+	;	decl
+	;	decl_rep.
+
+:- type trace_suppress_item
+	--->	port(trace_port)
+	;	return_info
+	;	all_var_names
+	;	proc_body_reps.
+
+:- type trace_suppress_items == set(trace_suppress_item).
+
+trace_level_none = none.
+
+convert_trace_level("minimum", no, none).
+convert_trace_level("minimum", yes, shallow).
+convert_trace_level("shallow", _, shallow).
+convert_trace_level("deep", _, deep).
+convert_trace_level("decl", _, decl).
+convert_trace_level("rep", _, decl_rep).
+convert_trace_level("default", no, none).
+convert_trace_level("default", yes, deep).
+
+trace_level_is_none(none) = yes.
+trace_level_is_none(shallow) = no.
+trace_level_is_none(deep) = no.
+trace_level_is_none(decl) = no.
+trace_level_is_none(decl_rep) = no.
+
+trace_level_needs_fixed_slots(none) = no.
+trace_level_needs_fixed_slots(shallow) = yes.
+trace_level_needs_fixed_slots(deep) = yes.
+trace_level_needs_fixed_slots(decl) = yes.
+trace_level_needs_fixed_slots(decl_rep) = yes.
+
+trace_level_needs_from_full_slot(none) = no.
+trace_level_needs_from_full_slot(shallow) = yes.
+trace_level_needs_from_full_slot(deep) = no.
+trace_level_needs_from_full_slot(decl) = no.
+trace_level_needs_from_full_slot(decl_rep) = no.
+
+trace_level_needs_decl_debug_slots(none) = no.
+trace_level_needs_decl_debug_slots(shallow) = no.
+trace_level_needs_decl_debug_slots(deep) = no.
+trace_level_needs_decl_debug_slots(decl) = yes.
+trace_level_needs_decl_debug_slots(decl_rep) = yes.
+
+trace_needs_return_info(TraceLevel, TraceSuppressItems) = Need :-
+	(
+		trace_level_has_return_info(TraceLevel) = yes,
+		\+ set__member(return_info, TraceSuppressItems)
+	->
+		Need = yes
+	;
+		Need = no
+	).
+
+trace_needs_all_var_names(TraceLevel, TraceSuppressItems) = Need :-
+	(
+		trace_level_has_all_var_names(TraceLevel) = yes,
+		\+ set__member(all_var_names, TraceSuppressItems)
+	->
+		Need = yes
+	;
+		Need = no
+	).
+
+trace_needs_proc_body_reps(TraceLevel, TraceSuppressItems) = Need :-
+	(
+		trace_level_has_proc_body_reps(TraceLevel) = yes,
+		\+ set__member(proc_body_reps, TraceSuppressItems)
+	->
+		Need = yes
+	;
+		Need = no
+	).
+
+:- func trace_level_has_return_info(trace_level) = bool.
+:- func trace_level_has_all_var_names(trace_level) = bool.
+:- func trace_level_has_proc_body_reps(trace_level) = bool.
+
+trace_level_has_return_info(none) = no.
+trace_level_has_return_info(shallow) = yes.
+trace_level_has_return_info(deep) = yes.
+trace_level_has_return_info(decl) = yes.
+trace_level_has_return_info(decl_rep) = yes.
+
+trace_level_has_all_var_names(none) = no.
+trace_level_has_all_var_names(shallow) = no.
+trace_level_has_all_var_names(deep) = no.
+trace_level_has_all_var_names(decl) = yes.
+trace_level_has_all_var_names(decl_rep) = yes.
+
+trace_level_has_proc_body_reps(none) = no.
+trace_level_has_proc_body_reps(shallow) = no.
+trace_level_has_proc_body_reps(deep) = no.
+trace_level_has_proc_body_reps(decl) = no.
+trace_level_has_proc_body_reps(decl_rep) = yes.
+
+convert_trace_suppress(SuppressString, SuppressItemSet) :-
+	SuppressWords = string__words(char_is_comma, SuppressString),
+	list__map(convert_item_name, SuppressWords, SuppressItemLists),
+	list__condense(SuppressItemLists, SuppressItems),
+	set__list_to_set(SuppressItems, SuppressItemSet).
+
+:- pred char_is_comma(char::in) is semidet.
+
+char_is_comma(',').
+
+:- func convert_port_name(string) = trace_port is semidet.
+
+	% The call port cannot be disabled, because its layout structure is
+	% referred to implicitly by the redo command in mdb.
+	%
+	% The exception port cannot be disabled, because it is never put into
+	% compiler-generated code in the first place; such events are created
+	% on the fly by library/exception.m.
+% convert_port_name("call") = call.
+convert_port_name("exit") = exit.
+convert_port_name("fail") = fail.
+convert_port_name("redo") = redo.
+% convert_port_name("excp") = exception.
+convert_port_name("exception") = exception.
+convert_port_name("cond") = ite_cond.
+convert_port_name("ite_cond") = ite_cond.
+convert_port_name("then") = ite_then.
+convert_port_name("ite_then") = ite_then.
+convert_port_name("else") = ite_else.
+convert_port_name("ite_else") = ite_else.
+convert_port_name("nege") = neg_enter.
+convert_port_name("neg_enter") = neg_enter.
+convert_port_name("negs") = neg_success.
+convert_port_name("neg_success") = neg_success.
+convert_port_name("negf") = neg_failure.
+convert_port_name("neg_failure") = neg_failure.
+convert_port_name("swtc") = switch.
+convert_port_name("switch") = switch.
+convert_port_name("disj") = disj.
+convert_port_name("frst") = nondet_pragma_first.
+convert_port_name("nondet_pragma_first") = nondet_pragma_first.
+convert_port_name("latr") = nondet_pragma_first.
+convert_port_name("nondet_pragma_later") = nondet_pragma_later.
+
+:- func convert_port_class_name(string) = list(trace_port) is semidet.
+
+convert_port_class_name("interface") =
+	[call, exit, redo, fail, exception].
+convert_port_class_name("internal") =
+	[ite_then, ite_else, switch, disj].
+convert_port_class_name("context") =
+	[ite_cond, neg_enter, neg_success, neg_failure].
+
+:- func convert_other_name(string) = trace_suppress_item is semidet.
+
+convert_other_name("return") = return_info.
+convert_other_name("return_info") = return_info.
+convert_other_name("names") = all_var_names.
+convert_other_name("all_var_names") = all_var_names.
+convert_other_name("bodies") = proc_body_reps.
+convert_other_name("proc_body_reps") = proc_body_reps.
+
+:- pred convert_item_name(string::in, list(trace_suppress_item)::out)
+	is semidet.
+
+convert_item_name(String, Names) :-
+	( convert_port_name(String) = PortName ->
+		Names = [port(PortName)]
+	; convert_port_class_name(String) = PortNames ->
+		list__map(wrap_port, PortNames, Names)
+	; convert_other_name(String) = OtherName ->
+		Names = [OtherName]
+	;
+		fail
+	).
+
+:- pred wrap_port(trace_port::in, trace_suppress_item::out) is det.
+
+wrap_port(Port, port(Port)).
+
+%-----------------------------------------------------------------------------%
+
+:- type port_category
+	--->	interface
+	;	internal
+	;	context.
+
+:- func trace_port_category(trace_port) = port_category.
+
+trace_port_category(call)			= interface.
+trace_port_category(exit)			= interface.
+trace_port_category(fail)			= interface.
+trace_port_category(redo)			= interface.
+trace_port_category(exception)			= interface.
+trace_port_category(ite_cond)			= context.
+trace_port_category(ite_then)			= internal.
+trace_port_category(ite_else)			= internal.
+trace_port_category(neg_enter)			= context.
+trace_port_category(neg_success)		= context.
+trace_port_category(neg_failure)		= context.
+trace_port_category(switch)			= internal.
+trace_port_category(disj)			= internal.
+trace_port_category(nondet_pragma_first)	= internal.
+trace_port_category(nondet_pragma_later)	= internal.
+
+:- func trace_level_port_categories(trace_level) = list(port_category).
+
+trace_level_port_categories(none) = [].
+trace_level_port_categories(shallow) = [interface].
+trace_level_port_categories(deep) = [interface, internal].
+trace_level_port_categories(decl) = [interface, internal, context].
+trace_level_port_categories(decl_rep) = [interface, internal, context].
+
+:- func trace_level_allows_port_suppression(trace_level) = bool.
+
+trace_level_allows_port_suppression(none) = no.		% no ports exist
+trace_level_allows_port_suppression(shallow) = yes.
+trace_level_allows_port_suppression(deep) = yes.
+trace_level_allows_port_suppression(decl) = no.
+trace_level_allows_port_suppression(decl_rep) = no.
+
+trace_needs_port(TraceLevel, TraceSuppressItems, Port) = NeedsPort :-
+	(
+		trace_port_category(Port) = Category,
+		list__member(Category,
+			trace_level_port_categories(TraceLevel)),
+		( trace_level_allows_port_suppression(TraceLevel) = yes =>
+			\+ set__member(port(Port), TraceSuppressItems) )
+	->
+		NeedsPort = yes
+	;
+		NeedsPort = no
+	).
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.220
diff -u -r1.220 user_guide.texi
--- doc/user_guide.texi	2000/09/17 09:19:12	1.220
+++ doc/user_guide.texi	2000/09/29 02:42:49
@@ -1440,62 +1440,63 @@
 MCFLAGS-bar = --trace shallow
 @end example
 
- at node Selecting trace events
- at section Selecting trace events
+ at node Tracing and optimization trace events
+ at section Tracing and optimization trace events
 
- at c XXX anybody got a better title for this section?
-
-In preparing a Mercury program for debugging,
-the Mercury compiler provides two options that you can use
-to say that you are not interested in certain kinds of events,
-and that the compiler should therefore not generate code for those events.
-This makes the executable smaller and faster.
-
-The first of these options is @samp{--no-trace-internal}.
-If you specify this when you compile a module,
-you will not get any internal events
-from predicates and functions defined in that module,
-even if the trace level is @samp{deep};
-you will only get external events.
-These are sufficient to tell you what a predicate or function does,
-i.e. what outputs it computes from what inputs.
-They do not tell you how it computed those outputs,
-i.e. what path control took through the predicate or function,
-but that is sometimes of no particular interest.
-In any case, much of the time you can deduce the path
-from the events that result from
-calls made by the predicate or function in question.
-
-The second of these options is @samp{--no-trace-redo},
-which can be specified independently of @samp{--no-trace-internal}.
-If you specify this when you compile a module,
-you will not get any redo events
-from predicates and functions defined in that module.
-If you are not interested in how backtracking arrives
-at a program point where forward execution can resume after a failure,
-this is an entirely reasonable thing to do.
-In any case, with sufficient thought and a memory of previous events
-you can reconstruct the sequence of redo events
-that would normally be present between the fail event
-and the event that represents the resumption of forward execution.
-This sequence has a redo event
-for every call to a procedure that can succeed more than once
-that occurred after the call to the procedure
-in which the resumption event occurs,
-provided that that call has not failed yet,
-and in reverse chronological order.
-
-Normally, when it compiles a module with a trace level other than @samp{none},
-the compiler will include in the module's object file
-information about all the call return sites in that module.
-This information allows the debugger to print stack dumps,
-as well as the values of variables in ancestors of current call.
-However, if you specify the @samp{--no-trace-return} option,
-the compiler will not include this information in the object file,
-reducing its size but losing the above functionality.
-
- at c XXX should we document --stack-trace-higher-order
- at c it has not really been tested yet
+ at c @c XXX anybody got a better title for this section?
+ at c 
+ at c In preparing a Mercury program for debugging,
+ at c the Mercury compiler provides two options that you can use
+ at c to say that you are not interested in certain kinds of events,
+ at c and that the compiler should therefore not generate code for those events.
+ at c This makes the executable smaller and faster.
+ at c 
+ at c The first of these options is @samp{--no-trace-internal}.
+ at c If you specify this when you compile a module,
+ at c you will not get any internal events
+ at c from predicates and functions defined in that module,
+ at c even if the trace level is @samp{deep};
+ at c you will only get external events.
+ at c These are sufficient to tell you what a predicate or function does,
+ at c i.e. what outputs it computes from what inputs.
+ at c They do not tell you how it computed those outputs,
+ at c i.e. what path control took through the predicate or function,
+ at c but that is sometimes of no particular interest.
+ at c In any case, much of the time you can deduce the path
+ at c from the events that result from
+ at c calls made by the predicate or function in question.
+ at c 
+ at c The second of these options is @samp{--no-trace-redo},
+ at c which can be specified independently of @samp{--no-trace-internal}.
+ at c If you specify this when you compile a module,
+ at c you will not get any redo events
+ at c from predicates and functions defined in that module.
+ at c If you are not interested in how backtracking arrives
+ at c at a program point where forward execution can resume after a failure,
+ at c this is an entirely reasonable thing to do.
+ at c In any case, with sufficient thought and a memory of previous events
+ at c you can reconstruct the sequence of redo events
+ at c that would normally be present between the fail event
+ at c and the event that represents the resumption of forward execution.
+ at c This sequence has a redo event
+ at c for every call to a procedure that can succeed more than once
+ at c that occurred after the call to the procedure
+ at c in which the resumption event occurs,
+ at c provided that that call has not failed yet,
+ at c and in reverse chronological order.
+ at c 
+ at c Normally, when it compiles a module
+ at c with a trace level other than @samp{none},
+ at c the compiler will include in the module's object file
+ at c information about all the call return sites in that module.
+ at c This information allows the debugger to print stack dumps,
+ at c as well as the values of variables in ancestors of current call.
+ at c However, if you specify the @samp{--no-trace-return} option,
+ at c the compiler will not include this information in the object file,
+ at c reducing its size but losing the above functionality.
+ at c 
+ at c @c XXX should we document --stack-trace-higher-order
+ at c @c it has not really been tested yet
 
 By default, all trace levels other than @samp{none}
 turn off all compiler optimizations
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/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/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/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
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 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
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/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/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 trax
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list