[m-rev.] diff: shadow tracing uci predicates

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon May 24 08:17:48 AEST 2004


Reduce the sizes of .c and .o files in debug grades by 8%.

Add to mdb the capability of putting breakpoints on unify, compare and index
predicates.

compiler/code_gen.m:
	Since compiler-generated unify, index and compare pred can be presumed
	to be correct, compile them with shallow tracing instead of deep
	tracing even if the user asks for deep tracing of the rest of the
	module. This saves disk space, compile time and run time.

	Move the code for setting the trace level to generate_proc_code,
	where it is executed whether we generate code by predicates or by
	phases.

compiler/trace_params.m:
	Provide a function for use by code_gen.m.

	Consider unify and compare predicates to behave as if their address
	were taken, since they may be called from builtin.unify or
	builtin.compare.

compiler/jumpopt.m:
	Do not replace jumps with the block being jumped to if the block
	contains an instruction that represents a call to the debugger.
	In such cases, the jump is a minor cost in runtime compared to the
	call, and the locality benefit from not increasing the code size is
	quite likely to exceed that cost.

compiler/llds.m:
	Add field names to pragma_c instructions to make the change to jumpopt
	easier.

tests/debugger/uci.{inp,exp}:
	Update this test case. An update is required since we now generate
	fewer events from unify and compare preds due to their now being
	shallow traced.

	To make this the update easier, use the new capability of putting
	breakpoints on unify and compare predicates.

trace/mercury_trace_tables.[ch]:
	Expand procedure specifications to allow the specification of unify,
	compare and index predicates, and expand the function that checks for
	matches between a procedure layout and a procedure specification
	accordingly.

	Fix two instances of a bug: if a procedure specification has no name,
	represent it as NULL, not as a non-NULL pointer to a null character,
	since the match function expects only the former.

doc/user_guide.texi:
	Document the new definition of procedure specifications.

NEWS:
	Mention the new definition of procedure specifications, and expand
	on some previous additions to the debugger.

runtime/mercury_stack_trace.c:
	Allow mdb breakpoint specifications on uci predicates to be saved.

	Factor out some common data structure accesses.

runtime/mercury_proc_id.h:
	Change the name of a macro from MR_PROC_ID_COMPILER_GENERATED to
	MR_PROC_ID_IS_UCI, for consistency with other names dealing with
	unify, compare and index predicates.

