[m-rev.] for review: hidden events

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Aug 30 14:08:55 AEST 2002


For review by anyone.

The need for hidden events was documented by the recent discussion in
mercury-developers.

Zoltan.

Estimated hours taken: 1

Implement a flag that can be used by the compiler to signal to the debugger
that some events should be hidden from the user. The flag is not used yet.

compiler/continuation_info.m:
compiler/layout.m:
	Make room for the flag in the data structures storing information about
	events.

compiler/layout_out.m:
	Output the flag in label layouts.

runtime/mercury_stack_layout.h:
	Define a field for the flag in label layouts.

compiler/trace.m:
	Specify "no" as the value of the hidden flag, for now. Later, when we
	add hidden events, we will specify "yes" for them.

compiler/code_info.m:
compiler/stack_layout.m:
	Pass on the value of the hidden flag.

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/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.270
diff -u -r1.270 code_info.m
--- compiler/code_info.m	2002/08/18 06:40:16	1.270
+++ compiler/code_info.m	2002/08/29 13:19:26
@@ -670,8 +670,8 @@
 :- mode code_info__succip_is_used(in, out) is det.
 
 :- pred code_info__add_trace_layout_for_label(label, term__context,
-	trace_port, goal_path, layout_label_info, code_info, code_info).
-:- mode code_info__add_trace_layout_for_label(in, in, in,in,  in, in, out)
+	trace_port, bool, goal_path, layout_label_info, code_info, code_info).
+:- mode code_info__add_trace_layout_for_label(in, in, in, in, in, in, in, out)
 	is det.
 
 :- pred code_info__get_cur_proc_label(proc_label, code_info, code_info).
@@ -897,9 +897,11 @@
 code_info__succip_is_used -->
 	code_info__set_succip_used(yes).
 
-code_info__add_trace_layout_for_label(Label, Context, Port, Path, Layout) -->
+code_info__add_trace_layout_for_label(Label, Context, Port, IsHidden, Path,
+		Layout) -->
 	code_info__get_layout_info(Internals0),
