[m-rev.] abandoned diff: using Mercury representation for goal paths

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Sep 30 15:04:59 AEST 2011


In the log message of a recent diff, I wrote:

	In a future change I intend to change the way the debugger
	represents goal paths from being strings to being statically
	allocated terms of the reverse_goal_path type. This should
	have two benefits. One is reduced memory consumption, since two
	different goal path strings cannot share memory but two different
	reverse goal paths can share the memory containing their common
	tail (the goal paths steps near the root). The other is that
	the declarative debugger won't need to do any conversion from
	string to structure, and should therefore be faster.

This diff implements that change, but it turns out that it actually
*increases* memory consumption by about 4% in the asm_fast.gc.debug grade.
It seems that our long-standing technique of storing each string, and thus
the string form of each goal path, just once in the string table gets
most of the compression possible for goal paths. The extra sharing we get
between the tails of different reverse goal paths is more than outweighed
by the fact that the native Mercury representations of goal_path_steps
(1 to 4 words) and rgp_cons nodes (2 words) are significantly bigger than
their string representations (even 1+2=3 words is 24 bytes on 64 bit systems,
whereas most steps, together with the ";"s separating them, fit in about
4 to 8 bytes.

This diff therefore won't be committed. It is being posted here only for
posterity. My next diff will add a comment to the code recording this design
decision.

Since I already know the diff won't be committed, it is not yet complete.
The main thing left to be done is to get the Mercury code that converts reverse
goal paths to strings, which is invoked from the debugger, be compiled with
execution tracing totally disabled.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
Index: browser/declarative_execution.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_execution.m,v
retrieving revision 1.70
diff -u -b -r1.70 declarative_execution.m
--- browser/declarative_execution.m	10 May 2011 04:12:24 -0000	1.70
+++ browser/declarative_execution.m	26 Sep 2011 08:15:24 -0000
@@ -468,8 +468,8 @@
 :- implementation.
 
 :- import_module mdb.declarative_debugger.
-:- import_module mdbcomp.goal_path.
 
+:- import_module debug_builtin.
 :- import_module exception.
 :- import_module int.
 :- import_module map.
@@ -1033,13 +1033,13 @@
 trace_node_port(node_neg_succ(_, _, _))          = port_neg_success.
 trace_node_port(node_neg_fail(_, _, _))          = port_neg_failure.
 
-:- func trace_node_path(trace_node(trace_node_id)) = goal_path_string.
-:- pragma foreign_export("C", trace_node_path(in) = out,
-    "MR_DD_trace_node_path").
+:- func trace_node_rev_path(trace_node(trace_node_id)) = reverse_goal_path.
+:- pragma foreign_export("C", trace_node_rev_path(in) = out,
+    "MR_DD_trace_node_rev_path").
 
-trace_node_path(Node) = Path :-
+trace_node_rev_path(Node) = RevGoalPath :-
     Label = get_trace_node_label(Node),
-    Path = get_goal_path_from_label_layout(Label).
+    RevGoalPath = get_rev_goal_path_from_label_layout(Label).
 
 :- func get_trace_node_label(trace_node(R)) = label_layout.
 
Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.68
diff -u -b -r1.68 declarative_tree.m
--- browser/declarative_tree.m	26 Sep 2011 10:37:08 -0000	1.68
+++ browser/declarative_tree.m	26 Sep 2011 10:47:26 -0000
@@ -64,6 +64,7 @@
 
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module deconstruct.
 :- import_module exception.
 :- import_module int.
@@ -1005,8 +1006,8 @@
 find_chain_start_inside(Store, CallId, CallNode, ArgPos, ChainStart) :-
     CallPrecId = CallNode ^ call_preceding,
     CallAtom = get_trace_call_atom(CallNode),
-    CallPathStr = get_goal_path_from_maybe_label(CallNode ^ call_return_label),
-    rev_goal_path_from_string_det(CallPathStr, CallPath),
+    CallReturnLabel = CallNode ^ call_return_label,
+    CallPath = get_rev_goal_path_from_maybe_label(CallReturnLabel),
     StartLoc = parent_goal(CallId, CallNode),
     absolute_arg_num(ArgPos, CallAtom, ArgNum),
     TotalArgs = length(CallAtom ^ atom_args),
@@ -1206,8 +1207,7 @@
 
 contour_at_end_path([_ - Node], yes(EndPath)) :-
     Node = node_call(_, _, _, _, _, _, MaybeReturnLabel, _, _, _),
-    CallPathStr = get_goal_path_from_maybe_label(MaybeReturnLabel),
-    rev_goal_path_from_string_det(CallPathStr, CallPath),
+    CallPath = get_rev_goal_path_from_maybe_label(MaybeReturnLabel),
     CallPath = EndPath.
 
 :- pred next_goal_generates_internal_event(list(goal_and_path)::in) is semidet.
@@ -1272,8 +1272,7 @@
             ;
                 ContourHeadNode = node_later_disj(_, Label, _)
             ),
-            DisjPathStr = get_goal_path_from_label_layout(Label),
-            rev_goal_path_from_string_det(DisjPathStr, DisjPath),
+            DisjPath = get_rev_goal_path_from_label_layout(Label),
             rev_goal_path_remove_last(DisjPath, DisjInitialPath, DisjLastStep),
             DisjInitialPath = Path,
             DisjLastStep = step_disj(N)
@@ -1291,8 +1290,7 @@
         (
             Contour = [_ - ContourHeadNode | ContourTail],
             ContourHeadNode = node_switch(_, Label),
-            ArmPathStr = get_goal_path_from_label_layout(Label),
-            rev_goal_path_from_string_det(ArmPathStr, ArmPath),
+            ArmPath = get_rev_goal_path_from_label_layout(Label),
             rev_goal_path_remove_last(ArmPath, ArmInitialPath, ArmLastStep),
             ArmInitialPath = Path,
             ArmLastStep = step_switch(N, _)
@@ -1311,8 +1309,7 @@
         (
             Contour = [_ - ContourHeadNode | ContourTail],
             ContourHeadNode = node_cond(_, Label, _),
-            CondPathStr = get_goal_path_from_label_layout(Label),
-            rev_goal_path_from_string_det(CondPathStr, CondPath),
+            CondPath = get_rev_goal_path_from_label_layout(Label),
             rev_goal_path_remove_last(CondPath, CondInitialPath, CondLastStep),
             CondInitialPath = Path,
             CondLastStep = step_ite_cond
@@ -1328,8 +1325,7 @@
             ContourHeadNode = node_else(_, ElseCondId, _),
             cond_node_from_id(Store, ElseCondId, CondNode),
             CondNode = node_cond(_, Label, _),
-            CondPathStr = get_goal_path_from_label_layout(Label),
-            rev_goal_path_from_string_det(CondPathStr, CondPath),
+            CondPath = get_rev_goal_path_from_label_layout(Label),
             rev_goal_path_remove_last(CondPath, CondInitialPath, CondLastStep),
             CondInitialPath = Path,
             CondLastStep = step_ite_cond
@@ -1414,8 +1410,7 @@
             ContourHeadNode = node_call(_, _, _, _, _, _,
                 MaybeReturnLabel, _, _, _),
             Atom = get_trace_call_atom(ContourHeadNode),
-            CallPathStr = get_goal_path_from_maybe_label( MaybeReturnLabel),
-            rev_goal_path_from_string_det(CallPathStr, CallPath),
+            CallPath = get_rev_goal_path_from_maybe_label(MaybeReturnLabel),
             CallPath = EndPath
         ->
             (
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/call_gen.m,v
retrieving revision 1.205
diff -u -b -r1.205 call_gen.m
--- compiler/call_gen.m	27 Sep 2011 00:49:24 -0000	1.205
+++ compiler/call_gen.m	27 Sep 2011 04:46:21 -0000
@@ -112,16 +112,16 @@
     get_containing_goal_map(!.CI, MaybeContainingGoalMap),
     (
         MaybeContainingGoalMap = yes(ContainingGoalMap),
-        GoalPath = goal_id_to_forward_path(ContainingGoalMap, GoalId),
-        MaybeGoalPath = yes(GoalPath)
+        RevGoalPath = goal_id_to_reverse_path(ContainingGoalMap, GoalId),
+        MaybeRevGoalPath = yes(RevGoalPath)
     ;
         MaybeContainingGoalMap = no,
-        MaybeGoalPath = no
+        MaybeRevGoalPath = no
     ),
     CallCode = from_list([
         llds_instr(livevals(LiveVals), ""),
         llds_instr(llcall(Address, code_label(ReturnLabel), ReturnLiveLvalues,
-            Context, MaybeGoalPath, CallModel), CallComment),
+            Context, MaybeRevGoalPath, CallModel), CallComment),
         llds_instr(label(ReturnLabel), "continuation label")
     ]),
 
@@ -252,16 +252,16 @@
     get_containing_goal_map(!.CI, MaybeContainingGoalMap),
     (
         MaybeContainingGoalMap = yes(ContainingGoalMap),
-        GoalPath = goal_id_to_forward_path(ContainingGoalMap, GoalId),
-        MaybeGoalPath = yes(GoalPath)
+        RevGoalPath = goal_id_to_reverse_path(ContainingGoalMap, GoalId),
+        MaybeRevGoalPath = yes(RevGoalPath)
     ;
         MaybeContainingGoalMap = no,
-        MaybeGoalPath = no
+        MaybeRevGoalPath = no
     ),
     CallCode = from_list([
         llds_instr(livevals(LiveVals), ""),
         llds_instr(llcall(CodeAddr, code_label(ReturnLabel), ReturnLiveLvalues,
-            Context, MaybeGoalPath, CallModel), "Setup and call"),
+            Context, MaybeRevGoalPath, CallModel), "Setup and call"),
         llds_instr(label(ReturnLabel), "Continuation label")
     ]),
 
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.394
diff -u -b -r1.394 code_info.m
--- compiler/code_info.m	16 Sep 2011 07:03:34 -0000	1.394
+++ compiler/code_info.m	26 Sep 2011 11:02:32 -0000
@@ -44,14 +44,15 @@
 :- import_module ll_backend.layout.
 :- import_module ll_backend.llds.
 :- import_module ll_backend.trace_gen.
-:- import_module mdbcomp.prim_data.
 :- import_module mdbcomp.goal_path.
+:- import_module mdbcomp.prim_data.
 :- import_module parse_tree.prog_data.
 :- import_module parse_tree.set_of_var.
 
 :- import_module assoc_list.
 :- import_module bool.
 :- import_module counter.
+:- import_module debug_builtin.
 :- import_module io.
 :- import_module list.
 :- import_module map.
@@ -907,7 +908,7 @@
 :- pred succip_is_used(code_info::in, code_info::out) is det.
 
 :- pred add_trace_layout_for_label(label::in, term.context::in, trace_port::in,
-    bool::in, forward_goal_path::in, maybe(user_event_info)::in,
+    bool::in, reverse_goal_path::in, maybe(user_event_info)::in,
     layout_label_info::in, code_info::in, code_info::out) is det.
 
 :- pred get_cur_proc_label(code_info::in, proc_label::out) is det.
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.104
diff -u -b -r1.104 continuation_info.m
--- compiler/continuation_info.m	24 May 2011 00:53:01 -0000	1.104
+++ compiler/continuation_info.m	26 Sep 2011 11:07:51 -0000
@@ -64,11 +64,11 @@
 :- import_module ll_backend.llds.
 :- import_module ll_backend.trace_gen.
 :- import_module mdbcomp.prim_data.
-:- import_module mdbcomp.goal_path.
 :- import_module parse_tree.prog_data.
 
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
@@ -265,14 +265,14 @@
                 port_context    :: prog_context,
                 port_type       :: trace_port,
                 port_is_hidden  :: bool,
-                port_path       :: forward_goal_path,
+                port_path       :: reverse_goal_path,
                 port_user       :: maybe(user_event_info),
                 port_label      :: layout_label_info
             ).
 
 :- type return_layout_info
     --->    return_layout_info(
-                assoc_list(code_addr, pair(prog_context, forward_goal_path)),
+                assoc_list(code_addr, pair(prog_context, reverse_goal_path)),
                 layout_label_info
             ).
 
@@ -450,7 +450,7 @@
                 call_context            :: term.context,
 
                 % The position of the call in the body if tracing is enabled.
-                call_goal_path          :: maybe(forward_goal_path)
+                call_goal_path          :: maybe(reverse_goal_path)
             ).
 
     % Process the list of instructions for this proc, adding
@@ -474,9 +474,9 @@
 
 get_call_info(Instr, Call) :-
     Instr = llds_instr(Uinstr, _Comment),
-    Uinstr = llcall(Target, Return, LiveInfo, Context, GoalPath, _),
+    Uinstr = llcall(Target, Return, LiveInfo, Context, RevGoalPath, _),
     Return = code_label(ReturnLabel),
-    Call = call_info(ReturnLabel, Target, LiveInfo, Context, GoalPath).
+    Call = call_info(ReturnLabel, Target, LiveInfo, Context, RevGoalPath).
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/goal_path.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_path.m,v
retrieving revision 1.63
diff -u -b -r1.63 goal_path.m
--- compiler/goal_path.m	26 Sep 2011 07:08:56 -0000	1.63
+++ compiler/goal_path.m	26 Sep 2011 09:01:13 -0000
@@ -68,6 +68,7 @@
 :- import_module mdbcomp.
 :- import_module parse_tree.prog_data.
 
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module list.
 :- import_module map.