runtime/*.[ch]:
trace/*.[ch]:
	Conform to the change in mercury_proc_id.h.

Zoltan.

cvs diff: Diffing .
Index: NEWS
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/NEWS,v
retrieving revision 1.333
diff -u -b -r1.333 NEWS
--- NEWS	20 May 2004 06:00:07 -0000	1.333
+++ NEWS	23 May 2004 09:32:10 -0000
@@ -39,6 +39,8 @@
 
 Changes to the Mercury debugger:
 * Users can now limit the output from stack traces.
+* Users can now put breakpoints on unify and compare predicates.
+* Users can now save runtime values to files.
 
 Changes to the compiler back-ends:
 * The .NET CLR back-end now bootstraps.
@@ -286,7 +288,20 @@
 
 Changes to the Mercury debugger:
 
-* Nothing yet.
+* Users can now limit the output from stack traces.
+
+  The mdb command `stack' now takes an optional integer argument that
+  specifies the maximum number of stack frames to be printed.
+
+* Users can now put breakpoints on unify and compare predicates.
+
+  The syntax for procedure specifications now has provision for specifying
+  unify and compare predicates.
+
+* Users can now save runtime values to files.
+
+  We've added a new mdb command, `save_to_file', that saves a specified term
+  to a specified file.
 
 Changes to the compiler back-ends:
 
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.124
diff -u -b -r1.124 code_gen.m
--- compiler/code_gen.m	19 May 2004 03:59:05 -0000	1.124
+++ compiler/code_gen.m	22 May 2004 21:54:29 -0000
@@ -146,8 +146,8 @@
 	% by mercury_compile__backend_pass_by_preds, so modifications here may
 	% also need to be repeated there.
 
-generate_maybe_pred_code(ModuleInfo0, !GlobalData, PredId, Predicates, !IO) :-
-	module_info_preds(ModuleInfo0, PredInfos),
+generate_maybe_pred_code(ModuleInfo, !GlobalData, PredId, Predicates, !IO) :-
+	module_info_preds(ModuleInfo, PredInfos),
 		% get the pred_info structure for this predicate
 	map__lookup(PredInfos, PredId, PredInfo),
 		% extract a list of all the procedure ids for this
@@ -160,39 +160,21 @@
 	->
 		Predicates = []
 	;
-		module_info_globals(ModuleInfo0, Globals0),
-		globals__lookup_bool_option(Globals0, very_verbose,
+		module_info_globals(ModuleInfo, Globals),
+		globals__lookup_bool_option(Globals, very_verbose,
 			VeryVerbose),
 		( VeryVerbose = yes ->
 			io__write_string("% Generating code for ", !IO),
-			hlds_out__write_pred_id(ModuleInfo0, PredId, !IO),
+			hlds_out__write_pred_id(ModuleInfo, PredId, !IO),
 			io__write_string("\n", !IO),
-			globals__lookup_bool_option(Globals0,
+			globals__lookup_bool_option(Globals,
 				statistics, Statistics),
 			maybe_report_stats(Statistics, !IO)
 		;
 			true
 		),
-		(
-			PredModule = pred_info_module(PredInfo),
-			PredName = pred_info_name(PredInfo),
-			PredArity = pred_info_arity(PredInfo),
-			no_type_info_builtin(PredModule, PredName, PredArity)
-		->
-				% These predicates should never be traced,
-				% since they do not obey typeinfo_liveness.
-				% Since they may be opt_imported into other
-				% modules, we must switch off the tracing
-				% of such preds on a pred-by-pred basis.
-			globals__set_trace_level_none(Globals0, Globals1),
-			module_info_set_globals(Globals1,
-				ModuleInfo0, ModuleInfo1),
-			generate_pred_code(ModuleInfo1, !GlobalData,
-				PredId, PredInfo, ProcIds, Predicates)
-		;
-			generate_pred_code(ModuleInfo0, !GlobalData,
+		generate_pred_code(ModuleInfo, !GlobalData,
 				PredId, PredInfo, ProcIds, Predicates)
-		)
 	).
 
 	% Translate a HLDS predicate to LLDS.
@@ -242,8 +224,13 @@
 
 %---------------------------------------------------------------------------%
 
-generate_proc_code(PredInfo, ProcInfo, ProcId, PredId, ModuleInfo,
+generate_proc_code(PredInfo, ProcInfo, ProcId, PredId, ModuleInfo0,
 		!GlobalData, Proc) :-
+
+		% The module_info with a modified trace level is discarded
+		% on return from generate_proc_code.
+	maybe_set_trace_level(PredInfo, ModuleInfo0, ModuleInfo),
+
 	proc_info_interface_determinism(ProcInfo, Detism),
 	proc_info_interface_code_model(ProcInfo, CodeModel),
 	proc_info_goal(ProcInfo, Goal),
@@ -425,6 +412,37 @@
 			MayAlterRtti)
 	).
 
+:- pred maybe_set_trace_level(pred_info::in,
+	module_info::in, module_info::out) is det.
+
+maybe_set_trace_level(PredInfo, !ModuleInfo) :-
+	module_info_globals(!.ModuleInfo, Globals0),
+	(
+		PredModule = pred_info_module(PredInfo),
+		PredName = pred_info_name(PredInfo),
+		PredArity = pred_info_arity(PredInfo),
+		no_type_info_builtin(PredModule, PredName, PredArity)
+	->
+			% These predicates should never be traced,
+			% since they do not obey typeinfo_liveness.
+			% Since they may be opt_imported into other
+			% modules, we must switch off the tracing
+			% of such preds on a pred-by-pred basis.
+		globals__set_trace_level_none(Globals0, Globals1),
+		module_info_set_globals(Globals1, !ModuleInfo)
+	;
+		pred_info_get_maybe_special_pred(PredInfo, yes(_)),
+		globals__get_trace_level(Globals0, TraceLevel),
+		UC_TraceLevel =
+			trace_level_for_unify_compare(TraceLevel)
+	->
+		globals__set_trace_level(UC_TraceLevel,
+			Globals0, Globals1),
+		module_info_set_globals(Globals1, !ModuleInfo)
+	;
+		true
+	).
+
 :- func generate_deep_prof_info(proc_info, deep_profile_proc_info)
 	= proc_layout_proc_static.
 
@@ -1405,19 +1423,18 @@
 		"\t\tMR_GOTO(return_addr);\n"
 		], BytecodeCall),
 
-	BytecodeInstructions = [
-		label(Entry) - "Procedure entry point",
-
-		pragma_c(
-		[],
-		[
+	BytecodeInstructionsComponents = [
 		pragma_c_raw_code("\t{\n", live_lvals_info(set__init)),
 		pragma_c_raw_code(CallStruct, live_lvals_info(set__init)),
 		pragma_c_raw_code(BytecodeCall, no_live_lvals_info),
 		pragma_c_raw_code("\t}\n", live_lvals_info(set__init))
 		],
-		may_call_mercury, no, no, no, no, no
-		) - "Entry stub"
+
+	BytecodeInstructions = [
+		label(Entry) - "Procedure entry point",
+		pragma_c([], BytecodeInstructionsComponents,
+			may_call_mercury, no, no, no, no, no)
+			- "Entry stub"
 	].
 
 %---------------------------------------------------------------------------%
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.143
diff -u -b -r1.143 hlds_pred.m
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.69
diff -u -b -r1.69 jumpopt.m
--- compiler/jumpopt.m	15 Jan 2004 07:35:45 -0000	1.69
+++ compiler/jumpopt.m	23 May 2004 17:30:15 -0000
@@ -423,7 +423,8 @@
 			map__search(Instrmap, TargetLabel, TargetInstr),
 			jumpopt__final_dest(Instrmap, TargetLabel, DestLabel,
 				TargetInstr, _DestInstr),
-			map__search(Blockmap, DestLabel, Block)
+			map__search(Blockmap, DestLabel, Block),
+			block_may_be_duplicated(Block) = yes
 		->
 			opt_util__filter_out_labels(Block, FilteredBlock),
 			jumpopt__adjust_livevals(PrevInstr, FilteredBlock,
@@ -633,6 +634,33 @@
 		Fulljumpopt, MayAlterRtti, !CheckedNondetTailCallInfo,
 		Instrs9),
 	list__append(NewInstrs, Instrs9, Instrs).
+
+:- func block_may_be_duplicated(list(instruction)) = bool.
+
+block_may_be_duplicated([]) =  yes.
+block_may_be_duplicated([Uinstr - _ | Instrs]) = BlockMayBeDuplicated :-
+	InstrMayBeDuplicated = instr_may_be_duplicated(Uinstr),
+	(
+		InstrMayBeDuplicated = no,
+		BlockMayBeDuplicated = no
+	;
+		InstrMayBeDuplicated = yes,
+		BlockMayBeDuplicated = block_may_be_duplicated(Instrs)
+	).
+
+:- func instr_may_be_duplicated(instr) = bool.
+
+instr_may_be_duplicated(Instr) = InstrMayBeDuplicated :-
+	( Instr ^ pragma_c_fix_onlylayout = yes(_) ->
+		% This instruction is a trace event. Duplicating it would
+		% increase code size, and may cost more in locality than
+		% the benefit represented by the elimination of the jump.
+		% When debugging is enabled, size is in any case more important
+		% than the last bit of speed.
+		InstrMayBeDuplicated = no
+	;
+		InstrMayBeDuplicated = yes
+	).
 
 :- func redirect_comment(string) = string.
 
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.303
diff -u -b -r1.303 llds.m
--- compiler/llds.m	20 May 2004 22:04:43 -0000	1.303
+++ compiler/llds.m	22 May 2004 21:52:16 -0000
@@ -404,9 +404,16 @@
 	;	decr_sp(int)
 			% Decrement the det stack pointer.
 
-	;	pragma_c(list(pragma_c_decl), list(pragma_c_component),
-				may_call_mercury, maybe(label), maybe(label),
-				maybe(label), maybe(label), bool)
+	;	pragma_c(
+			pragma_c_decls		:: list(pragma_c_decl),
+			pragma_c_components	:: list(pragma_c_component),
+			pragma_c_may_call_merc	:: may_call_mercury,
+			pragma_c_fix_nolayout	:: maybe(label),
+			pragma_c_fix_layout	:: maybe(label),
+			pragma_c_fix_onlylayout	:: maybe(label),
+			pragma_c_nofix		:: maybe(label),
+			pragma_c_stack_slot_ref	:: bool
+		)
 			% The first argument says what local variable
 			% declarations are required for the following
 			% components, which in turn can specify how
Index: compiler/trace_params.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_params.m,v
retrieving revision 1.16
diff -u -b -r1.16 trace_params.m
--- compiler/trace_params.m	19 Mar 2004 10:19:26 -0000	1.16
+++ compiler/trace_params.m	23 May 2004 05:52:10 -0000
@@ -111,6 +111,10 @@
 
 :- func trace_level_none = trace_level.
 
+	% Given a trace level for a module, return the trace level we should
+	% use for compiler-generated unify, index and compare predicates.
+:- func trace_level_for_unify_compare(trace_level) = trace_level.
+
 	% This is used to represent the trace level in the module layout.
 :- func trace_level_rep(trace_level) = string.
 
@@ -118,6 +122,8 @@
 
 :- implementation.
 
+:- import_module hlds__special_pred.
+
 :- import_module int, char, string, list, set.
 
 :- type trace_level
@@ -136,6 +142,11 @@
 
 trace_level_none = none.
 
+trace_level_for_unify_compare(none) = none.
+trace_level_for_unify_compare(shallow) = shallow.
+trace_level_for_unify_compare(deep) = shallow.
+trace_level_for_unify_compare(decl_rep) = shallow.
+
 convert_trace_level("minimum", no,  no,  yes(none)).
 convert_trace_level("minimum", yes, no,  yes(shallow)).
 convert_trace_level("minimum", _,   yes, yes(deep)).
@@ -154,7 +165,17 @@
 		TraceLevel = shallow,
 		pred_info_import_status(PredInfo, Status),
 		status_is_exported(Status, no),
-		proc_info_is_address_taken(ProcInfo, address_is_not_taken)
+		proc_info_is_address_taken(ProcInfo, address_is_not_taken),
+		pred_info_get_maybe_special_pred(PredInfo, MaybeSpecialPred),
+			% Unify and compare predicates can be called from
+			% the generic unify and compare predicates in
+			% builtin.m, so they can be called from outside this
+			% module even if they don't have their address taken.
+		(
+			MaybeSpecialPred = no
+		;
+			MaybeSpecialPred = yes(index - _)
+		)
 	->
 		EffTraceLevel = none
 	;
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.385
diff -u -b -r1.385 user_guide.texi
--- doc/user_guide.texi	13 May 2004 08:50:29 -0000	1.385
+++ doc/user_guide.texi	23 May 2004 09:51:51 -0000
@@ -1984,15 +1984,38 @@
 @cindex debugger procedure specification
 Some debugger commands, e.g.@: @samp{break},
 require a parameter that specifies a procedure.
-Such a procedure specification has
+The procedure may or may not be
+a compiler-generated unify, compare or index procedure.
+If it is, the procedure specification has
+the following components in the following order:
+ at itemize @bullet
+ at item
+An optional prefix of the form @samp{unif*}, @samp{comp*}, or @samp{indx*}
+that specifies whether the procedure belongs
+to an unify, compare or index predicate.
+ at item
+An optional prefix of the form @samp{@var{module}:}, @samp{@var{module}.}
+or @samp{@var{module}__} that specifies the name of the module that defines
+the predicate or function to which the procedure belongs.
+ at item
+The name of the type constructor.
+ at item
+An optional suffix of the form @samp{/@var{arity}}
+that specifies the arity of the type constructor.
+ at item
+An optional suffix of the form @samp{- at var{modenum}}
+that specifies the mode number of the procedure
+within the predicate or function to which the procedure belongs.
+ at end itemize
+For other procedures, the procedure specification has
 the following components in the following order:
 @itemize @bullet
 @item
 An optional prefix of the form @samp{pred*} or @samp{func*}
 that specifies whether the procedure belongs to a predicate or a function.
 @item
-An optional prefix of the form @samp{@var{module}:} or @samp{@var{module}__}
-that specifies the name of the module that defines
+An optional prefix of the form @samp{@var{module}:}, @samp{@var{module}.}
+or @samp{@var{module}__} that specifies the name of the module that defines
 the predicate or function to which the procedure belongs.
 @item
 The name of the predicate or function to which the procedure belongs.
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/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/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_debug.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_debug.c,v
retrieving revision 1.21
diff -u -b -r1.21 mercury_debug.c
--- runtime/mercury_debug.c	19 May 2004 03:59:43 -0000	1.21
+++ runtime/mercury_debug.c	23 May 2004 07:21:05 -0000
@@ -958,7 +958,7 @@
 			ps = pl->MR_sle_proc_static;
 			fprintf(fp, ", pl: %p, ps: %p\n", pl, ps);
 			proc_id = &pl->MR_sle_proc_id;
-			if (MR_PROC_ID_COMPILER_GENERATED(*proc_id)) {
+			if (MR_PROC_ID_IS_UCI(*proc_id)) {
 				fprintf(fp, "  %s:%s %s/%d-%d\n  ",
 					proc_id->MR_proc_uci.
 						MR_uci_type_module,
Index: runtime/mercury_deep_profiling.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_profiling.c,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_deep_profiling.c
--- runtime/mercury_deep_profiling.c	20 May 2004 22:53:31 -0000	1.14
+++ runtime/mercury_deep_profiling.c	23 May 2004 07:21:08 -0000
@@ -665,7 +665,7 @@
 	MR_write_ptr(fp, kind_ps, ps_id);
 
 	procid = &proc_layout->MR_sle_proc_id;
-	if (MR_PROC_ID_COMPILER_GENERATED(*procid)) {
+	if (MR_PROC_ID_IS_UCI(*procid)) {
 #ifdef MR_DEEP_PROFILING_DEBUG
 		if (debug_fp != NULL) {
 			fprintf(debug_fp, "  compiler %s/%s/%s/%s/%d/%d\n",
Index: runtime/mercury_ho_call.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.71
diff -u -b -r1.71 mercury_ho_call.c
--- runtime/mercury_ho_call.c	19 May 2004 03:59:47 -0000	1.71
+++ runtime/mercury_ho_call.c	23 May 2004 07:21:14 -0000
@@ -850,7 +850,7 @@
 	y_proc_id = &y_layout->MR_closure_id->MR_closure_proc_id;
 
 	if (x_proc_id != y_proc_id) {
-		if (MR_PROC_ID_COMPILER_GENERATED(*x_proc_id)) {
+		if (MR_PROC_ID_IS_UCI(*x_proc_id)) {
 			x_module_name = x_proc_id->MR_proc_uci.
 						MR_uci_def_module;
 			x_pred_name = x_proc_id->MR_proc_uci.MR_uci_pred_name;
@@ -859,7 +859,7 @@
 						MR_user_decl_module;
 			x_pred_name = x_proc_id->MR_proc_user.MR_user_name;
 		}
-		if (MR_PROC_ID_COMPILER_GENERATED(*y_proc_id)) {
+		if (MR_PROC_ID_IS_UCI(*y_proc_id)) {
 			y_module_name = y_proc_id->MR_proc_uci.
 						MR_uci_def_module;
 			y_pred_name = y_proc_id->MR_proc_uci.MR_uci_pred_name;
Index: runtime/mercury_layout_util.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_layout_util.c,v
retrieving revision 1.34
diff -u -b -r1.34 mercury_layout_util.c
--- runtime/mercury_layout_util.c	19 May 2004 03:59:48 -0000	1.34
+++ runtime/mercury_layout_util.c	23 May 2004 07:21:20 -0000
@@ -862,7 +862,7 @@
 MR_generate_proc_name_from_layout(const MR_Proc_Layout *proc_layout,
 	MR_ConstString *proc_name_ptr, int *arity_ptr, MR_Word *is_func_ptr)
 {
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(proc_layout)) {
+	if (MR_PROC_LAYOUT_IS_UCI(proc_layout)) {
 		*proc_name_ptr = proc_layout->MR_sle_proc_id.
 			MR_proc_uci.MR_uci_pred_name;
 		if (MR_streq(*proc_name_ptr, "__Unify__")) {
@@ -895,7 +895,7 @@
 MR_proc_id_arity_addedargs_predfunc(const MR_Proc_Layout *proc, int *arity_ptr,
 	int *num_added_args_ptr, MR_PredFunc *pred_or_func_ptr)
 {
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(proc)) {
+	if (MR_PROC_LAYOUT_IS_UCI(proc)) {
 		/*
 		** MR_comp_type_arity is the arity of the type constructor.
 		** Each argument of the type constructor adds a typeinfo
Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.31
diff -u -b -r1.31 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h	19 May 2004 03:59:49 -0000	1.31
+++ runtime/mercury_ml_expand_body.h	23 May 2004 07:21:23 -0000
@@ -763,7 +763,7 @@
                 proc_id = &closure_layout->MR_closure_id->MR_closure_proc_id;
                 if (proc_id->MR_proc_user.MR_user_arity < 0) {
                     name = "dynlink_proc";  /* XXX */