-	{ Exec = yes(trace_port_layout_info(Context, Port, Path, Layout)) },
+	{ Exec = yes(trace_port_layout_info(Context, Port, IsHidden,
+		Path, Layout)) },
 	{ map__search(Internals0, Label, Internal0) ->
 		Internal0 = internal_layout_info(Exec0, Resume, Return),
 		( Exec0 = no ->
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.43
diff -u -r1.43 continuation_info.m
--- compiler/continuation_info.m	2002/07/30 08:25:00	1.43
+++ compiler/continuation_info.m	2002/08/29 10:58:54
@@ -215,10 +215,11 @@
 
 :- type trace_port_layout_info
 	--->	trace_port_layout_info(
-			prog_context,
-			trace_port,
-			goal_path,
-			layout_label_info
+			port_context	:: prog_context,
+			port_type	:: trace_port,
+			port_is_hidden	:: bool,
+			port_path	:: goal_path,
+			port_label	:: layout_label_info
 		).
 
 :- type return_layout_info
Index: compiler/layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout.m,v
retrieving revision 1.7
diff -u -r1.7 layout.m
--- compiler/layout.m	2002/05/16 13:14:47	1.7
+++ compiler/layout.m	2002/08/29 13:20:07
@@ -41,6 +41,7 @@
 			label			:: label,
 			proc_layout_name	:: layout_name,
 			maybe_port		:: maybe(trace_port),
+			maybe_is_hidden		:: maybe(bool),
 			maybe_goal_path		:: maybe(int), % offset
 			maybe_var_info		:: maybe(label_var_info)
 		)
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.14
diff -u -r1.14 layout_out.m
--- compiler/layout_out.m	2002/08/07 03:18:42	1.14
+++ compiler/layout_out.m	2002/08/29 17:32:32
@@ -83,9 +83,11 @@
 :- import_module int, char, string, require, std_util, list.
 
 output_layout_data_defn(label_layout_data(Label, ProcLayoutAddr,
-		MaybePort, MaybeGoalPath, MaybeVarInfo), DeclSet0, DeclSet) -->
+		MaybePort, MaybeIsHidden, MaybeGoalPath, MaybeVarInfo),
+		DeclSet0, DeclSet) -->
 	output_label_layout_data_defn(Label, ProcLayoutAddr,
-		MaybePort, MaybeGoalPath, MaybeVarInfo, DeclSet0, DeclSet).
+		MaybePort, MaybeIsHidden, MaybeGoalPath, MaybeVarInfo,
+		DeclSet0, DeclSet).
 output_layout_data_defn(proc_layout_data(ProcLabel, Traversal, MaybeRest),
 		DeclSet0, DeclSet) -->
 	output_proc_layout_data_defn(ProcLabel, Traversal, MaybeRest,
@@ -134,9 +136,9 @@
 
 :- pred extract_layout_name(layout_data::in, layout_name::out) is det.
 
-extract_layout_name(label_layout_data(Label, _, _, _, yes(_)), LayoutName) :-
+extract_layout_name(label_layout_data(Label, _, _, _, _, yes(_)), LayoutName) :-
 	LayoutName = label_layout(Label, label_has_var_info).
-extract_layout_name(label_layout_data(Label, _, _, _, no), LayoutName) :-
+extract_layout_name(label_layout_data(Label, _, _, _, _, no), LayoutName) :-
 	LayoutName = label_layout(Label, label_has_no_var_info).
 extract_layout_name(proc_layout_data(ProcLabel, _, MaybeRest), LayoutName) :-
 	Kind = maybe_proc_layout_and_exec_trace_kind(MaybeRest, ProcLabel),
@@ -395,11 +397,12 @@
 %-----------------------------------------------------------------------------%
 
 :- pred output_label_layout_data_defn(label::in, layout_name::in,
-	maybe(trace_port)::in, maybe(int)::in, maybe(label_var_info)::in,
-	decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
+	maybe(trace_port)::in, maybe(bool)::in, maybe(int)::in,
+	maybe(label_var_info)::in, decl_set::in, decl_set::out,
+	io__state::di, io__state::uo) is det.
 
-output_label_layout_data_defn(Label, ProcLayoutAddr, MaybePort, MaybeGoalPath,
-		MaybeVarInfo, DeclSet0, DeclSet) -->
+output_label_layout_data_defn(Label, ProcLayoutAddr, MaybePort, MaybeIsHidden,
+		MaybeGoalPath, MaybeVarInfo, DeclSet0, DeclSet) -->
 	output_layout_decl(ProcLayoutAddr, DeclSet0, DeclSet1),
 	(
 		{ MaybeVarInfo = yes(VarInfo0) },
@@ -430,6 +433,18 @@
 	;
 		{ MaybePort = no },
 		io__write_string("MR_PORT_NONE")
+	),
+	io__write_string(",\n\t"),
+	(
+		{ MaybeIsHidden = yes(yes) },
+		io__write_string("MR_TRUE")
+	;
+		{ MaybeIsHidden = yes(no) },
+		io__write_string("MR_FALSE")
+	;
+		{ MaybeIsHidden = no },
+		% the value we write here shouldn't matter
+		io__write_string("MR_FALSE")
 	),
 	io__write_string(",\n\t"),
 	(
Index: compiler/llds_common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_common.m,v
retrieving revision 1.43
diff -u -r1.43 llds_common.m
--- compiler/llds_common.m	2002/05/16 13:14:47	1.43
+++ compiler/llds_common.m	2002/08/29 13:20:21
@@ -145,7 +145,7 @@
 
 llds_common__process_layout_data(LayoutData0, LayoutData, Info0, Info) :-
 	LayoutData0 = label_layout_data(Label, ProcLayoutName,
-		MaybePort, MaybeGoalPath, MaybeVarInfo0),
+		MaybePort, MaybeIsHidden, MaybeGoalPath, MaybeVarInfo0),
 	(
 		MaybeVarInfo0 = no,
 		LayoutData = LayoutData0,
@@ -164,7 +164,7 @@
 			LocnsTypes, VarNums, TypeParams),
 		MaybeVarInfo = yes(VarInfo),
 		LayoutData = label_layout_data(Label, ProcLayoutName,
-			MaybePort, MaybeGoalPath, MaybeVarInfo)
+			MaybePort, MaybeIsHidden, MaybeGoalPath, MaybeVarInfo)
 	).
 llds_common__process_layout_data(LayoutData0, LayoutData, Info0, Info) :-
 	LayoutData0 = proc_layout_data(ProcLabel, Traversal, MaybeRest0),
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.70
diff -u -r1.70 stack_layout.m
--- compiler/stack_layout.m	2002/07/30 08:25:10	1.70
+++ compiler/stack_layout.m	2002/08/29 13:22:26
@@ -321,7 +321,7 @@
 		stack_layout__update_label_table_2(Label, LabelVars,
 			Context, IsReturn, LabelTables0, LabelTables)
 	;