Index: compiler/goal_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/goal_util.m,v
retrieving revision 1.192
diff -u -b -r1.192 goal_util.m
--- compiler/goal_util.m	27 Sep 2011 06:22:47 -0000	1.192
+++ compiler/goal_util.m	27 Sep 2011 06:23:04 -0000
@@ -25,12 +25,12 @@
 :- import_module hlds.hlds_rtti.
 :- import_module hlds.instmap.
 :- import_module hlds.pred_table.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.prim_data.
 :- import_module parse_tree.prog_data.
 :- import_module parse_tree.set_of_var.
 
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module maybe.
 :- import_module term.
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.369
diff -u -b -r1.369 handle_options.m
--- compiler/handle_options.m	27 Sep 2011 00:49:24 -0000	1.369
+++ compiler/handle_options.m	27 Sep 2011 13:14:41 -0000
@@ -321,11 +321,27 @@
 
     map.lookup(!.OptionTable, force_disable_tracing, ForceDisableTracing),
     ( ForceDisableTracing = bool(yes) ->
+%       trace [io(!TIO)] (
+%           io.write_string("OPTION ForceDisableTracing = ", !TIO),
+%           io.write(ForceDisableTracing, !TIO),
+%           io.nl(!TIO)
+%       ),
         TraceLevel = trace_level_none
     ;
         map.lookup(!.OptionTable, trace_level, Trace),
         map.lookup(!.OptionTable, exec_trace, ExecTraceOpt),
         map.lookup(!.OptionTable, decl_debug, DeclDebugOpt),
+%       trace [io(!TIO)] (
+%           io.write_string("OPTION TraceLevel = ", !TIO),
+%           io.write(Trace, !TIO),
+%           io.nl(!TIO),
+%           io.write_string("OPTION ExecTrace = ", !TIO),
+%           io.write(ExecTraceOpt, !TIO),
+%           io.nl(!TIO),
+%           io.write_string("OPTION DeclDebugOpt = ", !TIO),
+%           io.write(DeclDebugOpt, !TIO),
+%           io.nl(!TIO)
+%       ),
         (
             Trace = string(TraceStr),
             ExecTraceOpt = bool(ExecTrace),
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.233
diff -u -b -r1.233 hlds_goal.m
--- compiler/hlds_goal.m	30 Sep 2011 03:43:32 -0000	1.233
+++ compiler/hlds_goal.m	30 Sep 2011 04:44:44 -0000
@@ -30,6 +30,7 @@
 :- import_module assoc_list.
 :- import_module bool.
 :- import_module char.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.276
diff -u -b -r1.276 hlds_pred.m
--- compiler/hlds_pred.m	27 Sep 2011 00:49:25 -0000	1.276
+++ compiler/hlds_pred.m	27 Sep 2011 04:46:21 -0000
@@ -31,7 +31,6 @@
 :- import_module hlds.pred_table.
 :- import_module hlds.special_pred.
 :- import_module libs.globals.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.prim_data.
 :- import_module mdbcomp.program_representation.
 :- import_module parse_tree.error_util.
@@ -42,6 +41,7 @@
 
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
Index: compiler/introduce_parallelism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/introduce_parallelism.m,v
retrieving revision 1.6
diff -u -b -r1.6 introduce_parallelism.m
--- compiler/introduce_parallelism.m	27 Sep 2011 04:41:25 -0000	1.6
+++ compiler/introduce_parallelism.m	27 Sep 2011 04:46:21 -0000
@@ -58,6 +58,7 @@
 
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
Index: compiler/layout.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout.m,v
retrieving revision 1.44
diff -u -b -r1.44 layout.m
--- compiler/layout.m	20 May 2011 04:16:47 -0000	1.44
+++ compiler/layout.m	26 Sep 2011 14:44:50 -0000
@@ -85,7 +85,7 @@
                 maybe_port              :: maybe(trace_port),
                 maybe_is_hidden         :: maybe(bool),
                 label_num_in_module     :: int,
-                maybe_goal_path         :: maybe(int), % offset
+                maybe_goal_path         :: maybe(rval),
                 maybe_user_info         :: maybe(layout_slot_name)
             ).
 
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.123
diff -u -b -r1.123 layout_out.m
--- compiler/layout_out.m	27 Sep 2011 00:49:25 -0000	1.123
+++ compiler/layout_out.m	27 Sep 2011 04:46:21 -0000
@@ -985,10 +985,10 @@
 :- pred output_basic_label_layout_slot(llds_out_info::in, string::in,
     basic_label_layout::in, io::di, io::uo) is det.
 
-output_basic_label_layout_slot(_Info, ModuleName, BasicLabelLayout, !IO) :-
+output_basic_label_layout_slot(Info, ModuleName, BasicLabelLayout, !IO) :-
     BasicLabelLayout = basic_label_layout(ProcLabel, _LabelNum,
         _ProcLayoutName, MaybePort, MaybeIsHidden, LabelNumberInModule,
-        MaybeGoalPath, MaybeUserSlotName),
+        MaybeRevGoalPathRval, MaybeUserSlotName),
     some [!MacroName] (
         !:MacroName = "MR_LL",
         % MaybeIsHidden = no means that the value of the hidden field shouldn't
@@ -1025,10 +1025,10 @@
     io.write_int(LabelNumberInModule, !IO),
     io.write_string(",", !IO),
     (
-        MaybeGoalPath = yes(GoalPath),
-        io.write_int(GoalPath, !IO)
+        MaybeRevGoalPathRval = yes(RevGoalPathRval),
+        output_rval_as_type(Info, RevGoalPathRval, lt_word, !IO)
     ;
-        MaybeGoalPath = no,
+        MaybeRevGoalPathRval = no,
         io.write_string("0", !IO)
     ),
     (
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.379
diff -u -b -r1.379 llds.m
--- compiler/llds.m	27 Sep 2011 00:49:25 -0000	1.379
+++ compiler/llds.m	27 Sep 2011 04:46:21 -0000
@@ -27,20 +27,20 @@
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
 :- import_module ll_backend.layout.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.prim_data.
 :- import_module mdbcomp.program_representation.
 :- import_module parse_tree.prog_data.
 :- import_module parse_tree.prog_foreign.
 
+:- import_module assoc_list.
 :- import_module bool.
 :- import_module cord.
+:- import_module counter.
+:- import_module debug_builtin.
 :- import_module list.
-:- import_module assoc_list.
 :- import_module map.
 :- import_module maybe.
 :- import_module set.
-:- import_module counter.
 :- import_module term.
 
 %-----------------------------------------------------------------------------%
@@ -308,7 +308,7 @@
             % *appears* to be unused by the following code.
 
     ;       llcall(code_addr, code_addr, list(liveinfo), term.context,
-                maybe(forward_goal_path), call_model)
+                maybe(reverse_goal_path), call_model)
             % llcall(Target, Continuation, _, _, _) is the same as
             % succip = Continuation; goto(Target).
             % The third argument is the live value info for the values live
Index: compiler/mode_ordering.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_ordering.m,v
retrieving revision 1.39
diff -u -b -r1.39 mode_ordering.m
--- compiler/mode_ordering.m	26 Sep 2011 07:08:56 -0000	1.39
+++ compiler/mode_ordering.m	26 Sep 2011 09:00:51 -0000
@@ -58,6 +58,7 @@
 :- import_module parse_tree.set_of_var.
 
 :- import_module assoc_list.
+:- import_module debug_builtin.
 :- import_module digraph.
 :- import_module pair.
 :- import_module require.
Index: compiler/module_imports.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_imports.m,v
retrieving revision 1.12
diff -u -b -r1.12 module_imports.m
--- compiler/module_imports.m	23 May 2011 05:08:08 -0000	1.12
+++ compiler/module_imports.m	27 Sep 2011 13:16:16 -0000
@@ -252,6 +252,7 @@
 :- implementation.
 
 :- import_module libs.options.
+:- import_module libs.trace_params.
 :- import_module parse_tree.modules.    % undesirable dependency
 
 :- import_module bool.
@@ -469,6 +470,8 @@
 get_implicit_dependencies(Items, Globals, ImportDeps, UseDeps) :-
     add_implicit_imports(Items, Globals, [], ImportDeps, [], UseDeps).
 
+:- import_module io.
+
 add_implicit_imports(Items, Globals, !ImportDeps, !UseDeps) :-
     !:ImportDeps = [mercury_public_builtin_module | !.ImportDeps],
     !:UseDeps = [mercury_private_builtin_module | !.UseDeps],
@@ -522,6 +525,28 @@
     ;
         ItemsNeedException = no
     ),
+    globals.get_trace_level(Globals, TraceLevel),
+    TraceLevelIsNone = given_trace_level_is_none(TraceLevel),
+    (
+        TraceLevelIsNone = no,
+%       trace [io(!IO)] (
+%           io.write_string("IMPORTING debug_builtin.m\n", !IO)
+%       ),
+        !:UseDeps = [mercury_debug_builtin_module | !.UseDeps]
+    ;
+        TraceLevelIsNone = yes,
+        globals.lookup_bool_option(Globals, force_disable_tracing,
+            DisableTracing),
+        (
+            DisableTracing = yes,
+            !:UseDeps = [mercury_debug_builtin_module | !.UseDeps]
+        ;
+            DisableTracing = no
+        )
+%       trace [io(!IO)] (
+%           io.write_string("NOT IMPORTING debug_builtin.m\n", !IO)
+%       )
+    ),
     globals.lookup_bool_option(Globals, profile_deep, Deep),
     (
         Deep = yes,
Index: compiler/ordering_mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ordering_mode_constraints.m,v
retrieving revision 1.34
diff -u -b -r1.34 ordering_mode_constraints.m
--- compiler/ordering_mode_constraints.m	16 Aug 2011 03:26:32 -0000	1.34
+++ compiler/ordering_mode_constraints.m	26 Sep 2011 09:01:03 -0000
@@ -119,6 +119,7 @@
 
 :- import_module bimap.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module map.
 :- import_module maybe.
Index: compiler/par_loop_control.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/par_loop_control.m,v
retrieving revision 1.2
diff -u -b -r1.2 par_loop_control.m
--- compiler/par_loop_control.m	27 Sep 2011 06:22:47 -0000	1.2
+++ compiler/par_loop_control.m	27 Sep 2011 06:29:32 -0000
@@ -105,6 +105,7 @@
 :- import_module transform_hlds.dependency_graph.
 
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module digraph.
 :- import_module list.
 :- import_module map.
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.76
diff -u -b -r1.76 prog_rep.m
--- compiler/prog_rep.m	16 Aug 2011 03:26:33 -0000	1.76
+++ compiler/prog_rep.m	26 Sep 2011 09:02:28 -0000
@@ -96,6 +96,7 @@
 :- import_module parse_tree.prog_util.
 :- import_module parse_tree.set_of_var.
 
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module maybe.
 :- import_module require.
Index: compiler/push_goals_together.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/push_goals_together.m,v
retrieving revision 1.9
diff -u -b -r1.9 push_goals_together.m
--- compiler/push_goals_together.m	26 Sep 2011 07:08:56 -0000	1.9
+++ compiler/push_goals_together.m	26 Sep 2011 09:10:51 -0000
@@ -65,6 +65,7 @@
 
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module io.
 :- import_module list.
Index: compiler/rbmm.condition_renaming.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rbmm.condition_renaming.m,v
retrieving revision 1.20
diff -u -b -r1.20 rbmm.condition_renaming.m
--- compiler/rbmm.condition_renaming.m	26 Sep 2011 07:08:56 -0000	1.20
+++ compiler/rbmm.condition_renaming.m	26 Sep 2011 08:56:26 -0000
@@ -41,12 +41,11 @@
 :- import_module hlds.
 :- import_module hlds.hlds_module.
 :- import_module hlds.hlds_pred.
-:- import_module mdbcomp.
-:- import_module mdbcomp.goal_path.
 :- import_module transform_hlds.rbmm.points_to_info.
 :- import_module transform_hlds.rbmm.region_liveness_info.
 :- import_module transform_hlds.rbmm.region_resurrection_renaming.
 
+:- import_module debug_builtin.
 :- import_module map.
 :- import_module set.
 
Index: compiler/smm_common.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/smm_common.m,v
retrieving revision 1.9
diff -u -b -r1.9 smm_common.m
--- compiler/smm_common.m	13 Jan 2011 00:36:53 -0000	1.9
+++ compiler/smm_common.m	26 Sep 2011 09:11:10 -0000
@@ -21,11 +21,10 @@
 :- import_module hlds.hlds_goal.
 :- import_module hlds.hlds_pred.
 :- import_module hlds.hlds_module.
-:- import_module mdbcomp.
-:- import_module mdbcomp.goal_path.
 :- import_module parse_tree.
 :- import_module parse_tree.prog_data.
 
+:- import_module debug_builtin.
 :- import_module io.
 :- import_module list.
 :- import_module term.
@@ -71,6 +70,7 @@
 
 :- import_module check_hlds.
 :- import_module check_hlds.type_util.
+:- import_module mdbcomp.goal_path.
 :- import_module parse_tree.prog_out.
 
 :- import_module bool.
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.166
diff -u -b -r1.166 stack_layout.m
--- compiler/stack_layout.m	26 Sep 2011 04:30:45 -0000	1.166
+++ compiler/stack_layout.m	27 Sep 2011 14:12:53 -0000
@@ -99,11 +99,13 @@
 
 :- implementation.
 
+:- import_module backend_libs.builtin_ops.
 :- import_module backend_libs.proc_label.
 :- import_module backend_libs.rtti.
 :- import_module check_hlds.type_util.
 :- import_module hlds.code_model.
 :- import_module hlds.goal_util.
+:- import_module hlds.hlds_data.
 :- import_module hlds.hlds_pred.
 :- import_module hlds.hlds_rtti.
 :- import_module libs.globals.
@@ -112,6 +114,7 @@
 :- import_module ll_backend.layout.
 :- import_module ll_backend.layout_out.
 :- import_module ll_backend.ll_pseudo_type_info.
+:- import_module ll_backend.llds.
 :- import_module ll_backend.trace_gen.
 :- import_module mdbcomp.goal_path.
 :- import_module parse_tree.prog_event.
@@ -121,6 +124,7 @@
 :- import_module char.
 :- import_module cord.
 :- import_module counter.
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module map.
 :- import_module pair.
@@ -143,15 +147,17 @@
         ProcLayouts, ModuleLayouts) :-
 
     Params = init_stack_layout_params(ModuleInfo),
+    module_info_get_type_table(ModuleInfo, TypeTable),
     map.init(LabelTables0),
     StringTable0 = init_string_table,
+    GoalPathTables0 = init_goal_path_tables(TypeTable),
     global_data_get_static_cell_info(!.GlobalData, StaticCellInfo0),
     LabelLayoutInfo0 = init_label_layouts_info,
     ProcLayoutInfo0 = init_proc_layouts_info,
 
     global_data_get_all_proc_layouts(!.GlobalData, ProcLayoutList),
-    list.foldl5(construct_proc_and_label_layouts_for_proc(Params),
-        ProcLayoutList,
+    construct_proc_and_label_layouts_for_procs(Params, ProcLayoutList,
+        GoalPathTables0,
         LabelTables0, LabelTables,
         StringTable0, StringTable,
         StaticCellInfo0, StaticCellInfo1,
@@ -384,20 +390,44 @@
 
 :- type label_tables == map(string, file_label_table).
 
+    % Construct the layouts we need for the given list of procedures.
+    %
+:- pred construct_proc_and_label_layouts_for_procs(stack_layout_params::in,
+    list(proc_layout_info)::in, goal_path_tables::in,
+    label_tables::in, label_tables::out,
+    string_table::in, string_table::out,
+    static_cell_info::in, static_cell_info::out,
+    label_layouts_info::in, label_layouts_info::out,
+    proc_layouts_info::in, proc_layouts_info::out) is det.
+
+construct_proc_and_label_layouts_for_procs(_Params, [],
+        _GoalPathTables, !LabelTables, !StringTable,
+        !StaticCellInfo, !LabelLayoutInfo, !ProcLayoutInfo).
+construct_proc_and_label_layouts_for_procs(Params, [PLI | PLIs],
+        !.GoalPathTables, !LabelTables, !StringTable,
+        !StaticCellInfo, !LabelLayoutInfo, !ProcLayoutInfo) :-
+    construct_proc_and_label_layouts_for_proc(Params, PLI,
+        !GoalPathTables, !LabelTables, !StringTable,
+        !StaticCellInfo, !LabelLayoutInfo, !ProcLayoutInfo),
+    construct_proc_and_label_layouts_for_procs(Params, PLIs,
+        !.GoalPathTables, !LabelTables, !StringTable,
+        !StaticCellInfo, !LabelLayoutInfo, !ProcLayoutInfo).
+
     % Construct the layouts that concern a single procedure: the procedure
     % layout and the layouts of the labels inside that procedure. Also update
     % the module-wide label table with the labels defined in this procedure.
     %
 :- pred construct_proc_and_label_layouts_for_proc(stack_layout_params::in,
-    proc_layout_info::in,
+    proc_layout_info::in, goal_path_tables::in, goal_path_tables::out,
     label_tables::in, label_tables::out,
     string_table::in, string_table::out,
     static_cell_info::in, static_cell_info::out,
     label_layouts_info::in, label_layouts_info::out,
     proc_layouts_info::in, proc_layouts_info::out) is det.
 
-construct_proc_and_label_layouts_for_proc(Params, PLI, !LabelTables,
-        !StringTable, !StaticCellInfo, !LabelLayoutInfo, !ProcLayoutInfo) :-
+construct_proc_and_label_layouts_for_proc(Params, PLI,
+        !GoalPathTables, !LabelTables, !StringTable,
+        !StaticCellInfo, !LabelLayoutInfo, !ProcLayoutInfo) :-
     PLI = proc_layout_info(RttiProcLabel, EntryLabel,
         _Detism, _StackSlots, _SuccipLoc, _EvalMethod, _EffTraceLevel,
         _MaybeCallLabel, _MaxTraceReg, HeadVars, _ArgModes,
@@ -426,11 +456,11 @@
         ),
         valid_proc_layout(PLI)
     ->
-        list.map_foldl3(
+        list.map_foldl4(
             construct_internal_layout(Params, ProcLabel, ProcLayoutName,
                 VarNumMap),
             Internals, InternalLabelInfos,
-            !StringTable, !StaticCellInfo, !LabelLayoutInfo)
+            !StringTable, !GoalPathTables, !StaticCellInfo, !LabelLayoutInfo)
     ;
         InternalLabelInfos = []
     ),
@@ -513,19 +543,19 @@
     ).
 
 :- pred find_valid_return_context(
-    assoc_list(code_addr, pair(prog_context, forward_goal_path))::in,
-    code_addr::out, prog_context::out, forward_goal_path::out) is semidet.
+    assoc_list(code_addr, pair(prog_context, reverse_goal_path))::in,
+    code_addr::out, prog_context::out, reverse_goal_path::out) is semidet.
 
 find_valid_return_context([TargetContext | TargetContexts],
-        ValidTarget, ValidContext, ValidGoalPath) :-
-    TargetContext = Target - (Context - GoalPath),
+        ValidTarget, ValidContext, ValidRevGoalPath) :-
+    TargetContext = Target - (Context - RevGoalPath),
     ( context_is_valid(Context) ->
         ValidTarget = Target,
         ValidContext = Context,
-        ValidGoalPath = GoalPath
+        ValidRevGoalPath = RevGoalPath
     ;
         find_valid_return_context(TargetContexts, ValidTarget, ValidContext,
-            ValidGoalPath)
+            ValidRevGoalPath)
     ).
 
 :- pred context_is_valid(prog_context::in) is semidet.