-                } else if (MR_PROC_ID_COMPILER_GENERATED(*proc_id)) {
+                } else if (MR_PROC_ID_IS_UCI(*proc_id)) {
                     name = proc_id->MR_proc_uci.MR_uci_pred_name;
                 } else {
                     name = proc_id->MR_proc_user.MR_user_name;
Index: runtime/mercury_proc_id.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_proc_id.h,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_proc_id.h
--- runtime/mercury_proc_id.h	19 May 2004 03:59:50 -0000	1.3
+++ runtime/mercury_proc_id.h	23 May 2004 07:23:40 -0000
@@ -28,9 +28,8 @@
 ** procedures, while the other alternative identifies automatically generated
 ** unification, comparison and index procedures. The meanings of the fields
 ** in both forms are the same as in procedure labels. The runtime system
-** can figure out which form is present by using the macro
-** MR_PROC_LAYOUT_COMPILER_GENERATED, which will return true only if
-** the procedure is of the second type.
+** can figure out which form is present by using the macro MR_PROC_ID_IS_UCI,
+** which will return true only if the procedure is of the second type.
 **
 ** The compiler generates MR_User_Proc_Id and MR_UCI_Proc_Id structures
 ** in order to avoid having to initialize the MR_Proc_Id union through the
@@ -64,7 +63,7 @@
 	MR_UCI_Proc_Id		MR_proc_uci;
 };
 