-		Port = yes(trace_port_layout_info(Context, _, _, _)),
+		Port = yes(trace_port_layout_info(Context, _, _, _, _)),
 		stack_layout__context_is_valid(Context)
 	->
 		stack_layout__update_label_table_2(Label, LabelVars,
@@ -597,7 +597,7 @@
 		{ set__init(TraceLiveVarSet) },
 		{ map__init(TraceTypeVarMap) }
 	;
-		{ Trace = yes(trace_port_layout_info(_, _, _, TraceLayout)) },
+		{ Trace = yes(trace_port_layout_info(_,_,_,_, TraceLayout)) },
 		{ TraceLayout = layout_label_info(TraceLiveVarSet,
 			TraceTypeVarMap) }
 	),
@@ -611,9 +611,11 @@
 			ResumeTypeVarMap)
 	},
 	(
-		{ Trace = yes(trace_port_layout_info(_, Port, GoalPath, _)) },
+		{ Trace = yes(trace_port_layout_info(_, Port, IsHidden,
+			GoalPath, _)) },
 		{ Return = no },
 		{ MaybePort = yes(Port) },
+		{ MaybeIsHidden = yes(IsHidden) },
 		{ trace__path_to_string(GoalPath, GoalPathStr) },
 		stack_layout__lookup_string_in_table(GoalPathStr, GoalPathNum),
 		{ MaybeGoalPath = yes(GoalPathNum) }
@@ -625,6 +627,7 @@
 			% (Since exception events are interface events,
 			% the goal path field is not meaningful then.)
 		{ MaybePort = yes(exception) },
+		{ MaybeIsHidden = yes(no) },
 			% We only ever use the goal path fields of these
 			% layout structures when we process "fail" commands
 			% in the debugger.
@@ -650,6 +653,7 @@
 		{ Trace = no },
 		{ Return = no },
 		{ MaybePort = no },
+		{ MaybeIsHidden = no },
 		{ MaybeGoalPath = no }
 	;
 		{ Trace = yes(_) },
@@ -708,7 +712,7 @@
 	),
 
 	{ LayoutData = label_layout_data(Label, ProcLayoutName,
-		MaybePort, MaybeGoalPath, MaybeVarInfo) },
+		MaybePort, MaybeIsHidden, MaybeGoalPath, MaybeVarInfo) },
 	{ CData = layout_data(LayoutData) },
 	{ LayoutName = label_layout(Label, LabelVars) },
 	stack_layout__add_internal_layout_data(CData, Label, LayoutName).
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.55
diff -u -r1.55 trace.m
--- compiler/trace.m	2002/08/18 06:40:22	1.55
+++ compiler/trace.m	2002/08/29 13:21:01
@@ -825,7 +825,7 @@
 		"\t\t\t(const MR_Label_Layout *)\n",
 		"\t\t\t&", LabelStr, ");\n"],
 		CallStmt) },
-	code_info__add_trace_layout_for_label(Label, Context, Port, Path,
+	code_info__add_trace_layout_for_label(Label, Context, Port, no, Path,
 		LayoutLabelInfo),
 	(
 		{ Port = fail },
@@ -842,7 +842,7 @@
 		% for the redo event, whose layout information is filled in
 		% when we get to the fail event.
 		code_info__add_trace_layout_for_label(RedoLabel, Context, redo,
-			Path, LayoutLabelInfo)
+			no, Path, LayoutLabelInfo)
 	;
 		[]
 	),
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 gcc
cvs diff: Diffing gcc/mercury
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
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.61
diff -u -r1.61 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	2002/07/26 04:20:12	1.61
+++ runtime/mercury_stack_layout.h	2002/08/29 10:24:38
@@ -241,6 +241,13 @@
 ** with events, this will be the port of the event. For return labels,
 ** this port will be exception (since exception events are associated with
 ** the return from the call that raised the exception).
+** 
+** The MR_sll_hidden field contains a boolean which is meaningful only if the
+** label corresponds to an execution tracing event. It will be true if the
+** event should have no effects that the user can see (no message printed, no
+** increment of the event number etc), and false otherwise. Hidden events
+** are sometimes needed by the declarative debugger to provide the proper
+** context for other events.
 **
 ** The MR_sll_goal_path field contains an offset into the module-wide string
 ** table, leading to a string that gives the goal path associated with the
@@ -330,7 +337,8 @@
 
 typedef	struct MR_Label_Layout_Struct {
 	const MR_Proc_Layout		*MR_sll_entry;
-	MR_int_least16_t		MR_sll_port;
+	MR_int_least8_t			MR_sll_port;
+	MR_int_least8_t			MR_sll_hidden;
 	MR_int_least16_t		MR_sll_goal_path;
 	MR_Integer			MR_sll_var_count; /* >= 0 */
 	const void			*MR_sll_locns_types;
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/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