@@ -1344,12 +1374,13 @@
     proc_label::in, layout_name::in, var_num_map::in,
     pair(int, internal_layout_info)::in, internal_label_info::out,
     string_table::in, string_table::out,
+    goal_path_tables::in, goal_path_tables::out,
     static_cell_info::in, static_cell_info::out,
     label_layouts_info::in, label_layouts_info::out) is det.
 
 construct_internal_layout(Params, ProcLabel, ProcLayoutName, VarNumMap,
         LabelNum - Internal, LabelLayout,
-        !StringTable, !StaticCellInfo, !LabelLayoutInfo) :-
+        !StringTable, !GoalPathTables, !StaticCellInfo, !LabelLayoutInfo) :-
     Internal = internal_layout_info(Trace, Resume, Return),
     (
         Trace = no,
@@ -1370,13 +1401,14 @@
         ResumeLayout = layout_label_info(ResumeLiveVarSet, ResumeTypeVarMap)
     ),
     (
-        Trace = yes(trace_port_layout_info(_, Port, IsHidden, GoalPath, _, _)),
+        Trace = yes(trace_port_layout_info(_, Port, IsHidden, RevGoalPath,
+            _, _)),
         Return = no,
         MaybePort = yes(Port),
         MaybeIsHidden = yes(IsHidden),
-        GoalPathStr = goal_path_to_string(GoalPath),
-        lookup_string_in_table(GoalPathStr, GoalPathNum, !StringTable),
-        MaybeGoalPath = yes(GoalPathNum)
+        lookup_rev_goal_path_in_table(RevGoalPath, RevGoalPathRval,
+            !GoalPathTables, !StaticCellInfo),
+        MaybeRevGoalPathRval = yes(RevGoalPathRval)
     ;
         Trace = no,
         Return = yes(ReturnInfo),
@@ -1388,23 +1420,23 @@
         % We only ever use the goal path fields of these layout structures
         % when we process "fail" commands in the debugger.
         ReturnInfo = return_layout_info(TargetsContexts, _),
-        ( find_valid_return_context(TargetsContexts, _, _, GoalPath) ->
-            GoalPathStr = goal_path_to_string(GoalPath),
-            lookup_string_in_table(GoalPathStr, GoalPathNum, !StringTable),
-            MaybeGoalPath = yes(GoalPathNum)
+        ( find_valid_return_context(TargetsContexts, _, _, RevGoalPath) ->
+            lookup_rev_goal_path_in_table(RevGoalPath, RevGoalPathRval,
+                !GoalPathTables, !StaticCellInfo),
+            MaybeRevGoalPathRval = yes(RevGoalPathRval)
         ;
             % If tracing is enabled, then exactly one of the calls for which
             % this label is a return site would have had a valid context.
             % If none do, then tracing is not enabled, and therefore the goal
             % path of this label will not be accessed.
-            MaybeGoalPath = no
+            MaybeRevGoalPathRval = no
         )
     ;
         Trace = no,
         Return = no,
         MaybePort = no,
         MaybeIsHidden = no,
-        MaybeGoalPath = no
+        MaybeRevGoalPathRval = no
     ;
         Trace = yes(_),
         Return = yes(_),
@@ -1513,7 +1545,7 @@
     ),
     Label = internal_label(LabelNum, ProcLabel),
     BasicLayout = basic_label_layout(ProcLabel, LabelNum, ProcLayoutName,
-        MaybePort, MaybeIsHidden, LabelNumber, MaybeGoalPath,
+        MaybePort, MaybeIsHidden, LabelNumber, MaybeRevGoalPathRval,
         MaybeUserDataSlot),
     (
         MaybeVarInfo = no_var_info,
@@ -2460,8 +2492,8 @@
 
 %---------------------------------------------------------------------------%
 
-represent_determinism_rval(Detism,
-    const(llconst_int(code_model.represent_determinism(Detism)))).
+represent_determinism_rval(Detism, Rval) :-
+    Rval = const(llconst_int(code_model.represent_determinism(Detism))).
 
 %---------------------------------------------------------------------------%
 %
@@ -2722,5 +2754,471 @@
     ).
 
 %---------------------------------------------------------------------------%
+%
+% The goal_path_tables data structure and its components.
+%
+
+    % The primary tag we put on the pointer to the memory cell,
+    % and maybe a secondary tag to put at the start of the memory cell.
+:- type functor_representation
+    --->    functor_representation(tag, maybe(int)).
+
+    % The value of the constant.
+:- type const_representation
+    --->    const_representation(rval).
+
+:- func make_functor_repr(string, cons_tag) = functor_representation.
+
+make_functor_repr(ConsName, ConsTag) = FunctorRepresentation :-
+    ( ConsTag = unshared_tag(Ptag) ->
+        FunctorRepresentation = functor_representation(Ptag, no)
+    ; ConsTag = shared_remote_tag(Ptag, Stag) ->
+        FunctorRepresentation = functor_representation(Ptag, yes(Stag))
+    ;
+        unexpected($module, $pred,
+            "ConsTag is not unshared_tag or shared_remote_tag for " ++
+                ConsName)
+    ).
+
+:- func make_const_repr(string, cons_tag) = const_representation.
+
+make_const_repr(ConsName, ConsTag) = ConstRepresentation :-
+    ( ConsTag = shared_local_tag(Ptag, Stag) ->
+        Rval = mkword(Ptag, unop(mkbody, const(llconst_int(Stag)))),
+        ConstRepresentation = const_representation(Rval)
+    ; ConsTag = int_tag(Enum) ->
+        Rval = const(llconst_int(Enum)),
+        ConstRepresentation = const_representation(Rval)
+    ;
+        unexpected($module, $pred,
+            "ConsTag is not shared_local_tag or int_tag for " ++ ConsName)
+    ).
+
+:- type cons_id_representations
+    --->    cons_id_representations(
+                cir_rgp_nil                 :: const_representation,
+                cir_rgp_cons                :: functor_representation,
+
+                cir_gps_step_conj           :: functor_representation,
+                cir_gps_step_disj           :: functor_representation,
+                cir_gps_step_switch         :: functor_representation,
+                cir_gps_step_ite_cond       :: const_representation,
+                cir_gps_step_ite_then       :: const_representation,
+                cir_gps_step_ite_else       :: const_representation,
+                cir_gps_step_neg            :: const_representation,
+                cir_gps_step_scope          :: functor_representation,
+                cir_gps_step_lambda         :: const_representation,
+                cir_gps_step_try            :: const_representation,
+                cir_gps_step_main           :: const_representation,
+                cir_gps_step_orelse         :: functor_representation,
+
+                cir_snf_unknown             :: const_representation,
+                cir_snf_known               :: functor_representation,
+
+                cir_smc_no_cut              :: const_representation,
+                cir_smc_cut                 :: const_representation
+            ).
+
+:- type goal_path_table             == map(reverse_goal_path, rval).
+:- type goal_path_step_table        == map(goal_path_step, rval).
+:- type switch_num_functors_table   == map(int, rval).
+
+:- type goal_path_tables
+    --->    goal_path_tables(
+                gpts_goal_paths             :: goal_path_table,
+                gpts_goal_path_steps        :: goal_path_step_table,
+                gpts_num_functors           :: switch_num_functors_table,
+                gpts_representations        :: cons_id_representations
+            ).
+
+:- func init_goal_path_tables(type_table) = goal_path_tables.
+
+init_goal_path_tables(TypeTable) = GoalPathTables :-
+    DebugBuiltin = mercury_debug_builtin_module,
+    RgpTypeSymName = qualified(DebugBuiltin, "reverse_goal_path"),
+    GpsTypeSymName = qualified(DebugBuiltin, "goal_path_step"),
+    SnfTypeSymName = qualified(DebugBuiltin, "maybe_switch_num_functors"),
+    MscTypeSymName = qualified(DebugBuiltin, "maybe_cut"),
+    RgpTypeCtor = type_ctor(RgpTypeSymName, 0),
+    GpsTypeCtor = type_ctor(GpsTypeSymName, 0),
+    SnfTypeCtor = type_ctor(SnfTypeSymName, 0),
+    MscTypeCtor = type_ctor(MscTypeSymName, 0),
+    lookup_type_ctor_defn(TypeTable, RgpTypeCtor, RgpTypeDefn),
+    lookup_type_ctor_defn(TypeTable, GpsTypeCtor, GpsTypeDefn),
+    lookup_type_ctor_defn(TypeTable, SnfTypeCtor, SnfTypeDefn),
+    lookup_type_ctor_defn(TypeTable, MscTypeCtor, MscTypeDefn),
+    get_type_defn_body(RgpTypeDefn, RgpTypeBody),
+    get_type_defn_body(GpsTypeDefn, GpsTypeBody),
+    get_type_defn_body(SnfTypeDefn, SnfTypeBody),
+    get_type_defn_body(MscTypeDefn, MscTypeBody),
+    (
+        RgpTypeBody = hlds_du_type(_, RgpConsTagTable, _, _, _, _, _, _, _),
+        RgpNilConsId = cons(qualified(DebugBuiltin, "rgp_nil"),
+            0, RgpTypeCtor), 
+        RgpConsConsId = cons(qualified(DebugBuiltin, "rgp_cons"),
+            2, RgpTypeCtor), 
+        map.lookup(RgpConsTagTable, RgpNilConsId, RgpNilTag),
+        map.lookup(RgpConsTagTable, RgpConsConsId, RgpConsTag),
+        RgpNilRepr = make_const_repr("rgp_nil", RgpNilTag),
+        RgpConsRepr = make_functor_repr("rgp_cons", RgpConsTag)
+    ;
+        ( RgpTypeBody = hlds_eqv_type(_)
+        ; RgpTypeBody = hlds_foreign_type(_)
+        ; RgpTypeBody = hlds_solver_type(_, _)
+        ; RgpTypeBody = hlds_abstract_type(_)
+        ),
+        unexpected($module, $pred, "RgpTypeBody is not du type")
+    ),
+    (
+        GpsTypeBody = hlds_du_type(_, GpsConsTagTable, _, _, _, _, _, _, _),
+        GpsConjConsId = cons(qualified(DebugBuiltin, "step_conj"),
+            1, GpsTypeCtor), 
+        GpsDisjConsId = cons(qualified(DebugBuiltin, "step_disj"),
+            1, GpsTypeCtor), 
+        GpsSwitchConsId = cons(qualified(DebugBuiltin, "step_switch"),
+            2, GpsTypeCtor), 
+        GpsCondConsId = cons(qualified(DebugBuiltin, "step_ite_cond"),
+            0, GpsTypeCtor), 
+        GpsThenConsId = cons(qualified(DebugBuiltin, "step_ite_then"),
+            0, GpsTypeCtor), 
+        GpsElseConsId = cons(qualified(DebugBuiltin, "step_ite_else"),
+            0, GpsTypeCtor), 
+        GpsNegConsId = cons(qualified(DebugBuiltin, "step_neg"),
+            0, GpsTypeCtor), 
+        GpsScopeConsId = cons(qualified(DebugBuiltin, "step_scope"),
+            1, GpsTypeCtor), 
+        GpsLambdaConsId = cons(qualified(DebugBuiltin, "step_lambda"),
+            0, GpsTypeCtor), 
+        GpsTryConsId = cons(qualified(DebugBuiltin, "step_try"),
+            0, GpsTypeCtor), 
+        GpsMainConsId = cons(qualified(DebugBuiltin, "step_atomic_main"),
+            0, GpsTypeCtor), 
+        GpsOrElseConsId = cons(qualified(DebugBuiltin, "step_atomic_orelse"),
+            1, GpsTypeCtor), 
+        map.lookup(GpsConsTagTable, GpsConjConsId, GpsConjTag),
+        map.lookup(GpsConsTagTable, GpsDisjConsId, GpsDisjTag),
+        map.lookup(GpsConsTagTable, GpsSwitchConsId, GpsSwitchTag),
+        map.lookup(GpsConsTagTable, GpsCondConsId, GpsCondTag),
+        map.lookup(GpsConsTagTable, GpsThenConsId, GpsThenTag),
+        map.lookup(GpsConsTagTable, GpsElseConsId, GpsElseTag),
+        map.lookup(GpsConsTagTable, GpsNegConsId, GpsNegTag),
+        map.lookup(GpsConsTagTable, GpsScopeConsId, GpsScopeTag),
+        map.lookup(GpsConsTagTable, GpsLambdaConsId, GpsLambdaTag),
+        map.lookup(GpsConsTagTable, GpsTryConsId, GpsTryTag),
+        map.lookup(GpsConsTagTable, GpsMainConsId, GpsMainTag),
+        map.lookup(GpsConsTagTable, GpsOrElseConsId, GpsOrElseTag),
+        GpsConjRepr = make_functor_repr("step_conj", GpsConjTag),
+        GpsDisjRepr = make_functor_repr("step_disj", GpsDisjTag),
+        GpsSwitchRepr = make_functor_repr("step_switch", GpsSwitchTag),
+        GpsCondRepr = make_const_repr("step_ite_cond", GpsCondTag),
+        GpsThenRepr = make_const_repr("step_ite_then", GpsThenTag),
+        GpsElseRepr = make_const_repr("step_ite_else", GpsElseTag),
+        GpsNegRepr = make_const_repr("step_neg", GpsNegTag),
+        GpsScopeRepr = make_functor_repr("step_scope", GpsScopeTag),
+        GpsLambdaRepr = make_const_repr("step_lambda", GpsLambdaTag),
+        GpsTryRepr = make_const_repr("step_try", GpsTryTag),
+        GpsMainRepr = make_const_repr("step_atomic_main", GpsMainTag),
+        GpsOrElseRepr = make_functor_repr("step_atomic_orelse", GpsOrElseTag)
+    ;
+        ( GpsTypeBody = hlds_eqv_type(_)
+        ; GpsTypeBody = hlds_foreign_type(_)
+        ; GpsTypeBody = hlds_solver_type(_, _)
+        ; GpsTypeBody = hlds_abstract_type(_)
+        ),
+        unexpected($module, $pred, "GpsTypeBody is not du type")
+    ),
+    (
+        SnfTypeBody = hlds_du_type(_, SnfConsTagTable, _, _, _, _, _, _, _),
+        SnfUnknownConsId = cons(
+            qualified(DebugBuiltin, "unknown_num_functors_in_type"),
+            0, SnfTypeCtor), 
+        SnfKnownConsId =
+            cons(qualified(DebugBuiltin, "known_num_functors_in_type"),
+            1, SnfTypeCtor), 
+        map.lookup(SnfConsTagTable, SnfUnknownConsId, SnfUnknownTag),
+        map.lookup(SnfConsTagTable, SnfKnownConsId, SnfKnownTag),
+        SnfUnknownRepr = make_const_repr("unknown_num_functors_in_type",
+            SnfUnknownTag),
+        SnfKnownRepr = make_functor_repr("known_num_functors_in_type",
+            SnfKnownTag)
+    ;
+        ( SnfTypeBody = hlds_eqv_type(_)
+        ; SnfTypeBody = hlds_foreign_type(_)
+        ; SnfTypeBody = hlds_solver_type(_, _)
+        ; SnfTypeBody = hlds_abstract_type(_)
+        ),
+        unexpected($module, $pred, "SnfTypeBody is not du type")
+    ),
+
+    (
+        MscTypeBody = hlds_du_type(_, MscConsTagTable, _, _, _, _, _, _, _),
+        MscNoCutConsId = cons(qualified(DebugBuiltin, "scope_is_no_cut"),
+            0, MscTypeCtor), 
+        MscCutConsId = cons(qualified(DebugBuiltin, "scope_is_cut"),
+            0, MscTypeCtor), 
+        map.lookup(MscConsTagTable, MscNoCutConsId, MscNoCutTag),
+        map.lookup(MscConsTagTable, MscCutConsId, MscCutTag),
+        MscNoCutRepr = make_const_repr("scope_is_no_cut", MscNoCutTag),
+        MscCutRepr = make_const_repr("scope_is_cut", MscCutTag)
+    ;
+        ( MscTypeBody = hlds_eqv_type(_)
+        ; MscTypeBody = hlds_foreign_type(_)
+        ; MscTypeBody = hlds_solver_type(_, _)
+        ; MscTypeBody = hlds_abstract_type(_)
+        ),
+        unexpected($module, $pred, "MscTypeBody is not du type")
+    ),
+
+    ConsIdRepresentations = cons_id_representations(
+        RgpNilRepr, RgpConsRepr,
+        GpsConjRepr, GpsDisjRepr, GpsSwitchRepr,
+        GpsCondRepr, GpsThenRepr, GpsElseRepr,
+        GpsNegRepr, GpsScopeRepr, GpsLambdaRepr,
+        GpsTryRepr, GpsMainRepr, GpsOrElseRepr,
+        SnfUnknownRepr, SnfKnownRepr,
+        MscNoCutRepr, MscCutRepr
+    ),
+
+    map.init(GoalPathTable),
+    map.init(GoalPathStepTable),
+    map.init(SwitchNumFunctorsTable),
+
+    GoalPathTables = goal_path_tables(GoalPathTable, GoalPathStepTable,
+        SwitchNumFunctorsTable, ConsIdRepresentations).
+
+:- pred lookup_rev_goal_path_in_table(reverse_goal_path::in, rval::out,
+    goal_path_tables::in, goal_path_tables::out,
+    static_cell_info::in, static_cell_info::out) is det.
+
+lookup_rev_goal_path_in_table(RevGoalPath, Rval,
+        !GoalPathTables, !StaticCellInfo) :-
+    (
+        RevGoalPath = rgp_nil,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_rgp_nil
+    ;
+        RevGoalPath = rgp_cons(EarlierRevGoalPath, GoalPathStep),
+        GoalPathTable0 = !.GoalPathTables ^ gpts_goal_paths,
+        ( map.search(GoalPathTable0, RevGoalPath, OldRval) ->
+            Rval = OldRval
+        ;
+            lookup_rev_goal_path_in_table(EarlierRevGoalPath, EarlierRval,
+                !GoalPathTables, !StaticCellInfo),
+            lookup_goal_path_step_in_table(GoalPathStep, StepRval,
+                !GoalPathTables, !StaticCellInfo),
+
+            ConsRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_rgp_cons,
+            ArgsTypes = [EarlierRval - lt_word, StepRval - lt_word],
+            make_functor_cell(ConsRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            % We need to get the table again, since the recursive call above
+            % may have modified it.
+            GoalPathTable1 = !.GoalPathTables ^ gpts_goal_paths,
+            map.det_insert(RevGoalPath, Rval, GoalPathTable1, GoalPathTable),
+            !GoalPathTables ^ gpts_goal_paths := GoalPathTable
+        )
+    ),
+    trace [io(!IO)] (
+        RevGoalPathStr = rev_goal_path_to_string(RevGoalPath),
+        RvalStr = dump_rval(no, Rval),
+        io.write_string("<", !IO),
+        io.write_string(RevGoalPathStr, !IO),
+        io.write_string("> -> ", !IO),
+        io.write_string(RvalStr, !IO),
+        io.nl(!IO)
+    ).
+
+:- import_module io.
+:- import_module ll_backend.opt_debug.
+
+:- pred lookup_goal_path_step_in_table(goal_path_step::in, rval::out,
+    goal_path_tables::in, goal_path_tables::out,
+    static_cell_info::in, static_cell_info::out) is det.
+
+lookup_goal_path_step_in_table(GoalPathStep, Rval,
+        !GoalPathTables, !StaticCellInfo) :-
+    (
+        GoalPathStep = step_conj(StepNum),
+        GoalPathStepTable0 = !.GoalPathTables ^ gpts_goal_path_steps,
+        ( map.search(GoalPathStepTable0, GoalPathStep, OldRval) ->
+            Rval = OldRval
+        ;
+            StepConjRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_gps_step_conj,
+            ArgsTypes = [const(llconst_int(StepNum)) - lt_integer],
+            make_functor_cell(StepConjRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            map.det_insert(GoalPathStep, Rval,
+                GoalPathStepTable0, GoalPathStepTable),
+            !GoalPathTables ^ gpts_goal_path_steps := GoalPathStepTable
+        )
+    ;
+        GoalPathStep = step_disj(StepNum),
+        GoalPathStepTable0 = !.GoalPathTables ^ gpts_goal_path_steps,
+        ( map.search(GoalPathStepTable0, GoalPathStep, OldRval) ->
+            Rval = OldRval
+        ;
+            StepDisjRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_gps_step_disj,
+            ArgsTypes = [const(llconst_int(StepNum)) - lt_integer],
+            make_functor_cell(StepDisjRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            map.det_insert(GoalPathStep, Rval,
+                GoalPathStepTable0, GoalPathStepTable),
+            !GoalPathTables ^ gpts_goal_path_steps := GoalPathStepTable
+        )
+    ;
+        GoalPathStep = step_switch(StepNum, MaybeNumFunctors),
+        GoalPathStepTable0 = !.GoalPathTables ^ gpts_goal_path_steps,
+        ( map.search(GoalPathStepTable0, GoalPathStep, OldRval) ->
+            Rval = OldRval
+        ;
+            lookup_switch_num_functors_in_table(MaybeNumFunctors, MsnRval,
+                !GoalPathTables, !StaticCellInfo),
+            StepSwitchRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_gps_step_switch,
+            ArgsTypes = [const(llconst_int(StepNum)) - lt_integer,
+                MsnRval - lt_word],
+            make_functor_cell(StepSwitchRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            GoalPathStepTable1 = !.GoalPathTables ^ gpts_goal_path_steps,
+            map.det_insert(GoalPathStep, Rval,
+                GoalPathStepTable1, GoalPathStepTable),
+            !GoalPathTables ^ gpts_goal_path_steps := GoalPathStepTable
+        )
+    ;
+        GoalPathStep = step_ite_cond,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_ite_cond
+    ;
+        GoalPathStep = step_ite_then,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_ite_then
+    ;
+        GoalPathStep = step_ite_else,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_ite_else
+    ;
+        GoalPathStep = step_neg,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_neg
+    ;
+        GoalPathStep = step_scope(MaybeCut),
+        GoalPathStepTable0 = !.GoalPathTables ^ gpts_goal_path_steps,
+        ( map.search(GoalPathStepTable0, GoalPathStep, OldRval) ->
+            Rval = OldRval
+        ;
+            StepScopeRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_gps_step_scope,
+            (
+                MaybeCut = scope_is_no_cut,
+                const_representation(SmcRval) =
+                    !.GoalPathTables ^ gpts_representations ^ cir_smc_no_cut
+            ;
+                MaybeCut = scope_is_cut,
+                const_representation(SmcRval) =
+                    !.GoalPathTables ^ gpts_representations ^ cir_smc_cut
+            ),
+            ArgsTypes = [SmcRval - lt_word],
+            make_functor_cell(StepScopeRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            map.det_insert(GoalPathStep, Rval,
+                GoalPathStepTable0, GoalPathStepTable),
+            !GoalPathTables ^ gpts_goal_path_steps := GoalPathStepTable
+        )
+    ;
+        GoalPathStep = step_lambda,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_lambda
+    ;
+        GoalPathStep = step_try,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_try
+    ;
+        GoalPathStep = step_atomic_main,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_gps_step_main
+    ;
+        GoalPathStep = step_atomic_orelse(StepNum),
+        GoalPathStepTable0 = !.GoalPathTables ^ gpts_goal_path_steps,
+        ( map.search(GoalPathStepTable0, GoalPathStep, OldRval) ->
+            Rval = OldRval
+        ;
+            StepOrElseRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_gps_step_orelse,
+            ArgsTypes = [const(llconst_int(StepNum)) - lt_integer],
+            make_functor_cell(StepOrElseRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            map.det_insert(GoalPathStep, Rval,
+                GoalPathStepTable0, GoalPathStepTable),
+            !GoalPathTables ^ gpts_goal_path_steps := GoalPathStepTable
+        )
+    ),
+    trace [io(!IO)] (
+        StepStr = rev_goal_path_to_string(rgp_cons(rgp_nil, GoalPathStep)),
+        RvalStr = dump_rval(no, Rval),
+        io.write_string("STEP ", !IO),
+        io.write_string(StepStr, !IO),
+        io.write_string(" -> ", !IO),
+        io.write_string(RvalStr, !IO),
+        io.nl(!IO)
+    ).
+
+:- pred lookup_switch_num_functors_in_table(maybe_switch_num_functors::in,
+    rval::out, goal_path_tables::in, goal_path_tables::out,
+    static_cell_info::in, static_cell_info::out) is det.
+
+lookup_switch_num_functors_in_table(MaybeNumFunctors, Rval,
+        !GoalPathTables, !StaticCellInfo) :-
+    (
+        MaybeNumFunctors = unknown_num_functors_in_type,
+        const_representation(Rval) =
+            !.GoalPathTables ^ gpts_representations ^ cir_snf_unknown
+    ;
+        MaybeNumFunctors = known_num_functors_in_type(NumFunctors),
+        NumFunctorsTable0 = !.GoalPathTables ^ gpts_num_functors,
+        ( map.search(NumFunctorsTable0, NumFunctors, OldRval) ->
+            Rval = OldRval
+        ;
+            KnownRepresentation =
+                !.GoalPathTables ^ gpts_representations ^ cir_snf_known,
+            ArgsTypes = [const(llconst_int(NumFunctors)) - lt_integer],
+            make_functor_cell(KnownRepresentation, ArgsTypes, Rval,
+                !StaticCellInfo),
+
+            map.det_insert(NumFunctors, Rval,
+                NumFunctorsTable0, NumFunctorsTable),
+            !GoalPathTables ^ gpts_num_functors := NumFunctorsTable
+        )
+    ).
+
+:- pred make_functor_cell(functor_representation::in,
+    assoc_list(rval, llds_type)::in, rval::out,
+    static_cell_info::in, static_cell_info::out) is det.
+
+make_functor_cell(FunctorRepresentation, MainArgsTypes, Rval,
+        !StaticCellInfo) :-
+    FunctorRepresentation = functor_representation(Ptag, MaybeStag),
+    (
+        MaybeStag = no,
+        ArgsTypes = MainArgsTypes
+    ;
+        MaybeStag = yes(Stag),
+        ArgsTypes = [const(llconst_int(Stag)) - lt_integer
+            | MainArgsTypes]
+    ),
+    add_scalar_static_cell(ArgsTypes, DataId, !StaticCellInfo),
+    MaybeOffset = no,
+    CellPtrConst = const(llconst_data_addr(DataId, MaybeOffset)),
+    Rval = mkword(Ptag, CellPtrConst).
+
+%---------------------------------------------------------------------------%
 :- end_module ll_backend.stack_layout.
 %---------------------------------------------------------------------------%
Index: compiler/trace_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_gen.m,v
retrieving revision 1.41
diff -u -b -r1.41 trace_gen.m
--- compiler/trace_gen.m	26 Sep 2011 07:08:56 -0000	1.41
+++ compiler/trace_gen.m	26 Sep 2011 11:06:43 -0000
@@ -249,6 +249,7 @@
 
 :- import_module bool.
 :- import_module cord.
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module list.
 :- import_module require.
@@ -264,14 +265,14 @@
     --->    port_info_external
     ;       port_info_tailrec_call(
                 % The id of the tail recursive call.
-                forward_goal_path,
+                reverse_goal_path,
 
                 % The list of arguments of this call.
                 assoc_list(prog_var, arg_info)
             )
     ;       port_info_internal(
                 % The id of the goal whose start this port represents.
-                forward_goal_path,
+                reverse_goal_path,
 
                 % The pre-death set of this goal.
                 set_of_progvar
@@ -279,11 +280,11 @@
     ;       port_info_negation_end(
                 % The id of the goal whose end (one way or another)
                 % this port represents.
-                forward_goal_path
+                reverse_goal_path
             )
     ;       port_info_user(
                 % The id of the goal.
-                forward_goal_path
+                reverse_goal_path
             ).
 
 trace_fail_vars(ModuleInfo, ProcInfo, FailVars) :-
@@ -815,9 +816,10 @@
             ;
                 HideEvent = no
             ),
-            GoalPath = goal_id_to_forward_path(ContainingGoalMap, GoalId),
-            generate_event_code(Port, port_info_internal(GoalPath, PreDeaths),
-                yes(TraceInfo), Context, HideEvent, no, _, _, Code, !CI)
+            RevGoalPath = goal_id_to_reverse_path(ContainingGoalMap, GoalId),
+            PortInfo = port_info_internal(RevGoalPath, PreDeaths),
+            generate_event_code(Port, PortInfo, yes(TraceInfo), Context,
+                HideEvent, no, _, _, Code, !CI)
         ;
             Code = empty
         )
@@ -853,9 +855,10 @@
             HideEvent = no
         ),
         get_containing_goal_map_det(!.CI, ContainingGoalMap),
-        GoalPath = goal_id_to_forward_path(ContainingGoalMap, GoalId),
-        generate_event_code(Port, port_info_negation_end(GoalPath),
-            yes(TraceInfo), Context, HideEvent, no, _, _, Code, !CI)
+        RevGoalPath = goal_id_to_reverse_path(ContainingGoalMap, GoalId),
+        PortInfo = port_info_negation_end(RevGoalPath),
+        generate_event_code(Port, PortInfo, yes(TraceInfo), Context,
+            HideEvent, no, _, _, Code, !CI)
     ;
         Code = empty
     ).
@@ -863,10 +866,10 @@
 generate_user_event_code(UserInfo, GoalInfo, Code, !CI) :-
     GoalId = goal_info_get_goal_id(GoalInfo),
     get_containing_goal_map_det(!.CI, ContainingGoalMap),
-    GoalPath = goal_id_to_forward_path(ContainingGoalMap, GoalId),
+    RevGoalPath = goal_id_to_reverse_path(ContainingGoalMap, GoalId),
     Context = goal_info_get_context(GoalInfo),
     Port = port_user,
-    PortInfo = port_info_user(GoalPath),
+    PortInfo = port_info_user(RevGoalPath),
     MaybeTraceInfo = no,
     HideEvent = no,
     generate_event_code(Port, PortInfo, MaybeTraceInfo, Context, HideEvent,
@@ -894,8 +897,8 @@
         TailRecLabel, !CI) :-
     Port = port_tailrec_call,
     get_containing_goal_map_det(!.CI, ContainingGoalMap),
-    GoalPath = goal_id_to_forward_path(ContainingGoalMap, GoalId),
-    PortInfo = port_info_tailrec_call(GoalPath, ArgsInfos),
+    RevGoalPath = goal_id_to_reverse_path(ContainingGoalMap, GoalId),
+    PortInfo = port_info_tailrec_call(RevGoalPath, ArgsInfos),
     HideEvent = no,
     MaybeUserInfo = no,
     generate_event_code(Port, PortInfo, yes(TraceInfo), Context, HideEvent,
@@ -1018,10 +1021,10 @@
     (
         PortInfo = port_info_external,
         LiveVars = LiveVars0,
-        Path = fgp_nil,
+        RevGoalPath = rgp_nil,
         TailRecResetCode = empty
     ;
-        PortInfo = port_info_tailrec_call(Path, ArgsInfos),
+        PortInfo = port_info_tailrec_call(RevGoalPath, ArgsInfos),
         % The pre_goal_update has added the output variables of the recursive
         % call to the set of live variables; we must undo this.
         find_output_vars(ArgsInfos, [], OutputVars),
@@ -1035,18 +1038,18 @@
             unexpected($module, $pred, "tailrec call without TraceInfo")
         )
     ;
-        PortInfo = port_info_internal(Path, PreDeaths),
+        PortInfo = port_info_internal(RevGoalPath, PreDeaths),
         ResumeVars = current_resume_point_vars(!.CI),
         set_of_var.difference(PreDeaths, ResumeVars, RealPreDeaths),
         RealPreDeathList = set_of_var.to_sorted_list(RealPreDeaths),
         list.delete_elems(LiveVars0, RealPreDeathList, LiveVars),
         TailRecResetCode = empty
     ;
-        PortInfo = port_info_negation_end(Path),
+        PortInfo = port_info_negation_end(RevGoalPath),
         LiveVars = LiveVars0,
         TailRecResetCode = empty
     ;
-        PortInfo = port_info_user(Path),
+        PortInfo = port_info_user(RevGoalPath),
         LiveVars = LiveVars0,
         TailRecResetCode = empty
     ),
@@ -1087,11 +1090,11 @@
         TraceStmt0 = "\t\tMR_EVENT_USER\n"
     ),
     TraceStmt = "\t\t/* port " ++ trace_port_to_string(Port) ++ ", " ++
-        "path <" ++ goal_path_to_string(Path) ++ "> */\n" ++
+        "path <" ++ rev_goal_path_to_string(RevGoalPath) ++ "> */\n" ++
         TraceStmt0,
 
     add_trace_layout_for_label(Label, Context, Port, HideEvent,
-        Path, MaybeUserInfo, LayoutLabelInfo, !CI),
+        RevGoalPath, MaybeUserInfo, LayoutLabelInfo, !CI),
     set_proc_trace_events(yes, !CI),
     (
         Port = port_fail,
@@ -1108,7 +1111,7 @@
         % for the redo event, whose layout information is filled in when
         % we get to the fail event.
         add_trace_layout_for_label(RedoLabel, Context, port_redo,
-            HideEvent, Path, no, LayoutLabelInfo, !CI)
+            HideEvent, RevGoalPath, no, LayoutLabelInfo, !CI)
     ;
         true
     ),
Index: compiler/tupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tupling.m,v
retrieving revision 1.66
diff -u -b -r1.66 tupling.m
--- compiler/tupling.m	26 Sep 2011 07:08:56 -0000	1.66
+++ compiler/tupling.m	26 Sep 2011 09:11:24 -0000
@@ -130,6 +130,7 @@
 :- import_module assoc_list.
 :- import_module bool.
 :- import_module counter.
+:- import_module debug_builtin.
 :- import_module digraph.
 :- import_module float.
 :- import_module int.
Index: compiler/unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.210
diff -u -b -r1.210 unify_gen.m
--- compiler/unify_gen.m	16 Sep 2011 07:03:35 -0000	1.210
+++ compiler/unify_gen.m	27 Sep 2011 06:46:37 -0000
@@ -1815,8 +1815,8 @@
 
 generate_ground_term_arg(Var, ConsArgWidth, RvalType, !ActiveMap) :-
     map.det_remove(Var, RvalType0, !ActiveMap),
-    % Though a standalone float might have needed to boxed, it may be stored in
-    % unboxed form as a constructor argument.
+    % Though standalone floats may have to be boxed, they may be stored
+    % in heap cells in unboxed form.
     (
         ConsArgWidth = double_word,
         RvalType0 = Rval - lt_data_ptr
@@ -1984,16 +1984,12 @@
 :- pred var_type_msg(mer_type::in, string::out) is det.
 
 var_type_msg(Type, Msg) :-
-    ( type_to_ctor_and_args(Type, TypeCtor, _) ->
+    type_to_ctor_det(Type, TypeCtor),
         TypeCtor = type_ctor(TypeSym, TypeArity),
         TypeSymStr = sym_name_to_string(TypeSym),
         string.int_to_string(TypeArity, TypeArityStr),
-        string.append_list([TypeSymStr, "/", TypeArityStr], Msg)
-    ;
-        unexpected($module, $pred,
-            "type is still a type variable in var_type_msg")
-    ).
+    string.append_list([TypeSymStr, "/", TypeArityStr], Msg).
 
 %---------------------------------------------------------------------------%
-:- end_module unify_gen.
+:- end_module ll_backend.unify_gen.
 %---------------------------------------------------------------------------%
Index: compiler/unneeded_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unneeded_code.m,v
retrieving revision 1.64
diff -u -b -r1.64 unneeded_code.m
--- compiler/unneeded_code.m	26 Sep 2011 07:08:56 -0000	1.64
+++ compiler/unneeded_code.m	26 Sep 2011 08:58:31 -0000
@@ -91,6 +91,7 @@
 
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module io.
 :- import_module list.
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
Index: deep_profiler/analysis_utils.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/analysis_utils.m,v
retrieving revision 1.12
diff -u -b -r1.12 analysis_utils.m
--- deep_profiler/analysis_utils.m	16 Sep 2011 08:18:31 -0000	1.12
+++ deep_profiler/analysis_utils.m	26 Sep 2011 09:31:50 -0000
@@ -18,13 +18,13 @@
 :- interface.
 
 :- import_module mdbcomp.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.program_representation.
 :- import_module measurements.
 :- import_module profile.
 :- import_module report.
 
 :- import_module assoc_list.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
@@ -108,6 +108,7 @@
 
 :- implementation.
 
+:- import_module mdbcomp.goal_path.
 :- import_module program_representation_utils.
 
 :- import_module array.
Index: deep_profiler/autopar_costs.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/autopar_costs.m,v
retrieving revision 1.3
diff -u -b -r1.3 autopar_costs.m
--- deep_profiler/autopar_costs.m	26 Sep 2011 07:08:57 -0000	1.3
+++ deep_profiler/autopar_costs.m	26 Sep 2011 09:28:02 -0000
@@ -18,13 +18,13 @@
 :- interface.
 
 :- import_module mdbcomp.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.program_representation.
 :- import_module mdprof_fb.automatic_parallelism.autopar_types.
 :- import_module measurements.
 :- import_module report.
 :- import_module var_use_analysis.
 
+:- import_module debug_builtin.
 :- import_module lazy.
 :- import_module list.
 :- import_module map.
Index: deep_profiler/autopar_reports.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/autopar_reports.m,v
retrieving revision 1.4
diff -u -b -r1.4 autopar_reports.m
--- deep_profiler/autopar_reports.m	26 Sep 2011 07:08:57 -0000	1.4
+++ deep_profiler/autopar_reports.m	26 Sep 2011 09:32:25 -0000
@@ -41,6 +41,7 @@
 :- import_module program_representation_utils.
 
 :- import_module assoc_list.
+:- import_module debug_builtin.
 :- import_module float.
 :- import_module int.
 :- import_module list.
Index: deep_profiler/autopar_search_callgraph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/autopar_search_callgraph.m,v
retrieving revision 1.8
diff -u -b -r1.8 autopar_search_callgraph.m
--- deep_profiler/autopar_search_callgraph.m	27 Sep 2011 04:41:25 -0000	1.8
+++ deep_profiler/autopar_search_callgraph.m	27 Sep 2011 04:46:22 -0000
@@ -63,17 +63,18 @@
 :- import_module report.
 :- import_module var_use_analysis.
 
-:- import_module pair.
-:- import_module list.
 :- import_module array.
 :- import_module assoc_list.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module float.
-:- import_module io.
 :- import_module int.
+:- import_module io.
 :- import_module lazy.
+:- import_module list.
 :- import_module map.
 :- import_module maybe.
+:- import_module pair.
 :- import_module require.
 :- import_module set.
 :- import_module string.
Index: deep_profiler/autopar_search_goals.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/autopar_search_goals.m,v
retrieving revision 1.5
diff -u -b -r1.5 autopar_search_goals.m
--- deep_profiler/autopar_search_goals.m	26 Sep 2011 07:08:57 -0000	1.5
+++ deep_profiler/autopar_search_goals.m	26 Sep 2011 09:28:20 -0000
@@ -26,6 +26,7 @@
 :- import_module message.
 
 :- import_module cord.
+:- import_module debug_builtin.
 
 %-----------------------------------------------------------------------------%
 
Index: deep_profiler/autopar_types.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/autopar_types.m,v
retrieving revision 1.2
diff -u -b -r1.2 autopar_types.m
--- deep_profiler/autopar_types.m	27 Jan 2011 08:03:53 -0000	1.2
+++ deep_profiler/autopar_types.m	26 Sep 2011 09:28:24 -0000
@@ -31,6 +31,7 @@
 
 :- import_module array.
 :- import_module assoc_list.
+:- import_module debug_builtin.
 :- import_module digraph.
 :- import_module lazy.
 :- import_module list.
Index: deep_profiler/coverage.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/coverage.m,v
retrieving revision 1.16
diff -u -b -r1.16 coverage.m
--- deep_profiler/coverage.m	3 May 2011 04:35:00 -0000	1.16
+++ deep_profiler/coverage.m	26 Sep 2011 09:27:03 -0000
@@ -24,6 +24,7 @@
 :- import_module measurements.
 
 :- import_module array.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 
Index: deep_profiler/create_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/create_report.m,v
retrieving revision 1.36
diff -u -b -r1.36 create_report.m
--- deep_profiler/create_report.m	26 Sep 2011 07:08:57 -0000	1.36
+++ deep_profiler/create_report.m	26 Sep 2011 09:32:01 -0000
@@ -96,6 +96,7 @@
 
 :- import_module array.
 :- import_module char.
+:- import_module debug_builtin.
 :- import_module float.
 :- import_module int.
 :- import_module list.
Index: deep_profiler/message.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/message.m,v
retrieving revision 1.18
diff -u -b -r1.18 message.m
--- deep_profiler/message.m	27 Sep 2011 04:41:25 -0000	1.18
+++ deep_profiler/message.m	27 Sep 2011 04:46:22 -0000
@@ -19,11 +19,11 @@
 :- interface.
 
 :- import_module mdbcomp.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.program_representation.
 :- import_module profile.
 
 :- import_module cord.
+:- import_module debug_builtin.
 :- import_module io.
 
 %-----------------------------------------------------------------------------%
@@ -194,6 +194,7 @@
 
 :- implementation.
 
+:- import_module mdbcomp.goal_path.
 :- import_module program_representation_utils.
 
 :- import_module int.
Index: deep_profiler/profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/profile.m,v
retrieving revision 1.36
diff -u -b -r1.36 profile.m
--- deep_profiler/profile.m	6 May 2011 15:19:33 -0000	1.36
+++ deep_profiler/profile.m	26 Sep 2011 09:26:22 -0000
@@ -26,11 +26,11 @@
 :- import_module exclude.
 :- import_module measurements.
 :- import_module mdbcomp.
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.program_representation.
 
 :- import_module array.
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
Index: deep_profiler/program_representation_utils.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/program_representation_utils.m,v
retrieving revision 1.36
diff -u -b -r1.36 program_representation_utils.m
--- deep_profiler/program_representation_utils.m	26 Sep 2011 07:08:57 -0000	1.36
+++ deep_profiler/program_representation_utils.m	26 Sep 2011 09:29:00 -0000
@@ -25,6 +25,7 @@
 :- import_module mdbcomp.program_representation.
 
 :- import_module cord.
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module set.
 :- import_module unit.
Index: deep_profiler/read_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.38
diff -u -b -r1.38 read_profile.m
--- deep_profiler/read_profile.m	26 Sep 2011 07:08:57 -0000	1.38
+++ deep_profiler/read_profile.m	26 Sep 2011 09:34:08 -0000
@@ -42,6 +42,7 @@
 :- import_module array.
 :- import_module bool.
 :- import_module char.
+:- import_module debug_builtin.
 :- import_module int.
 :- import_module list.
 :- import_module pair.
Index: deep_profiler/recursion_patterns.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/recursion_patterns.m,v
retrieving revision 1.17
diff -u -b -r1.17 recursion_patterns.m
--- deep_profiler/recursion_patterns.m	26 Sep 2011 07:08:57 -0000	1.17
+++ deep_profiler/recursion_patterns.m	26 Sep 2011 09:27:20 -0000
@@ -57,6 +57,7 @@
 
 :- import_module array.
 :- import_module assoc_list.
+:- import_module debug_builtin.
 :- import_module float.
 :- import_module int.
 :- import_module io.
Index: deep_profiler/report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/report.m,v
retrieving revision 1.32
diff -u -b -r1.32 report.m
--- deep_profiler/report.m	3 May 2011 04:35:00 -0000	1.32
+++ deep_profiler/report.m	26 Sep 2011 09:26:35 -0000
@@ -32,6 +32,7 @@
 :- import_module query.
 :- import_module var_use_analysis.
 
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
Index: deep_profiler/var_use_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/var_use_analysis.m,v
retrieving revision 1.17
diff -u -b -r1.17 var_use_analysis.m
--- deep_profiler/var_use_analysis.m	26 Sep 2011 07:08:57 -0000	1.17
+++ deep_profiler/var_use_analysis.m	26 Sep 2011 09:29:13 -0000
@@ -29,6 +29,7 @@
 :- import_module profile.
 :- import_module report.
 
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module map.
 :- import_module maybe.
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/Mmakefile,v
retrieving revision 1.56
diff -u -b -r1.56 Mmakefile
--- doc/Mmakefile	18 Aug 2011 17:19:25 -0000	1.56
+++ doc/Mmakefile	26 Sep 2011 07:31:47 -0000
@@ -250,6 +250,8 @@
 				;;					\
 			$(LIBRARY_DIR)/profiling_builtin.m)		\
 				;;					\
+			$(LIBRARY_DIR)/debug_builtin.m)			\
+				;;					\
 			$(LIBRARY_DIR)/par_builtin.m)			\
 				;;					\
 			$(LIBRARY_DIR)/rtti_implementation.m)		\