-#define	MR_PROC_ID_COMPILER_GENERATED(proc_id)				\
+#define	MR_PROC_ID_IS_UCI(proc_id)					\
 	((MR_Unsigned) (proc_id).MR_proc_user.MR_user_pred_or_func	\
 	 	> MR_FUNCTION)
 
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.80
diff -u -b -r1.80 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	20 May 2004 22:53:32 -0000	1.80
+++ runtime/mercury_stack_layout.h	23 May 2004 07:21:35 -0000
@@ -664,8 +664,8 @@
 	MR_Determinism		MR_trav_detism;
 } MR_Stack_Traversal;
 
-#define	MR_PROC_LAYOUT_COMPILER_GENERATED(entry)			\
-	MR_PROC_ID_COMPILER_GENERATED(entry->MR_sle_proc_id)
+#define	MR_PROC_LAYOUT_IS_UCI(entry)			\
+	MR_PROC_ID_IS_UCI(entry->MR_sle_proc_id)
 
 /*
 ** The MR_Exec_Trace structure contains the following fields.
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.63
diff -u -b -r1.63 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	19 May 2004 03:59:51 -0000	1.63
+++ runtime/mercury_stack_trace.c	23 May 2004 08:31:51 -0000
@@ -1251,32 +1251,52 @@
 static void
 MR_print_proc_id_internal(FILE *fp, const MR_Proc_Layout *entry, MR_bool spec)
 {
+    const MR_User_Proc_Id *user;
+    const MR_UCI_Proc_Id  *uci;
+
     if (! MR_PROC_LAYOUT_HAS_PROC_ID(entry)) {
         MR_fatal_error("cannot print procedure id without layout");
     }
 
-    if (MR_PROC_LAYOUT_COMPILER_GENERATED(entry)) {
+    if (MR_PROC_LAYOUT_IS_UCI(entry)) {
+        uci = &entry->MR_sle_uci;
+
         if (spec) {
-            MR_fatal_error("cannot generate specifications "
-                "for compiler generated procedures");
+            if (MR_streq(uci->MR_uci_pred_name, "__Unify__")) {
+                fprintf(fp, "unif*");
+            } else if (MR_streq(uci->MR_uci_pred_name, "__Compare__")) {
+                fprintf(fp, "comp*");
+            } else if (MR_streq(uci->MR_uci_pred_name, "__Index__")) {
+                fprintf(fp, "indx*");
+            } else {
+                MR_fatal_error("uci procedure is not unify, compare or index");
         }
 
+            fprintf(fp, "%s.%s/%ld-%ld",
+                uci->MR_uci_type_module,
+                uci->MR_uci_type_name,
+                (long) uci->MR_uci_type_arity,
+                (long) uci->MR_uci_mode);
+        } else {
         fprintf(fp, "%s for %s.%s/%ld-%ld",
-            entry->MR_sle_uci.MR_uci_pred_name,
-            entry->MR_sle_uci.MR_uci_type_module,
-            entry->MR_sle_uci.MR_uci_type_name,
-            (long) entry->MR_sle_uci.MR_uci_type_arity,
-            (long) entry->MR_sle_uci.MR_uci_mode);
+                uci->MR_uci_pred_name,
+                uci->MR_uci_type_module,
+                uci->MR_uci_type_name,
+                (long) uci->MR_uci_type_arity,
+                (long) uci->MR_uci_mode);
+        }
 
-        if (strcmp(entry->MR_sle_uci.MR_uci_type_module,
-            entry->MR_sle_uci.MR_uci_def_module) != 0)
+        if (strcmp(uci->MR_uci_type_module,
+            uci->MR_uci_def_module) != 0)
         {
-            fprintf(fp, " {%s}", entry->MR_sle_uci.MR_uci_def_module);
+            fprintf(fp, " {%s}", uci->MR_uci_def_module);
         }
     } else {
-        if (entry->MR_sle_user.MR_user_pred_or_func == MR_PREDICATE) {
+        user = &entry->MR_sle_user;
+
+        if (user->MR_user_pred_or_func == MR_PREDICATE) {
             fprintf(fp, "pred");
-        } else if (entry->MR_sle_user.MR_user_pred_or_func == MR_FUNCTION) {
+        } else if (user->MR_user_pred_or_func == MR_FUNCTION) {
             fprintf(fp, "func");
         } else {
             MR_fatal_error("procedure is not pred or func");
@@ -1289,15 +1309,15 @@
         }
 
         fprintf(fp, "%s.%s/%ld-%ld",
-            entry->MR_sle_user.MR_user_decl_module,
-            entry->MR_sle_user.MR_user_name,
+            user->MR_user_decl_module,
+            user->MR_user_name,
             (long) MR_sle_user_adjusted_arity(entry),
-            (long) entry->MR_sle_user.MR_user_mode);
+            (long) user->MR_user_mode);
 
-        if (!spec && strcmp(entry->MR_sle_user.MR_user_decl_module,
-            entry->MR_sle_user.MR_user_def_module) != 0)
+        if (!spec && strcmp(user->MR_user_decl_module,
+            user->MR_user_def_module) != 0)
         {
-            fprintf(fp, " {%s}", entry->MR_sle_user.MR_user_def_module);
+            fprintf(fp, " {%s}", user->MR_user_def_module);
         }
     }
 
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/uci.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/uci.exp,v
retrieving revision 1.1
diff -u -b -r1.1 uci.exp
--- tests/debugger/uci.exp	2 Apr 2003 23:01:42 -0000	1.1
+++ tests/debugger/uci.exp	23 May 2004 08:24:39 -0000
@@ -4,87 +4,93 @@
 mdb> context none
 Contexts will not be printed.
 mdb> register --quiet
-mdb> goto 16
+mdb> break -A unif*uci.
+ 0: + stop  interface __Unify__ for uci.t4/4-0 (semidet)
+ 1: + stop  interface __Unify__ for uci.t3/3-0 (semidet)
+ 2: + stop  interface __Unify__ for uci.t2/2-0 (semidet)
+ 3: + stop  interface __Unify__ for uci.t1/1-0 (semidet)
+ 4: + stop  interface __Unify__ for uci.t0/0-0 (semidet)
+ 5: + stop  interface __Unify__ for uci.i/3-0 (semidet)
+mdb> break -A comp*uci.
+ 6: + stop  interface __Compare__ for uci.t4/4-0 (det)
+ 7: + stop  interface __Compare__ for uci.t3/3-0 (det)
+ 8: + stop  interface __Compare__ for uci.t2/2-0 (det)
+ 9: + stop  interface __Compare__ for uci.t1/1-0 (det)
+10: + stop  interface __Compare__ for uci.t0/0-0 (det)
+11: + stop  interface __Compare__ for uci.i/3-0 (det)
+mdb> c
       16:      8  3 CALL __Compare__ for uci.t1/1-0 (det)
 mdb> print goal
 __Compare__(_, b1(11), a1(1))
-mdb> goto 19
-      19:      8  3 EXIT __Compare__ for uci.t1/1-0 (det)
+mdb> c
+      17:      8  3 EXIT __Compare__ for uci.t1/1-0 (det)
 mdb> print goal
 __Compare__('>', b1(11), a1(1))
-mdb> goto 28
-      28:     12  3 CALL __Compare__ for uci.t2/2-0 (det)
+mdb> c
+      26:     12  3 CALL __Compare__ for uci.t2/2-0 (det)
 mdb> print goal
 __Compare__(_, a2(1, 2), a2(1, 2))
-mdb> goto 35
-      35:     12  3 EXIT __Compare__ for uci.t2/2-0 (det)
+mdb> c
+      27:     12  3 EXIT __Compare__ for uci.t2/2-0 (det)
 mdb> print goal
 __Compare__('=', a2(1, 2), a2(1, 2))
-mdb> goto 44
-      44:     16  3 CALL __Compare__ for uci.t3/3-0 (det)
+mdb> c
+      36:     16  3 CALL __Compare__ for uci.t3/3-0 (det)
 mdb> print goal
 __Compare__(_, b3(11, 12, 13), a3(1, 2, 3))
-mdb> goto 47
-      47:     16  3 EXIT __Compare__ for uci.t3/3-0 (det)
+mdb> c
+      37:     16  3 EXIT __Compare__ for uci.t3/3-0 (det)
 mdb> print goal
 __Compare__('>', b3(11, 12, 13), a3(1, 2, 3))
-mdb> goto 56
-      56:     20  3 CALL __Compare__ for uci.t4/4-0 (det)
+mdb> c
+      46:     20  3 CALL __Compare__ for uci.t4/4-0 (det)
 mdb> print goal
 __Compare__(_, a4(1, 2, 3, 4), b4(11, 12, 13, 14))
-mdb> goto 59
-      59:     20  3 EXIT __Compare__ for uci.t4/4-0 (det)
+mdb> c
+      47:     20  3 EXIT __Compare__ for uci.t4/4-0 (det)
 mdb> print goal
 __Compare__('<', a4(1, 2, 3, 4), b4(11, 12, 13, 14))
-mdb> goto 76
-      76:     27  3 CALL __Unify__ for uci.t1/1-0 (semidet)
+mdb> c
+      64:     27  3 CALL __Unify__ for uci.t1/1-0 (semidet)
 mdb> print goal
 __Unify__(a1(1), a1(1))
-mdb> goto 78
-      78:     27  3 EXIT __Unify__ for uci.t1/1-0 (semidet)
+mdb> c
+      65:     27  3 EXIT __Unify__ for uci.t1/1-0 (semidet)
 mdb> print goal
 __Unify__(a1(1), a1(1))
-mdb> goto 87
-      87:     31  3 CALL __Unify__ for uci.t2/2-0 (semidet)
+mdb> c
+      74:     31  3 CALL __Unify__ for uci.t2/2-0 (semidet)
 mdb> print goal
 __Unify__(a2(1, 2), b2(11, 12))
-mdb> goto 89
-      89:     31  3 FAIL __Unify__ for uci.t2/2-0 (semidet)
+mdb> c
+      75:     31  3 FAIL __Unify__ for uci.t2/2-0 (semidet)
 mdb> print goal
 __Unify__(a2(1, 2), b2(11, 12))
-mdb> goto 98
-      98:     35  3 CALL __Unify__ for uci.t3/3-0 (semidet)
+mdb> c
+      84:     35  3 CALL __Unify__ for uci.t3/3-0 (semidet)
 mdb> print goal
 __Unify__(b3(11, 12, 13), b3(11, 12, 13))
-mdb> goto 100
-     100:     35  3 EXIT __Unify__ for uci.t3/3-0 (semidet)
+mdb> c
+      85:     35  3 EXIT __Unify__ for uci.t3/3-0 (semidet)
 mdb> print goal
 __Unify__(b3(11, 12, 13), b3(11, 12, 13))
-mdb> goto 109
-     109:     39  3 CALL __Unify__ for uci.t4/4-0 (semidet)
+mdb> c
+      94:     39  3 CALL __Unify__ for uci.t4/4-0 (semidet)
 mdb> print goal
 __Unify__(a4(1, 2, 3, 4), b4(11, 12, 13, 14))
-mdb> goto 111
-     111:     39  3 FAIL __Unify__ for uci.t4/4-0 (semidet)
+mdb> c
+      95:     39  3 FAIL __Unify__ for uci.t4/4-0 (semidet)
 mdb> print goal
 __Unify__(a4(1, 2, 3, 4), b4(11, 12, 13, 14))
-mdb> goto 121
-     121:     44  4 CALL __Index__ for uci.i/3-0 (det)
+mdb> c
+     104:     43  3 CALL __Compare__ for uci.i/3-0 (det)
 mdb> print goal
-__Index__(ai(1), _)
-mdb> goto 123
-     123:     44  4 EXIT __Index__ for uci.i/3-0 (det)
-mdb> print goal
-__Index__(ai(1), 0)
-mdb> goto 124
-     124:     45  4 CALL __Index__ for uci.i/3-0 (det)
-mdb> print goal
-__Index__(bi(11), _)
-mdb> goto 126
-     126:     45  4 EXIT __Index__ for uci.i/3-0 (det)
+__Compare__(_, ai(1), bi(11))
+mdb> c
+     105:     43  3 EXIT __Compare__ for uci.i/3-0 (det)
 mdb> print goal
-__Index__(bi(11), 1)
-mdb> continue
+__Compare__('<', ai(1), bi(11))
+mdb> c
 0 lt
 1 ge
 2 ge
Index: tests/debugger/uci.inp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/uci.inp,v
retrieving revision 1.1
diff -u -b -r1.1 uci.inp
--- tests/debugger/uci.inp	2 Apr 2003 23:01:43 -0000	1.1
+++ tests/debugger/uci.inp	23 May 2004 08:24:38 -0000
@@ -1,44 +1,47 @@
 echo on
 context none
 register --quiet
-goto 16
+break -A unif*uci.
+break -A comp*uci.
+c
 print goal
-goto 19
+c
 print goal
-goto 28
+c
 print goal
-goto 35
+c
 print goal
-goto 44
+c
 print goal
-goto 47
+c
 print goal
-goto 56
+c
 print goal
-goto 59
+c
 print goal
-goto 76
+c
 print goal
-goto 78
+c
 print goal
-goto 87
+c
 print goal
-goto 89
+c
 print goal
-goto 98
+c
 print goal
-goto 100
+c
 print goal
-goto 109
+c
 print goal
-goto 111
+c
 print goal
-goto 121
+c
 print goal
-goto 123
+c
 print goal
-goto 124
+c
 print goal
-goto 126
+c
 print goal
+disable *
 continue
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.65
diff -u -b -r1.65 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	26 Jan 2004 21:09:47 -0000	1.65
+++ trace/mercury_trace_declarative.c	23 May 2004 08:00:45 -0000
@@ -294,7 +294,7 @@
 		}
 	}
 
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(entry)) {
+	if (MR_PROC_LAYOUT_IS_UCI(entry)) {
 		/*
 		** Filter out events for compiler generated procedures.
 		*/