@@ -292,6 +294,8 @@
 				;;					\
 			$(LIBRARY_DIR)/profiling_builtin.m)		\
 				;;					\
+			$(LIBRARY_DIR)/debug_builtin.m)			\
+				;;					\
 			$(LIBRARY_DIR)/par_builtin.m)			\
 				;;					\
 			$(LIBRARY_DIR)/rtti_implementation.m)		\
@@ -372,8 +376,7 @@
 	-[ -d $(INSTALL_TEXT_DIR) ] || mkdir -p $(INSTALL_TEXT_DIR)
 	-[ -d $(INSTALL_PS_DIR) ] || mkdir -p $(INSTALL_PS_DIR)
 	-[ -d $(INSTALL_PDF_DIR) ] || mkdir -p $(INSTALL_PDF_DIR)
-	-[ -d $(INSTALL_MAN_DIR)/man1 ] || \
-		mkdir -p $(INSTALL_MAN_DIR)/man1
+	-[ -d $(INSTALL_MAN_DIR)/man1 ] || mkdir -p $(INSTALL_MAN_DIR)/man1
 	-[ -d $(INSTALL_MDB_DOC_DIR) ] || mkdir -p $(INSTALL_MDB_DOC_DIR)
 	-[ -d $(INSTALL_WEBPAGE_DIR) ] || mkdir -p $(INSTALL_WEBPAGE_DIR)
 
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/monte
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/debug_builtin.m
===================================================================
RCS file: library/debug_builtin.m
diff -N library/debug_builtin.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ library/debug_builtin.m	27 Sep 2011 06:33:43 -0000
@@ -0,0 +1,61 @@
+%---------------------------------------------------------------------------%
+% vim: ft=mercury ts=8 sw=4 sts=4 et
+%---------------------------------------------------------------------------%
+% Copyright (C) 2011 The University of Melbourne.
+% This file may only be copied under the terms of the GNU Library General
+% Public License - see the file COPYING.LIB in the Mercury distribution.
+%---------------------------------------------------------------------------%
+%
+% File: debug_builtin.m.
+% Main author: zs.
+% Stability: low.
+%
+% This file is automatically imported, as if via `use_module', into every
+% module in debug grades. It is intended to hold the types of data structures
+% that the compiler emits when generating RTTI for the debugger.
+%
+% This module is a private part of the Mercury implementation; user modules
+% should never explicitly import this module. The interface for this module
+% does not get included in the Mercury library reference manual.
+%
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+
+:- module debug_builtin.
+:- interface.
+
+:- type forward_goal_path
+    --->    fgp_nil
+    ;       fgp_cons(goal_path_step, forward_goal_path).
+
+:- type reverse_goal_path
+    --->    rgp_nil
+    ;       rgp_cons(reverse_goal_path, goal_path_step).
+
+:- type goal_path_step
+    --->    step_conj(int)
+    ;       step_disj(int)
+    ;       step_switch(int, maybe_switch_num_functors)
+    ;       step_ite_cond
+    ;       step_ite_then
+    ;       step_ite_else
+    ;       step_neg
+    ;       step_scope(maybe_cut)
+    ;       step_lambda
+    ;       step_try
+    ;       step_atomic_main
+    ;       step_atomic_orelse(int).
+
+    % The number of functors in the type of the switched-on variable, if known.
+    %
+:- type maybe_switch_num_functors
+    --->    unknown_num_functors_in_type
+    ;       known_num_functors_in_type(int).
+
+    % Does the scope goal have a different determinism inside than outside?
+:- type maybe_cut
+    --->    scope_is_cut
+    ;       scope_is_no_cut.
+
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
Index: library/library.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/library.m,v
retrieving revision 1.133
diff -u -b -r1.133 library.m
--- library/library.m	22 Aug 2011 06:33:02 -0000	1.133
+++ library/library.m	26 Sep 2011 07:29:11 -0000
@@ -62,6 +62,7 @@
 :- import_module construct.
 :- import_module cord.
 :- import_module counter.
+:- import_module debug_builtin.
 :- import_module deconstruct.
 :- import_module digraph.
 :- import_module dir.
@@ -232,6 +233,7 @@
 mercury_std_library_module("construct").
 mercury_std_library_module("cord").
 mercury_std_library_module("counter").
+mercury_std_library_module("debug_builtin").
 mercury_std_library_module("deconstruct").
 mercury_std_library_module("digraph").
 mercury_std_library_module("dir").
cvs diff: Diffing mdbcomp
Index: mdbcomp/mdbcomp.goal_path.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/mdbcomp.goal_path.m,v
retrieving revision 1.8
diff -u -b -r1.8 mdbcomp.goal_path.m
--- mdbcomp/mdbcomp.goal_path.m	27 Sep 2011 00:49:27 -0000	1.8
+++ mdbcomp/mdbcomp.goal_path.m	27 Sep 2011 04:46:24 -0000
@@ -54,6 +54,7 @@
 :- import_module array.
 :- import_module bimap.
 :- import_module char.
+:- import_module debug_builtin.
 :- import_module map.
 :- import_module maybe.
 
@@ -64,43 +65,10 @@
 
 :- pred is_valid_goal_id(goal_id::in) is semidet.
 
-:- type forward_goal_path
-    --->    fgp_nil
-    ;       fgp_cons(goal_path_step, forward_goal_path).
-
-:- type reverse_goal_path
-    --->    rgp_nil
-    ;       rgp_cons(reverse_goal_path, goal_path_step).
+:- func whole_body_goal_id = goal_id.
 
 :- type goal_path_string == string.
 
-:- type goal_path_step
-    --->    step_conj(int)
-    ;       step_disj(int)
-    ;       step_switch(int, maybe_switch_num_functors)
-    ;       step_ite_cond
-    ;       step_ite_then
-    ;       step_ite_else
-    ;       step_neg
-    ;       step_scope(maybe_cut)
-    ;       step_lambda
-    ;       step_try
-    ;       step_atomic_main
-    ;       step_atomic_orelse(int).
-
-    % The number of functors in the type of the switched-on variable, if known.
-    %
-:- type maybe_switch_num_functors
-    --->    unknown_num_functors_in_type
-    ;       known_num_functors_in_type(int).
-
-    % Does the scope goal have a different determinism inside than outside?
-:- type maybe_cut
-    --->    scope_is_cut
-    ;       scope_is_no_cut.
-
-:- func whole_body_goal_id = goal_id.
-
     % Append a goal path step onto the end of a goal path.
     %
 :- func goal_path_add_at_end(forward_goal_path, goal_path_step) =
@@ -323,6 +291,7 @@
 :- implementation.
 
 :- import_module assoc_list.
+:- import_module bool.
 :- import_module cord.
 :- import_module int.
 :- import_module list.
@@ -473,6 +442,9 @@
 
 is_goal_path_separator(';').
 
+:- pragma foreign_export("C", goal_path_to_string(in) = out,
+    "MR_MDBCOMP_goal_path_to_string").
+
 goal_path_to_string(GoalPath) = GoalPathStr :-
     StepStrs = goal_path_to_strings(GoalPath),
     string.append_list(StepStrs, GoalPathStr).
@@ -484,6 +456,9 @@
     Str = goal_path_step_to_string(Step),
     Strs = goal_path_to_strings(Steps).
 
+:- pragma foreign_export("C", rev_goal_path_to_string(in) = out,
+    "MR_MDBCOMP_rev_goal_path_to_string").
+
 rev_goal_path_to_string(GoalPath) = GoalPathStr :-
     RevStepStrs = rev_goal_path_to_strings(GoalPath),
     list.reverse(RevStepStrs, StepStrs),
@@ -544,6 +519,22 @@
         !:Step = step_switch(N, unknown_num_functors_in_type)
     ).
 
+:- func goals_in_same_construct(reverse_goal_path, reverse_goal_path) = bool.
+
+:- pragma foreign_export("C", goals_in_same_construct(in, in) = out,
+    "MR_MDBCOMP_goals_in_same_construct").
+
+goals_in_same_construct(PathA, PathB) = Same :-
+    (
+        PathA = rgp_cons(EarlierStepsA, _LastStepA),
+        PathB = rgp_cons(EarlierStepsB, _LastStepB),
+        EarlierStepsA = EarlierStepsB
+    ->
+        Same = yes
+    ;
+        Same = no
+    ).
+
 %-----------------------------------------------------------------------------%
 
 goal_id_inside(ContainingGoalId, GoalIdA, GoalIdB) :-
Index: mdbcomp/prim_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/prim_data.m,v
retrieving revision 1.38
diff -u -b -r1.38 prim_data.m
--- mdbcomp/prim_data.m	26 Sep 2011 04:30:47 -0000	1.38
+++ mdbcomp/prim_data.m	26 Sep 2011 10:03:33 -0000
@@ -284,6 +284,11 @@
     %
 :- func mercury_private_builtin_module = sym_name.
 
+    % Returns the name of the module containing builtins for debugging.
+    % This module is automatically imported iff executing tracing is enabled.
+    %
+:- func mercury_debug_builtin_module = sym_name.
+
     % Returns the name of the module containing builtins for region-based
     % memory management.  This module is automatically imported iff
     % RBMM is enabled.
@@ -550,6 +555,7 @@
 all_builtin_modules = [
     mercury_public_builtin_module,
     mercury_private_builtin_module,
+    mercury_debug_builtin_module,
     mercury_region_builtin_module,
     mercury_stm_builtin_module,
     mercury_table_builtin_module,
@@ -567,6 +573,7 @@
 %       qualified(unqualified("std"), "private_builtin"))).
 mercury_public_builtin_module = unqualified("builtin").
 mercury_private_builtin_module = unqualified("private_builtin").
+mercury_debug_builtin_module = unqualified("debug_builtin").
 mercury_region_builtin_module = unqualified("region_builtin").
 mercury_stm_builtin_module = unqualified("stm_builtin").
 % Exception is a non-builtin module needed by the STM system.
@@ -597,6 +604,7 @@
 any_mercury_builtin_module(Module) :-
     ( Module = mercury_public_builtin_module
     ; Module = mercury_private_builtin_module
+    ; Module = mercury_debug_builtin_module
     ; Module = mercury_region_builtin_module
     ; Module = mercury_table_builtin_module
     ; Module = mercury_profiling_builtin_module
Index: mdbcomp/program_representation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/program_representation.m,v
retrieving revision 1.64
diff -u -b -r1.64 program_representation.m
--- mdbcomp/program_representation.m	27 Sep 2011 00:49:27 -0000	1.64
+++ mdbcomp/program_representation.m	27 Sep 2011 04:46:24 -0000
@@ -35,11 +35,11 @@
 :- module mdbcomp.program_representation.
 :- interface.
 
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.prim_data.
 :- import_module mdbcomp.rtti_access.
 
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module io.
 :- import_module list.
 :- import_module map.
Index: mdbcomp/rtti_access.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/rtti_access.m,v
retrieving revision 1.21
diff -u -b -r1.21 rtti_access.m
--- mdbcomp/rtti_access.m	26 Sep 2011 04:29:36 -0000	1.21
+++ mdbcomp/rtti_access.m	26 Sep 2011 08:09:56 -0000
@@ -17,10 +17,10 @@
 :- module mdbcomp.rtti_access.
 :- interface.
 
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.prim_data.
 :- import_module mdbcomp.trace_counts.
 
+:- import_module debug_builtin.
 :- import_module list.
 :- import_module maybe.
 
@@ -28,9 +28,10 @@
 
 :- func get_proc_layout_from_label_layout(label_layout) = proc_layout.
 
-:- func get_goal_path_from_label_layout(label_layout) = goal_path_string.
+:- func get_rev_goal_path_from_label_layout(label_layout) = reverse_goal_path.
 
-:- func get_goal_path_from_maybe_label(maybe(label_layout)) = goal_path_string.
+:- func get_rev_goal_path_from_maybe_label(maybe(label_layout))
+    = reverse_goal_path.
 
 :- func get_port_from_label_layout(label_layout) = trace_port.
 
@@ -191,15 +192,15 @@
 ").
 
 :- pragma foreign_proc("C",
-    get_goal_path_from_label_layout(Label::in) = (GoalPath::out),
+    get_rev_goal_path_from_label_layout(Label::in) = (GoalPath::out),
     [will_not_call_mercury, thread_safe, promise_pure],
 "
-    GoalPath = (MR_String) MR_label_goal_path(Label);
+    GoalPath = MR_label_rev_goal_path(Label);
 ").
 
-get_goal_path_from_maybe_label(yes(Label))
-    = get_goal_path_from_label_layout(Label).
-get_goal_path_from_maybe_label(no) = "".
+get_rev_goal_path_from_maybe_label(yes(Label))
+    = get_rev_goal_path_from_label_layout(Label).
+get_rev_goal_path_from_maybe_label(no) = rgp_nil.
 
 :- pragma foreign_proc("C",
     get_context_from_label_layout(Label::in, FileName::out, LineNo::out),
@@ -224,9 +225,8 @@
 
 get_path_port_from_label_layout(Label) = PathPort :-
     Port = get_port_from_label_layout(Label),
-    GoalPathStr = get_goal_path_from_label_layout(Label),
-    rev_goal_path_from_string_det(GoalPathStr, GoalPath),
-    PathPort = make_path_port(GoalPath, Port).
+    RevGoalPath = get_rev_goal_path_from_label_layout(Label),
+    PathPort = make_path_port(RevGoalPath, Port).
 
 %-----------------------------------------------------------------------------%
 
Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.31
diff -u -b -r1.31 trace_counts.m
--- mdbcomp/trace_counts.m	26 Sep 2011 04:30:47 -0000	1.31
+++ mdbcomp/trace_counts.m	26 Sep 2011 08:10:37 -0000
@@ -18,10 +18,10 @@
 :- module mdbcomp.trace_counts.
 :- interface.
 
-:- import_module mdbcomp.goal_path.
 :- import_module mdbcomp.prim_data.
 
 :- import_module bool.
+:- import_module debug_builtin.
 :- import_module io.
 :- import_module list.
 :- import_module map.
@@ -185,6 +185,8 @@
 
 :- implementation.
 
+:- import_module mdbcomp.goal_path.
+
 :- import_module exception.
 :- import_module int.
 :- import_module io.
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_init.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.52
diff -u -b -r1.52 mercury_init.h
--- runtime/mercury_init.h	13 Feb 2010 07:29:10 -0000	1.52
+++ runtime/mercury_init.h	26 Sep 2011 09:19:22 -0000
@@ -144,22 +144,13 @@
 extern	const MR_FA_TypeInfo_Struct1
 				ML_type_info_for_list_of_pseudo_type_info;
 
-/* in trace/mercury_trace_internal.h */
-extern	char	*MR_trace_getline(const char *, FILE *mdb_in, FILE *mdb_out);
-extern	char	*MR_trace_get_command(const char *, FILE *, FILE *);
-
-/* in trace/mercury_trace_vars.h */
-extern	const char *MR_trace_browse_all_on_level(FILE *,
-			const MR_LabelLayout *, MR_Word *, MR_Word *,
-			int, MR_bool);
-
-/* in trace/mercury_trace_external.h */
-extern	void	MR_trace_init_external(void);
-extern	void	MR_trace_final_external(void);
-
 /* in library/type_desc.m  */
 extern	MR_String	ML_type_name(MR_Word);
 
+/* in mdbcomp/mdbcomp.goal_path.m */
+extern	MR_String	MR_MDBCOMP_goal_path_to_string(MR_Word);
+extern	MR_String	MR_MDBCOMP_rev_goal_path_to_string(MR_Word);
+
 /* in runtime/mercury_trace_base.c */
 extern	MR_Code	*MR_trace_fake(const MR_LabelLayout *);
 
@@ -167,9 +158,22 @@
 extern	MR_Code	*MR_trace_real(const MR_LabelLayout *);
 extern	void	MR_trace_interrupt_handler(void);
 
+/* in trace/mercury_trace_external.h */
+extern	void	MR_trace_init_external(void);
+extern	void	MR_trace_final_external(void);
+
+/* in trace/mercury_trace_internal.h */
+extern	char	*MR_trace_getline(const char *, FILE *mdb_in, FILE *mdb_out);
+extern	char	*MR_trace_get_command(const char *, FILE *, FILE *);
+
 /* in trace/mercury_trace_tables.c */
 extern	void	MR_register_module_layout_real(const MR_ModuleLayout *);
 
+/* in trace/mercury_trace_vars.h */
+extern	const char *MR_trace_browse_all_on_level(FILE *,
+			const MR_LabelLayout *, MR_Word *, MR_Word *,
+			int, MR_bool);
+
 /*---------------------------------------------------------------------------*/
 
 #endif /* not MERCURY_INIT_H */
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.122
diff -u -b -r1.122 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	28 Sep 2011 07:06:23 -0000	1.122
+++ runtime/mercury_stack_layout.h	28 Sep 2011 07:35:58 -0000
@@ -370,7 +370,7 @@
 ** 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
+** The MR_sll_goal_path field contains XXX offset into the module-wide string
 ** table, leading to a string that gives the goal path associated with the
 ** label. If there is no meaningful goal path associated with the label,
 ** the offset will be zero, leading to the empty string. You can use the macro
@@ -480,9 +480,9 @@
     MR_int_least8_t         MR_sll_port;
     MR_int_least8_t         MR_sll_hidden;
     MR_uint_least16_t       MR_sll_label_num_in_module;
-    MR_uint_least32_t       MR_sll_goal_path;
-    const MR_UserEvent      *MR_sll_user_event;
-    MR_Integer              MR_sll_var_count; /* >= 0, encoding Long > 0 */
+    MR_uint_least32_t       MR_sll_var_count; /* >= 0, encoding Long > 0 */
+    MR_Word                 MR_sll_goal_path;
+    const MR_UserEvent      *MR_sllx_user_event;
     const MR_TypeParamLocns *MR_sll_tvars;
     const MR_PseudoTypeInfo *MR_sll_types;
     const MR_HLDSVarNum     *MR_sll_var_nums;
@@ -495,9 +495,9 @@
     MR_int_least8_t         MR_sll_port;
     MR_int_least8_t         MR_sll_hidden;
     MR_uint_least16_t       MR_sll_label_num_in_module;
-    MR_uint_least32_t       MR_sll_goal_path;
-    const MR_UserEvent      *MR_sll_user_event;
-    MR_Integer              MR_sll_var_count; /* >= 0 , encoding Long == 0*/
+    MR_uint_least32_t       MR_sll_var_count; /* >= 0 , encoding Long == 0*/
+    MR_Word                 MR_sll_goal_path;
+    const MR_UserEvent      *MR_sllx_user_event;
     const MR_TypeParamLocns *MR_sll_tvars;
     const MR_PseudoTypeInfo *MR_sll_types;
     const MR_HLDSVarNum     *MR_sll_var_nums;
@@ -509,17 +509,17 @@
     MR_int_least8_t         MR_sll_port;
     MR_int_least8_t         MR_sll_hidden;
     MR_uint_least16_t       MR_sll_label_num_in_module;
-    MR_uint_least32_t       MR_sll_goal_path;
-    const MR_UserEvent      *MR_sll_user_event;
-    MR_Integer              MR_sll_var_count; /* < 0 */
+    MR_uint_least32_t       MR_sll_var_count; /* < 0 */
+    MR_Word                 MR_sll_goal_path;
+    const MR_UserEvent      *MR_sllx_user_event;
 } MR_LabelLayoutNoVarInfo;
 
-#define MR_label_goal_path(layout)                                          \
+#define MR_label_rev_goal_path(layout)                                      \
     ((MR_PROC_LAYOUT_HAS_EXEC_TRACE((layout)->MR_sll_entry)) ?              \
-        ((layout)->MR_sll_entry->MR_sle_module_layout                       \
-            ->MR_ml_string_table                                            \
-        + ((layout)->MR_sll_goal_path >> 1))                                \
-    : "")
+        (layout)->MR_sll_goal_path : 0)
+
+#define MR_label_rev_goal_path_str(layout)                                  \
+    ((*MR_rev_goal_path_to_str)(MR_label_rev_goal_path(layout)))
 
 #define MR_SHORT_COUNT_BITS 10
 #define MR_SHORT_COUNT_MASK ((1 << MR_SHORT_COUNT_BITS) - 1)
@@ -567,9 +567,9 @@
         0,                                                                  \
         -1,                                                                 \
         MR_FALSE,                                                           \
+        -1,     /* No info about live values */                             \
         0,                                                                  \
-        0,                                                                  \
-        -1      /* No info about live values */                             \
+        0                                                                   \
     }
 
 /*-------------------------------------------------------------------------*/
@@ -582,25 +582,25 @@
 ** are several kinds of proc layouts, of different (though compatible) types.
 */
 
-#define MR_LL(e, port, num, path)                                           \
+#define MR_LL(e, port, num, cnt, path)                                      \
         MR_PROC_LAYOUT(MR_add_prefix(e)),                                   \
         MR_PASTE2(MR_PORT_, port),                                          \
-        MR_NOT_HIDDEN, (num), (path), NULL
+        MR_NOT_HIDDEN, (num), (cnt), (path), NULL
 
-#define MR_LL_H(e, port, num, path)                                         \
+#define MR_LL_H(e, port, num, cnt, path)                                    \
         MR_PROC_LAYOUT(MR_add_prefix(e)),                                   \
         MR_PASTE2(MR_PORT_, port),                                          \
-        MR_HIDDEN, (num), (path), NULL
+        MR_HIDDEN, (num), (cnt), (path), NULL
 
-#define MR_LL_U(e, port, num, path, ue)                                     \
+#define MR_LL_U(e, port, num, cnt, path, ue)                                \
         MR_PROC_LAYOUT(MR_add_prefix(e)),                                   \
         MR_PASTE2(MR_PORT_, port),                                          \
-        MR_NOT_HIDDEN, (num), (path), (ue)
+        MR_NOT_HIDDEN, (num), (cnt), (path), (ue)
 
-#define MR_LL_H_U(e, port, num, path, ue)                                   \
+#define MR_LL_H_U(e, port, num, cnt, path, ue)                              \
         MR_PROC_LAYOUT(MR_add_prefix(e)),                                   \
         MR_PASTE2(MR_PORT_, port),                                          \
-        MR_HIDDEN, (num), (path), (ue)
+        MR_HIDDEN, (num), (cnt), (path), (ue)
 
 #define MR_LLVS(m, p, h, s)                                                 \
         &MR_pseudo_type_infos(m)[p],                                        \
@@ -613,14 +613,6 @@
         &MR_short_locns(m)[s],                                              \
         &MR_long_locns(m)[l]
 
-#define MR_LLVS0(m, p, h, s)                                                \
-        0,                                                                  \
-        MR_LLVS(m, p, h, s)
-
-#define MR_LLVL0(m, p, h, s, l)                                             \
-        0,                                                                  \
-        MR_LLVL(m, p, h, s, l)
-
 #define MR_LLVSC(m, tpt, tpc, p, h, s)                                      \
         (const MR_TypeParamLocns *) MR_COMMON(tpt, tpc),                    \
         MR_LLVS(m, p, h, s)
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.85
diff -u -b -r1.85 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	30 Oct 2009 03:33:29 -0000	1.85
+++ runtime/mercury_stack_trace.c	26 Sep 2011 08:03:19 -0000
@@ -547,7 +547,7 @@
                 fprintf(fp, ", ");
                 label_layout = MR_nondet_branch_infos[branch].branch_layout;
                 MR_print_proc_id(fp, label_layout->MR_sll_entry);
-                fprintf(fp, " <%s>", MR_label_goal_path(label_layout));
+                fprintf(fp, " <%s>", MR_label_rev_goal_path_str(label_layout));
             }
             fprintf(fp, "\n");
             fprintf(fp, " redoip: ");
@@ -1118,7 +1118,8 @@
 
         prev_dump_info.MR_sdi_base_sp = base_sp;
         prev_dump_info.MR_sdi_base_curfr = base_curfr;
-        prev_dump_info.MR_sdi_goal_path = MR_label_goal_path(label_layout);
+        prev_dump_info.MR_sdi_rev_goal_path_str =
+            MR_label_rev_goal_path_str(label_layout);
 
         lines_printed = 1;
     } else {
@@ -1188,8 +1189,8 @@
     }
 
     if (trace_data_enabled) {
-        if (MR_strdiff(dump_info.MR_sdi_goal_path, "")) {
-            fprintf(fp, " %s", dump_info.MR_sdi_goal_path);
+        if (MR_strdiff(dump_info.MR_sdi_rev_goal_path_str, "")) {
+            fprintf(fp, " %s", dump_info.MR_sdi_rev_goal_path_str);
         } else {
             fprintf(fp, " (empty)");
         }
Index: runtime/mercury_stack_trace.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.43
diff -u -b -r1.43 mercury_stack_trace.h
--- runtime/mercury_stack_trace.h	16 Jul 2011 07:51:30 -0000	1.43
+++ runtime/mercury_stack_trace.h	26 Sep 2011 08:02:24 -0000
@@ -95,7 +95,7 @@
     /* These fields are meaningful only if include_trace_data is TRUE. */
     MR_Word                 *MR_sdi_base_sp;
     MR_Word                 *MR_sdi_base_curfr;
-    const char              *MR_sdi_goal_path;
+    const char              *MR_sdi_rev_goal_path_str;
 } MR_StackDumpInfo;
 
 typedef void        (*MR_PrintStackRecord)(FILE *fp,
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.89
diff -u -b -r1.89 mercury_trace_base.c
--- runtime/mercury_trace_base.c	21 Sep 2011 09:31:53 -0000	1.89
+++ runtime/mercury_trace_base.c	26 Sep 2011 07:47:47 -0000
@@ -565,7 +565,7 @@
 
                 case PATH_ONLY:
                     putc('<', fp);
-                    fputs(MR_label_goal_path(label), fp);
+                    fputs(MR_label_rev_goal_path_str(label), fp);
                     putc('>', fp);
                     break;
 
@@ -573,7 +573,7 @@
                     fputs(MR_actual_port_names[port], fp);
                     putc(' ', fp);
                     putc('<', fp);
-                    fputs(MR_label_goal_path(label), fp);
+                    fputs(MR_label_rev_goal_path_str(label), fp);
                     putc('>', fp);
                     break;
 
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.225
diff -u -b -r1.225 mercury_wrapper.c
--- runtime/mercury_wrapper.c	27 Sep 2011 00:49:27 -0000	1.225
+++ runtime/mercury_wrapper.c	27 Sep 2011 04:46:25 -0000
@@ -471,6 +471,8 @@
 void        (*MR_io_stdin_stream)(MercuryFilePtr *);
 void        (*MR_io_print_to_cur_stream)(MR_Word, MR_Word);
 void        (*MR_io_print_to_stream)(MR_Word, MercuryFilePtr, MR_Word);
+MR_String   (*MR_goal_path_to_str)(MR_Word);
+MR_String   (*MR_rev_goal_path_to_str)(MR_Word);
 
 void        (*MR_DI_output_current_ptr)(MR_Integer, MR_Integer, MR_Integer,
                 MR_Word, MR_String, MR_String, MR_Integer, MR_Integer,
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.88
diff -u -b -r1.88 mercury_wrapper.h
--- runtime/mercury_wrapper.h	27 Sep 2011 00:49:27 -0000	1.88
+++ runtime/mercury_wrapper.h	27 Sep 2011 04:46:25 -0000
@@ -98,6 +98,8 @@
 extern	void		(*MR_io_print_to_cur_stream)(MR_Word, MR_Word);
 extern	void		(*MR_io_print_to_stream)(MR_Word, MercuryFilePtr,
 				MR_Word);
+extern	MR_String   	(*MR_goal_path_to_str)(MR_Word);
+extern	MR_String   	(*MR_rev_goal_path_to_str)(MR_Word);
 
 extern	void		(*MR_address_of_mercury_init_io)(void);
 extern	void		(*MR_address_of_init_modules)(void);
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/appengine
cvs diff: Diffing samples/appengine/war
cvs diff: Diffing samples/appengine/war/WEB-INF
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/standalone_c
cvs diff: Diffing samples/concurrency
cvs diff: Diffing samples/concurrency/dining_philosophers
cvs diff: Diffing samples/concurrency/midimon
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/lazy_list
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.110
diff -u -b -r1.110 mercury_trace.c
--- trace/mercury_trace.c	20 May 2011 04:16:58 -0000	1.110
+++ trace/mercury_trace.c	26 Sep 2011 08:37:35 -0000
@@ -209,7 +209,7 @@
 
                 MR_compute_max_mr_num(event_info.MR_max_mr_num, layout);
                 port = (MR_TracePort) layout->MR_sll_port;
-                path = MR_label_goal_path(layout);
+                path = MR_label_rev_goal_path_str(layout);
                 MR_copy_regs_to_saved_regs(event_info.MR_max_mr_num,
                     saved_regs);
                 MR_trace_init_point_vars(layout, saved_regs, port, MR_FALSE);
@@ -539,7 +539,7 @@
     event_info.MR_call_depth = depth;                                         \
     event_info.MR_trace_port = port;                                          \
     event_info.MR_event_sll = layout;                                         \
-    event_info.MR_event_path = MR_label_goal_path(layout);                    \
+    event_info.MR_event_rev_path = MR_label_rev_goal_path(layout);            \
                                                                               \
     MR_compute_max_mr_num(event_info.MR_max_mr_num, layout);                  \
     /* This also saves the regs in MR_fake_regs. */                           \
Index: trace/mercury_trace.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace.h,v
retrieving revision 1.38
diff -u -b -r1.38 mercury_trace.h
--- trace/mercury_trace.h	2 Oct 2007 17:04:37 -0000	1.38
+++ trace/mercury_trace.h	26 Sep 2011 08:36:47 -0000
@@ -45,7 +45,7 @@
     MR_Unsigned             MR_call_depth;
     MR_TracePort            MR_trace_port;
     const MR_LabelLayout    *MR_event_sll;
-    const char              *MR_event_path;
+    MR_Word                 MR_event_rev_path;
     MR_Word                 MR_saved_regs[MR_MAX_FAKE_REG];
     int                     MR_max_mr_num;
 } MR_EventInfo;
Index: trace/mercury_trace_cmd_breakpoint.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_breakpoint.c,v
retrieving revision 1.7
diff -u -b -r1.7 mercury_trace_cmd_breakpoint.c
--- trace/mercury_trace_cmd_breakpoint.c	2 Oct 2007 17:04:37 -0000	1.7
+++ trace/mercury_trace_cmd_breakpoint.c	26 Sep 2011 08:20:52 -0000
@@ -464,7 +464,7 @@
                     "u: %4s %s\n",
                     i,
                     MR_simplified_port_names[this_label->MR_sll_port],
-                    MR_label_goal_path(this_label));
+                    MR_label_rev_goal_path_str(this_label));
             }
 
             sprintf(buf, "\nWhich do you want to put "
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.117
diff -u -b -r1.117 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	26 Sep 2011 04:30:48 -0000	1.117
+++ trace/mercury_trace_declarative.c	26 Sep 2011 08:52:56 -0000
@@ -391,16 +391,12 @@
 static    MR_TraceNode      MR_trace_decl_neg_failure(
                                 MR_EventInfo *event_info, MR_TraceNode prev);
 static    MR_TraceNode      MR_trace_matching_call(MR_TraceNode node);
-static    MR_bool           MR_trace_first_disjunct(MR_EventInfo *event_info);
-static    MR_bool           MR_trace_matching_cond(const char *path,
+static    MR_bool           MR_trace_matching_cond(MR_Word path,
                                 MR_TraceNode node);
-static    MR_bool           MR_trace_matching_neg(const char *path,
+static    MR_bool           MR_trace_matching_neg(MR_Word path,
                                 MR_TraceNode node);
-static    MR_bool           MR_trace_matching_disj(const char *path,
+static    MR_bool           MR_trace_matching_disj(MR_Word path,
                                 MR_TraceNode node);
-static    MR_bool           MR_trace_same_construct(const char *p1,
-                                const char *p2);
-static    MR_bool           MR_trace_single_component(const char *path);
 static    MR_Word           MR_decl_make_atom_args(
                                 const MR_LabelLayout *layout,
                                 MR_Word *saved_regs, MR_TracePort port);
@@ -430,7 +426,7 @@
 static    MR_Code           *MR_trace_decl_retry_supertree(
                                 MR_Unsigned max_distance,
                                 MR_EventInfo *event_info);
-static    MR_String         MR_trace_node_path(MR_TraceNode node);
+static    MR_Word           MR_trace_node_rev_path(MR_TraceNode node);
 static    MR_TracePort      MR_trace_node_port(MR_TraceNode node);
 static    MR_Unsigned       MR_trace_node_seqno(MR_TraceNode node);
 static    MR_TraceNode      MR_trace_node_first_disj(MR_TraceNode node);
@@ -1074,13 +1070,13 @@
     MR_TraceNode    node;
     MR_TraceNode    next;
     MR_TraceNode    cond;
-    const char      *path = event_info->MR_event_path;
+    MR_Word         rev_path = event_info->MR_event_rev_path;
 
     /*
     ** Search through current contour for a matching COND event.
     */
     next = prev;
-    while (!MR_trace_matching_cond(path, next)) {
+    while (!MR_trace_matching_cond(rev_path, next)) {
         next = MR_trace_step_left_in_contour(next);
     }
 
@@ -1100,18 +1096,18 @@
 {
     MR_TraceNode    node;
     MR_TraceNode    cond;
-    const char      *path = event_info->MR_event_path;
+    MR_Word         rev_path = event_info->MR_event_rev_path;
 
     /*
     ** Search through previous contour for a matching COND event.
     */
-    if (MR_trace_matching_cond(path, prev)) {
+    if (MR_trace_matching_cond(rev_path, prev)) {
         cond = prev;
     } else {
         MR_TraceNode    next;
 
         next = prev;
-        while (!MR_trace_matching_cond(path, next)) {
+        while (!MR_trace_matching_cond(rev_path, next)) {
             next = MR_trace_step_left_in_contour(next);
         }
 
@@ -1145,18 +1141,18 @@
 {
     MR_TraceNode    node;
     MR_TraceNode    nege;
-    const char      *path = event_info->MR_event_path;
+    MR_Word         rev_path = event_info->MR_event_rev_path;
 
     /*
     ** Search through previous contour for a matching NEGE event.
     */
-    if (MR_trace_matching_neg(path, prev)) {
+    if (MR_trace_matching_neg(rev_path, prev)) {
         nege = MR_trace_current_node;
     } else {
         MR_TraceNode    next;
 
         next = prev;
-        while (!MR_trace_matching_neg(path, next)) {
+        while (!MR_trace_matching_neg(rev_path, next)) {
             next = MR_trace_step_left_in_contour(next);
         }
 
@@ -1178,12 +1174,13 @@
 {
     MR_TraceNode    node;
     MR_TraceNode    next;
+    MR_Word         rev_path = event_info->MR_event_rev_path;
 
     /*
     ** Search through current contour for a matching NEGE event.
     */
     next = prev;
-    while (!MR_trace_matching_neg(event_info->MR_event_path, next)) {
+    while (!MR_trace_matching_neg(rev_path, next)) {
         next = MR_trace_step_left_in_contour(next);
     }
 
@@ -1231,14 +1228,13 @@
     const char      *path;
     MR_TraceNode    next;
     MR_TraceNode    first;
-    
-    path = event_info->MR_event_path;
+    MR_Word         rev_path = event_info->MR_event_rev_path;
 
     /*
     ** Search through previous nodes for a matching DISJ event.
     */
     next = MR_trace_find_prev_contour(prev);
-    while (!MR_trace_matching_disj(path, next)) {
+    while (!MR_trace_matching_disj(rev_path, next)) {
         next = MR_trace_step_left_in_contour(next);
     }
 
@@ -1279,30 +1275,10 @@
 }
 
 static MR_bool
-MR_trace_first_disjunct(MR_EventInfo *event_info)
-{
-    const char  *path;
-
-    /*
-    ** Return MR_TRUE iff the last component of the path is "d1;".
-    */
-    path = event_info->MR_event_path;
-    while (*path) {
-        if (MR_string_equal(path, "d1;")) {
-            return MR_TRUE;
-        }
-
-        path++;
-    }
-
-    return MR_FALSE;
-}
-
-static MR_bool
-MR_trace_matching_cond(const char *path, MR_TraceNode node)
+MR_trace_matching_cond(MR_Word path, MR_TraceNode node)
 {
     MR_TracePort    port;
-    const char      *node_path;
+    MR_Word         node_path;
 
     MR_TRACE_CALL_MERCURY(
         port = (MR_TracePort) MR_DD_trace_node_port(node);
@@ -1312,15 +1288,15 @@
         return MR_FALSE;
     }
 
-    node_path = MR_trace_node_path(node);
-    return MR_trace_same_construct(path, node_path);
+    node_path = MR_trace_node_rev_path(node);
+    return MR_MDBCOMP_goals_in_same_construct(path, node_path);
 }
 
 static MR_bool
-MR_trace_matching_neg(const char *path, MR_TraceNode node)
+MR_trace_matching_neg(MR_Word path, MR_TraceNode node)
 {
     MR_TracePort    port;
-    const char      *node_path;
+    MR_Word         node_path;
 
     MR_TRACE_CALL_MERCURY(
         port = (MR_TracePort) MR_DD_trace_node_port(node);
@@ -1330,72 +1306,28 @@
         return MR_FALSE;
     }
 
-    node_path = MR_trace_node_path(node);
-    return MR_trace_same_construct(path, node_path);
+    node_path = MR_trace_node_rev_path(node);
+    return MR_MDBCOMP_goals_in_same_construct(path, node_path);
 }
 
 static MR_bool
-MR_trace_matching_disj(const char *path, MR_TraceNode node)
+MR_trace_matching_disj(MR_Word path, MR_TraceNode node)
 {
     MR_TracePort    port;
-    const char      *node_path;
+    MR_Word         node_path;
 
     MR_TRACE_CALL_MERCURY(
         port = (MR_TracePort) MR_DD_trace_node_port(node);
     );
 
     if (port == MR_PORT_DISJ_FIRST || port == MR_PORT_DISJ_LATER) {
-        node_path = MR_trace_node_path(node);
-        return MR_trace_same_construct(path, node_path);
+        node_path = MR_trace_node_rev_path(node);
+        return MR_MDBCOMP_goals_in_same_construct(path, node_path);
     } else {
         return MR_FALSE;
     }
 }
 
-static MR_bool
-MR_trace_same_construct(const char *p1, const char *p2)
-{
-    /*
-    ** Checks if the two arguments represent goals in the same construct.
-    ** If both strings are identical up to the last component, return MR_TRUE,
-    ** otherwise return MR_FALSE. If the arguments point to identical strings,
-    ** return MR_TRUE.
-    */
-
-    while (*p1 == *p2) {
-        if (*p1 == '\0' && *p2 == '\0') {
-            return MR_TRUE;     /* They are identical. */
-        }
-        if (*p1 == '\0' || *p2 == '\0') {
-            return MR_FALSE;    /* Different number of elements. */
-        }
-
-        p1++;
-        p2++;
-    }
-
-    /*
-    ** If there is exactly one component left in each string, then
-    ** the goal paths match, otherwise they don't.
-    */
-    return MR_trace_single_component(p1) && MR_trace_single_component(p2);
-}
-
-static MR_bool
-MR_trace_single_component(const char *path)
-{
-    while (*path != ';') {
-        if (*path == '\0') {
-            return MR_FALSE;
-        }
-
-        path++;
-    }
-
-    path++;
-    return (*path == '\0');
-}
-
 static MR_Word
 MR_decl_make_atom_args(const MR_LabelLayout *layout, MR_Word *saved_regs,
     MR_TracePort port)
@@ -2103,14 +2035,14 @@
     return jumpaddr;
 }
 
-static MR_String
-MR_trace_node_path(MR_TraceNode node)
+static MR_Word
+MR_trace_node_rev_path(MR_TraceNode node)
 {
-    MR_String   path;
+    MR_Word path;
 
     MR_trace_node_store++;
     MR_TRACE_CALL_MERCURY(
-        path = MR_DD_trace_node_path((MR_Word) node);
+        path = MR_DD_trace_node_rev_path((MR_Word) node);
     );
 
     return path;
Index: trace/mercury_trace_declarative.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.h,v
retrieving revision 1.33
diff -u -b -r1.33 mercury_trace_declarative.h
--- trace/mercury_trace_declarative.h	5 Feb 2010 04:16:15 -0000	1.33
+++ trace/mercury_trace_declarative.h	26 Sep 2011 08:35:54 -0000
@@ -22,8 +22,8 @@
 extern  MR_Code     *MR_trace_decl_debug(MR_EventInfo *event_info);
 
 /*
-** The following functions update the progress indicator when building a 
-** subtree or a supertree.
+** The following functions update the progress indicator when building
+** a subtree or a supertree.
 */
 
 extern  void        MR_trace_show_progress_subtree(MR_Unsigned event_number);
@@ -31,9 +31,8 @@
 
 /*
 ** The internal (interactive) debugger calls this function to enter
-** declarative debugging mode.  It returns MR_TRUE if successful, and
-** MR_FALSE if there was some problem that prevented this mode from
-** being entered.
+** declarative debugging mode. It returns MR_TRUE if successful, and MR_FALSE
+** if there was some problem that prevented this mode from being entered.
 */
 
 typedef enum { MR_DECL_NODUMP, MR_DECL_DUMP } MR_DeclMode;
@@ -117,9 +116,9 @@
 extern MR_DeclSearchMode MR_trace_get_default_search_mode(void);
 
 /*
-** Prints a list of the trusted objects.  If mdb_command_format is true it
-** prints the list as a series of mdb `trust' commands.  Otherwise it 
-** prints the list in a format suitable for display.
+** Prints a list of the trusted objects. If mdb_command_format is true,
+** it prints the list as a series of mdb `trust' commands. Otherwise
+** it prints the list in a format suitable for display.
 */
 
 extern  void        MR_decl_print_all_trusted(FILE *fp, 
@@ -265,16 +264,16 @@
 
 /*
 ** How often to update the progress message, expressed in terms of number of
-** events.  We define seperate intervals for when we are materializing 
-** nodes and when we are in an implicit subtree, since execution is much
-** faster in implicit subtrees.
+** events. We define seperate intervals for when we are materializing nodes
+** and when we are in an implicit subtree, since execution is much faster
+** in implicit subtrees.
 */
 
 #define     MR_DECL_PROGRESS_CHECK_INTERVAL                  100000
 #define     MR_DECL_PROGRESS_CHECK_INTERVAL_IMPLICIT_SUBTREE 1000000
 
 /*
-** The total number of progress ticks that should be displayed when building of
+** The total number of progress ticks that should be displayed when building
 ** the current portion of the annotated trace is 100% complete.
 */
 
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.86
diff -u -b -r1.86 mercury_trace_external.c
--- trace/mercury_trace_external.c	25 Nov 2008 07:46:57 -0000	1.86
+++ trace/mercury_trace_external.c	26 Sep 2011 08:40:08 -0000
@@ -522,7 +522,7 @@
     MR_Unsigned             seqno = event_info->MR_call_seqno;
     MR_Unsigned             depth = event_info->MR_call_depth;
     MR_TracePort            port = event_info->MR_trace_port;
-    const char              *path = event_info->MR_event_path;
+    const char              *path;
     MR_Word                 *saved_regs = event_info->MR_saved_regs;
     MR_Integer              modules_list_length;
     MR_Word                 modules_list;
@@ -531,6 +531,8 @@
     int                     lineno = 0;
     MR_bool                 unsafe_retry;
 
+    path = (*MR_rev_goal_path_to_str)(event_info->MR_event_rev_path);
+
     MR_debug_enabled = MR_FALSE;
     MR_update_trace_func_enabled();
 
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.247
diff -u -b -r1.247 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	3 Jan 2011 14:45:34 -0000	1.247
+++ trace/mercury_trace_internal.c	26 Sep 2011 08:38:57 -0000
@@ -1480,7 +1480,9 @@
     MR_print_proc_id_trace_and_context(MR_mdb_out, MR_FALSE,
         MR_context_position, MR_user_event_context, label_layout->MR_sll_entry,
         maybe_user_event_name, base_sp, base_curfr,
-        ( MR_print_goal_paths ? event_info->MR_event_path : "" ),
+        ( MR_print_goal_paths ?
+            (*MR_rev_goal_path_to_str)(event_info->MR_event_rev_path)
+            : "" ),
         filename, lineno, MR_port_is_interface(event_info->MR_trace_port),
         parent_filename, parent_lineno, indent);
 }
Index: trace/mercury_trace_spy.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_spy.c,v
retrieving revision 1.37
diff -u -b -r1.37 mercury_trace_spy.c
--- trace/mercury_trace_spy.c	5 Dec 2008 07:18:07 -0000	1.37
+++ trace/mercury_trace_spy.c	26 Sep 2011 08:20:22 -0000
@@ -1111,7 +1111,7 @@
             } else {
                 fprintf(fp, " %4s ", MR_simplified_port_names[port]);
             }
-            fprintf(fp, "%s", MR_label_goal_path(point->MR_spy_label));
+            fprintf(fp, "%s", MR_label_rev_goal_path_str(point->MR_spy_label));
             break;
 
         case MR_SPY_LINENO:
cvs diff: Diffing util
Index: util/mkinit.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/util/mkinit.c,v
retrieving revision 1.124
diff -u -b -r1.124 mkinit.c
--- util/mkinit.c	8 Jun 2011 04:19:58 -0000	1.124
+++ util/mkinit.c	26 Sep 2011 08:52:06 -0000
@@ -447,6 +447,8 @@
     "   MR_io_stderr_stream = ML_io_stderr_stream;\n"
     "   MR_io_print_to_cur_stream = ML_io_print_to_cur_stream;\n"
     "   MR_io_print_to_stream = ML_io_print_to_stream;\n"
+    "   MR_goal_path_to_str = MR_MDBCOMP_goal_path_to_string;\n"
+    "   MR_rev_goal_path_to_str = MR_MDBCOMP_rev_goal_path_to_string;\n"
     "#if MR_TRACE_ENABLED\n"
     "   MR_exec_trace_func_ptr = MR_trace_real;\n"
     "   MR_register_module_layout = MR_register_module_layout_real;\n"
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list