@@ -1005,7 +1005,7 @@
 	MR_ConstString		name;
 
 	if (MR_PROC_LAYOUT_HAS_PROC_ID(entry)) {
-		if (MR_PROC_LAYOUT_COMPILER_GENERATED(entry)) {
+		if (MR_PROC_LAYOUT_IS_UCI(entry)) {
 			MR_TRACE_USE_HP(
 				MR_make_aligned_string(name, "<<internal>>");
 			);
@@ -1071,7 +1071,7 @@
 		return MR_FALSE;
 	}
 
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(entry)) {
+	if (MR_PROC_LAYOUT_IS_UCI(entry)) {
 		fflush(MR_mdb_out);
 		fprintf(MR_mdb_err,
 			"mdb: cannot start declarative debugging "
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.74
diff -u -b -r1.74 mercury_trace_external.c
--- trace/mercury_trace_external.c	19 May 2004 04:00:01 -0000	1.74
+++ trace/mercury_trace_external.c	23 May 2004 08:00:53 -0000
@@ -925,7 +925,7 @@
 	MR_Trace_Port port, MR_Unsigned seqno, MR_Unsigned depth,
 	const char *path, int lineno)
 {
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(layout->MR_sll_entry)) {
+	if (MR_PROC_LAYOUT_IS_UCI(layout->MR_sll_entry)) {
 		MR_TRACE_CALL_MERCURY(
 		    ML_DI_output_current_slots_comp(
 			MR_trace_event_number,
@@ -1029,7 +1029,7 @@
 
 	/* XXX get live vars from registers */
 	MR_Word arguments = /* XXX FIXME!!! */ 0;
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(layout->MR_sll_entry)) {
+	if (MR_PROC_LAYOUT_IS_UCI(layout->MR_sll_entry)) {
 		MR_TRACE_CALL_MERCURY(
 		    result = ML_DI_found_match_comp(
 			MR_trace_event_number,
@@ -1369,7 +1369,7 @@
 		} 
 	}
 
-	if (MR_PROC_LAYOUT_COMPILER_GENERATED(entry)) {
+	if (MR_PROC_LAYOUT_IS_UCI(entry)) {
 		MR_send_message_to_socket_format(
 			/* XXX Names with " may cause some problems here */
 			"proc(\"%s\",\"%s\",\"%s\",%ld,%ld).\n",
Index: trace/mercury_trace_tables.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
retrieving revision 1.27
diff -u -b -r1.27 mercury_trace_tables.c
--- trace/mercury_trace_tables.c	4 May 2004 07:23:25 -0000	1.27
+++ trace/mercury_trace_tables.c	23 May 2004 08:17:43 -0000
@@ -351,7 +351,7 @@
 	spec->MR_proc_name   = NULL;
 	spec->MR_proc_arity  = -1;
 	spec->MR_proc_mode   = -1;
-	spec->MR_proc_pf     = (MR_PredFunc) -1;
+	spec->MR_proc_prefix = (MR_Proc_Prefix) -1;
 
 	len = strlen(str);
 
@@ -400,10 +400,19 @@
 	}
 	
 	if (MR_strneq(str, "pred*", 5)) {
-		spec->MR_proc_pf = MR_PREDICATE;
+		spec->MR_proc_prefix = MR_PREFIX_PRED;
 		str += 5;
 	} else if (MR_strneq(str, "func*", 5)) {
-		spec->MR_proc_pf = MR_FUNCTION;
+		spec->MR_proc_prefix = MR_PREFIX_FUNC;
+		str += 5;
+	} else if (MR_strneq(str, "unif*", 5)) {
+		spec->MR_proc_prefix = MR_PREFIX_UNIF;
+		str += 5;
+	} else if (MR_strneq(str, "comp*", 5)) {
+		spec->MR_proc_prefix = MR_PREFIX_COMP;
+		str += 5;
+	} else if (MR_strneq(str, "indx*", 5)) {
+		spec->MR_proc_prefix = MR_PREFIX_INDX;
 		str += 5;
 	}
 
@@ -421,6 +430,10 @@
 				spec->MR_proc_name = end + 2;
 			}
 
+			if (strlen(spec->MR_proc_name) == 0) {
+				spec->MR_proc_name = NULL;
+			}
+
 			/*
 			** Convert all occurences of '__' to '.'.
 			*/
@@ -437,6 +450,9 @@
 
 	/* There was no module qualifier. */
 	spec->MR_proc_name = str;
+	if (strlen(spec->MR_proc_name) == 0) {
+		spec->MR_proc_name = NULL;
+	}
 	return MR_TRUE;
 }
 
@@ -587,37 +603,79 @@
 	}
 }
 
-#define	match_name(spec, cur)	(((spec)->MR_proc_name == NULL) ||	\
+#define	match_user_proc_name(spec, cur)					\
+	(((spec)->MR_proc_name == NULL) ||				\
 				MR_streq((spec)->MR_proc_name,		\
 					cur->MR_sle_user.MR_user_name))
 
-#define	match_arity(spec, cur)	(((spec)->MR_proc_arity < 0) ||		\
+#define	match_user_proc_arity(spec, cur)				\
+	(((spec)->MR_proc_arity < 0) ||					\
     				(spec)->MR_proc_arity ==		\
 					MR_sle_user_adjusted_arity(cur))
 
-#define	match_mode(spec, cur)	(((spec)->MR_proc_mode < 0) ||		\
+#define	match_user_proc_mode(spec, cur)					\
+	(((spec)->MR_proc_mode < 0) ||					\
 				(spec)->MR_proc_mode ==			\
 					cur->MR_sle_user.MR_user_mode)
 
-#define	match_pf(spec, cur)	(((int) (spec)->MR_proc_pf < 0) ||	\
-				(spec)->MR_proc_pf ==			\
-					cur->MR_sle_user.MR_user_pred_or_func)
+#define	match_user_proc_pf(spec, cur)					\
+	(((int) (spec)->MR_proc_prefix < 0) ||				\
+	( ( ((spec)->MR_proc_prefix == MR_PREFIX_PRED) &&		\
+		cur->MR_sle_user.MR_user_pred_or_func == MR_PREDICATE) || \
+	  ( ((spec)->MR_proc_prefix == MR_PREFIX_FUNC) &&		\
+		cur->MR_sle_user.MR_user_pred_or_func == MR_FUNCTION)	\
+	))
+
+#define	match_uci_type_name(spec, cur)					\
+	(((spec)->MR_proc_name == NULL) ||				\
+	MR_streq((spec)->MR_proc_name,					\
+		cur->MR_sle_uci.MR_uci_type_name))
+
+#define	match_uci_type_arity(spec, cur)					\
+	(((spec)->MR_proc_arity < 0) ||					\
+	(spec)->MR_proc_arity ==					\
+		cur->MR_sle_uci.MR_uci_type_arity)
+
+#define	match_uci_proc_mode(spec, cur)					\
+	(((spec)->MR_proc_mode < 0) ||					\
+	(spec)->MR_proc_mode ==						\
+		cur->MR_sle_uci.MR_uci_mode)
+
+#define	match_uci_pred_name(spec, cur)					\
+	(((int) (spec)->MR_proc_prefix < 0) ||				\
+	( ( ((spec)->MR_proc_prefix == MR_PREFIX_UNIF) &&		\
+		MR_streq(cur->MR_sle_uci.MR_uci_pred_name, "__Unify__")) || \
+	  ( ((spec)->MR_proc_prefix == MR_PREFIX_COMP) &&		\
+		MR_streq(cur->MR_sle_uci.MR_uci_pred_name, "__Compare__")) || \
+	  ( ((spec)->MR_proc_prefix == MR_PREFIX_INDX) &&		\
+		MR_streq(cur->MR_sle_uci.MR_uci_pred_name, "__Index__")) \
+	))
 
 static void
 MR_process_matching_procedures_in_module(const MR_Module_Layout *module,
 	MR_Proc_Spec *spec, void f(void *, const MR_Proc_Layout *), void *data)
 {
-	const MR_Proc_Layout	*cur_entry;
+	const MR_Proc_Layout	*proc;
 	int			j;
 
 	for (j = 0; j < module->MR_ml_proc_count; j++) {
-		cur_entry = module->MR_ml_procs[j];
-		if (match_name(spec, cur_entry) &&
-				match_arity(spec, cur_entry) &&
-				match_mode(spec, cur_entry) &&
-				match_pf(spec, cur_entry))
+		proc = module->MR_ml_procs[j];
+		if (MR_PROC_LAYOUT_IS_UCI(proc)) {
+			if (match_uci_type_name(spec, proc) &&
+				match_uci_type_arity(spec, proc) &&
+				match_uci_proc_mode(spec, proc) &&
+				match_uci_pred_name(spec, proc))
+			{
+				f(data, proc);
+			}
+		} else {
+			if (match_user_proc_name(spec, proc) &&
+				match_user_proc_arity(spec, proc) &&
+				match_user_proc_mode(spec, proc) &&
+				match_user_proc_pf(spec, proc))
 		{
-			f(data, cur_entry);
+				f(data, proc);
+			}
 		}
 	}
 }
@@ -856,7 +914,7 @@
 		module_layout->MR_ml_procs[data->MR_complete_current_proc];
 
 	if (
-		! MR_PROC_LAYOUT_COMPILER_GENERATED(proc_layout) &&
+		! MR_PROC_LAYOUT_IS_UCI(proc_layout) &&
 		( data->MR_complete_pf == -1 ||
 		  proc_layout->MR_sle_user.MR_user_pred_or_func ==
 				data->MR_complete_pf
Index: trace/mercury_trace_tables.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.h,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_trace_tables.h
--- trace/mercury_trace_tables.h	4 May 2004 07:23:25 -0000	1.14
+++ trace/mercury_trace_tables.h	23 May 2004 07:48:38 -0000
@@ -68,25 +68,40 @@
 extern	void		MR_dump_module_procs(FILE *fp, const char *name);
 
 /*
-** A procedure specification gives some or all of
+** A procedure specification has several components, the meaning of which
+** depends on whether the procedure is from a user defined procedure (user)
+** or from a unify, compare or index procedure (uci).
+**
+** The meanings of the components are
 **
 **	the name of the module defining the procedure
-**	the name of the predicate or function
-**	the arity of the predicate or function
+**	the name of the predicate or function (user)
+**		or the name of the type (uci)
+**	the arity of the predicate or function (user)
+**		or the arity of the type constructor (uci)
 **	the mode of the predicate or function
-**	whether the procedure belongs to a predicate or function
+**	whether the procedure is from a predicate or function (user)
+**		or is a unify, compare or index procedure (uci)
 **
 ** A NULL pointer for the string fields, and a negative number for the other
 ** fields signifies the absence of information about that field, which should
 ** therefore be treated as a wildcard.
 */
 
+typedef enum {
+	MR_PREFIX_PRED,
+	MR_PREFIX_FUNC,
+	MR_PREFIX_UNIF,
+	MR_PREFIX_COMP,
+	MR_PREFIX_INDX
+} MR_Proc_Prefix;
+
 typedef	struct {
 	const char			*MR_proc_module;
 	const char			*MR_proc_name;
 	int				MR_proc_arity;
 	int				MR_proc_mode;
-	MR_PredFunc			MR_proc_pf;
+	MR_Proc_Prefix			MR_proc_prefix;
 } MR_Proc_Spec;
 
 /*
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