[m-rev.] for review: the second step in implementing event goals

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Sep 25 12:43:13 AEST 2006


For review by Mark.

Zoltan.

This diff is the second step in implementing trace events. It modifies
label layouts to include room for solver-event-specific information, and
modifies the compiler to generate this information. Modifications to the
debugger to use this information, user-level documentation and test cases
will come later.

runtime/mercury_stack_layout.h:
	Modify label layouts to allow them to hold information about solver
	events.

	Modify the macros creating label layouts to include a null pointer
	as the value of the label layout's solver event field. For each such
	macro, add a version that puts a pointer to the label's solver event
	structure in that field.

	Modify the definition of the MR_Long_Lval type to allow the
	representation of constants, since without this capability solver
	events would often need to be preceded by code to put constant
	values (e.g. solver ids) into lvals. To make it easier to locate
	all the places where MR_Long_Lvals are used (which need to be updated),
	change the type MR_Long_Lval from a synonym for an int to a structure
	containing an int.

runtime/mercury_types.h:
	Add the typedefs new required for mercury_stack_layout.h.

runtime/mercury_goto.h:
	Add a macro needed by mercury_stack_layout.h.

runtime/mercury_grade.h:
	Change the binary comptability version number for debug grades,
	due to the change to label layouts.

runtime/mercury_layout_util.c:
	Update the functions interpreting MR_Long_Lvals to conform to the
	change in mercury_stack_layout.h.

runtime/mercury_deep_profiling_hand.h:
	Fix a bug, possibly the bug preventing us from bootchecking in deep
	profiling grades: stack slot numbers of ProcStatic structures are
	supposed to be plain integers, not MR_Long_Lvals.

runtime/mercury_stack_trace.c:
library/exception.m:
trace/mercury_trace.c:
	Conform the change in MR_Long_Lval.

runtime/mercury_trace_base.[ch]:
	Add a new port: the solver event port.

	Add a macro and a function for solver events: MR_SOLVER_EVENT and
	MR_solver_trace. For now, they do the same thing as MR_EVENT and
	MR_trace, but in future, they can do something else (e.g. generate
	information for a visualization tool).

mdbcomp/prim_data.m:
	Add a new port: the solver event port.

	Rename all ports to eliminate clashes with language keywords such as
	"call".

mdbcmp/trace_counts.m:
browser/declarative_execution.m:
slice/mcov.m:
compiler/tupling.m:
	Conform to the change in port names, and to the addition of the new
	port.

compiler/trace_params.m:
	Conform to the change in port names, and to the addition of the new
	port.

	Rename some function symbols to avoid some ambiguities.

trace/mercury_trace_declarative.c:
	Ignore the solver port when building the annotated trace, since it
	doesn't fit into it.

compiler/prog_event.m:
	Extend the representation of events to include names for the event
	attributes.

compiler/call_gen.m:
	Implement event goals. The implementation consists of a call to
	MR_SOLVER_EVENT with a layout structure whose solver event field
	points to a solver event structure giving the event goal's arguments.

	Rename some function symbols to avoid some ambiguities.

compiler/trace_gen.m:
	Add a predicate for generating solver events.

	Conform to the change in port names.

	Rename some function symbols to avoid some ambiguities.

compiler/code_info.m:
	When recording trace layout information for a label, take an extra
	argument describing the label layout's associated solver event, if any.

compiler/continuation_info.m:
	Extend the first representation of label layouts to include room
	for solver events.

compiler/stack_layout.m:
	Convert the representation of solver events in continuation_info.m's
	data structure to the data structure required by layout_out.m.

	Conform to the changes in MR_Long_Lvals.

compiler/layout.m:
	Extend the compiler's internal representation of the contents of label
	layout structures to accommodate the optional solver event field.

compiler/layout_out.m:
	Generate the extended label layout structures, using the new macros
	in mercury_stack_layout.h if necessary.

	Conform to the change in the MR_Long_Lval type.

	Conform to the change in port names.

	Rename some function symbols to avoid some ambiguities.

compiler/global_data.m:
	Modify rval_type_as_arg to require only the value of the relevant
	option, not a package of such options. This is for the new code
	in stack_layout.m.

compiler/var_locn.m:
	Conform to the change in global_data.m.

compiler/llds_out.m:
	Conform to the change in continuation_info.m.

	Delete this module's unused definition of rval_type_as_arg.

compiler/opt_debug.m:
	Conform to the change in continuation_info.m.

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/include
cvs diff: Diffing boehm_gc/include/private
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/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
Index: browser/declarative_execution.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_execution.m,v
retrieving revision 1.54
diff -u -b -r1.54 declarative_execution.m
--- browser/declarative_execution.m	5 Sep 2006 06:21:19 -0000	1.54
+++ browser/declarative_execution.m	23 Sep 2006 09:53:25 -0000
@@ -968,20 +968,20 @@
 :- pragma foreign_export("C", trace_node_port(in) = out,
     "MR_DD_trace_node_port").
 
-trace_node_port(node_call(_, _, _, _, _, _, _, _, _, _)) = call.
-trace_node_port(node_exit(_, _, _, _, _, _, _, _))       = exit.
-trace_node_port(node_redo(_, _, _, _, _))        = redo.
-trace_node_port(node_fail(_, _, _, _, _, _))     = fail.
-trace_node_port(node_excp(_, _, _, _, _, _, _))  = exception.
-trace_node_port(node_switch(_, _))               = switch.
-trace_node_port(node_first_disj(_, _))           = disj.
-trace_node_port(node_later_disj(_, _, _))        = disj.
-trace_node_port(node_cond(_, _, _))              = ite_cond.
-trace_node_port(node_then(_, _, _))              = ite_then.
-trace_node_port(node_else(_, _, _))              = ite_else.
-trace_node_port(node_neg(_, _, _))               = neg_enter.
-trace_node_port(node_neg_succ(_, _, _))          = neg_success.
-trace_node_port(node_neg_fail(_, _, _))          = neg_failure.
+trace_node_port(node_call(_, _, _, _, _, _, _, _, _, _)) = port_call.
+trace_node_port(node_exit(_, _, _, _, _, _, _, _))       = port_exit.
+trace_node_port(node_redo(_, _, _, _, _))        = port_redo.
+trace_node_port(node_fail(_, _, _, _, _, _))     = port_fail.
+trace_node_port(node_excp(_, _, _, _, _, _, _))  = port_exception.
+trace_node_port(node_switch(_, _))               = port_switch.
+trace_node_port(node_first_disj(_, _))           = port_disj.
+trace_node_port(node_later_disj(_, _, _))        = port_disj.
+trace_node_port(node_cond(_, _, _))              = port_ite_cond.
+trace_node_port(node_then(_, _, _))              = port_ite_then.
+trace_node_port(node_else(_, _, _))              = port_ite_else.
+trace_node_port(node_neg(_, _, _))               = port_neg_enter.
+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,
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.182
diff -u -b -r1.182 call_gen.m
--- compiler/call_gen.m	5 Sep 2006 06:21:24 -0000	1.182
+++ compiler/call_gen.m	23 Sep 2006 14:32:29 -0000
@@ -36,16 +36,14 @@
 
 :- pred generate_generic_call(code_model::in, generic_call::in,
     list(prog_var)::in, list(mer_mode)::in, determinism::in,
-    hlds_goal_info::in, code_tree::out, code_info::in, code_info::out)
-    is det.
+    hlds_goal_info::in, code_tree::out, code_info::in, code_info::out) is det.
 
 :- pred generate_builtin(code_model::in, pred_id::in, proc_id::in,
-    list(prog_var)::in, code_tree::out, code_info::in, code_info::out)
-    is det.
+    list(prog_var)::in, code_tree::out, code_info::in, code_info::out) is det.
 
 :- type known_call_variant
-    --->    known_num
-    ;       unknown.
+    --->    ho_call_known_num
+    ;       ho_call_unknown.
 
     % generic_call_info(Globals, GenericCall, NumImmediateInputArgs, CodeAddr,
     %   SpecifierArgInfos, FirstImmediateInputReg, HoCallVariant).
@@ -79,7 +77,9 @@
 :- import_module libs.options.
 :- import_module libs.tree.
 :- import_module ll_backend.code_util.
+:- import_module ll_backend.continuation_info.
 :- import_module ll_backend.trace_gen.
+:- import_module parse_tree.prog_event.
 
 :- import_module bool.
 :- import_module int.
@@ -137,8 +137,8 @@
 
 %---------------------------------------------------------------------------%
 
-generate_generic_call(OuterCodeModel, GenericCall, Args0,
-        Modes0, Det, GoalInfo, Code, !CI) :-
+generate_generic_call(OuterCodeModel, GenericCall, Args, Modes, Det,
+        GoalInfo, Code, !CI) :-
     % For a generic_call, we split the arguments into inputs and outputs,
     % put the inputs in the locations expected by mercury.do_call_closure in
     % runtime/mercury_ho_call.c, generate the call to that code, and pick up
@@ -152,15 +152,14 @@
         ( GenericCall = higher_order(_, _, _, _)
         ; GenericCall = class_method(_, _, _, _)
         ),
-        generate_main_generic_call(OuterCodeModel, GenericCall, Args0, Modes0,
+        generate_main_generic_call(OuterCodeModel, GenericCall, Args, Modes,
             Det, GoalInfo, Code, !CI)
     ;
-        GenericCall = event_call(_),
-        % XXX The code for handling events is not yet implemented.
-        Code = empty
+        GenericCall = event_call(EventName),
+        generate_event_call(EventName, Args, GoalInfo, Code, !CI)
     ;
         GenericCall = cast(_),
-        ( Args0 = [InputArg, OutputArg] ->
+        ( Args = [InputArg, OutputArg] ->
             generate_assign_builtin(OutputArg, leaf(InputArg), Code, !CI)
         ;
             unexpected(this_file,
@@ -194,8 +193,7 @@
         InVarArgInfos),
     give_vars_consecutive_arg_infos(OutVars, FirstOutput, top_out,
         OutArgsInfos),
-    list.append(SpecifierArgInfos, InVarArgInfos, InArgInfos),
-    list.append(InArgInfos, OutArgsInfos, ArgInfos),
+    ArgInfos = SpecifierArgInfos ++ InVarArgInfos ++ OutArgsInfos,
 
     % Save the necessary vars on the stack and move the input args defined
     % by variables to their registers.
@@ -243,6 +241,38 @@
 
 %---------------------------------------------------------------------------%
 
+:- pred generate_event_call(string::in, list(prog_var)::in, hlds_goal_info::in,
+    code_tree::out, code_info::in, code_info::out) is det.
+
+generate_event_call(EventName, Args, GoalInfo, Code, !CI) :-
+    ( event_arg_names(EventName, AttributeNames) ->
+        generate_event_attributes(AttributeNames, Args, Attributes, AttrCodes,
+            !CI),
+        SolverEventInfo = solver_event_info(EventName, Attributes),
+        generate_solver_event_code(SolverEventInfo, GoalInfo, EventCode, !CI),
+        Code = tree(tree_list(AttrCodes), EventCode)
+    ;
+        unexpected(this_file, "generate_event_call: bad event name")
+    ).
+
+:- pred generate_event_attributes(list(string)::in, list(prog_var)::in,
+    list(solver_attribute)::out, list(code_tree)::out,
+    code_info::in, code_info::out) is det.
+
+generate_event_attributes([], [], [], [], !CI).
+generate_event_attributes([], [_ | _], _, _, !CI) :-
+    unexpected(this_file, "generate_event_attributes: list length mismatch").
+generate_event_attributes([_ | _], [], _, _, !CI) :-
+    unexpected(this_file, "generate_event_attributes: list length mismatch").
+generate_event_attributes([Name | Names], [Var | Vars], [Attr | Attrs],
+        [Code | Codes], !CI) :-
+    produce_variable(Var, Code, Rval, !CI),
+    Type = variable_type(!.CI, Var),
+    Attr = solver_attribute(Rval, Type, Name),
+    generate_event_attributes(Names, Vars, Attrs, Codes, !CI).
+
+%---------------------------------------------------------------------------%
+
     % The registers before the first input argument are all live.
     %
 :- pred extra_livevals(int::in, list(lval)::out) is det.
@@ -273,11 +303,11 @@
             NumInputArgs =< MaxSpec
         ->
             CodeAddr = do_call_closure(specialized_known(NumInputArgs)),
-            HoCallVariant = known_num,
+            HoCallVariant = ho_call_known_num,
             FirstImmediateInputReg = 2
         ;
             CodeAddr = do_call_closure(generic),
-            HoCallVariant = unknown,
+            HoCallVariant = ho_call_unknown,
             FirstImmediateInputReg = 3
         )
     ;
@@ -290,11 +320,11 @@
             NumInputArgs =< MaxSpec
         ->
             CodeAddr = do_call_class_method(specialized_known(NumInputArgs)),
-            HoCallVariant = known_num,
+            HoCallVariant = ho_call_known_num,
             FirstImmediateInputReg = 3
         ;
             CodeAddr = do_call_class_method(generic),
-            HoCallVariant = unknown,
+            HoCallVariant = ho_call_unknown,
             FirstImmediateInputReg = 4
         )
     ;
@@ -305,7 +335,7 @@
         CodeAddr = do_not_reached,
         SpecifierArgInfos = [],
         FirstImmediateInputReg = 1,
-        HoCallVariant = unknown     % dummy; not used
+        HoCallVariant = ho_call_unknown     % dummy; not used
     ).
 
     % Some of the values that generic call passes to the dispatch routine
@@ -327,10 +357,10 @@
 generic_call_nonvar_setup(higher_order(_, _, _, _), HoCallVariant,
         InVars, _OutVars, Code, !CI) :-
     (
-        HoCallVariant = known_num,
+        HoCallVariant = ho_call_known_num,
         Code = empty
     ;
-        HoCallVariant = unknown,
+        HoCallVariant = ho_call_unknown,
         code_info.clobber_regs([reg(reg_r, 2)], !CI),
         list.length(InVars, NInVars),
         Code = node([
@@ -341,14 +371,14 @@
 generic_call_nonvar_setup(class_method(_, Method, _, _), HoCallVariant,
         InVars, _OutVars, Code, !CI) :-
     (
-        HoCallVariant = known_num,
+        HoCallVariant = ho_call_known_num,
         code_info.clobber_regs([reg(reg_r, 2)], !CI),
         Code = node([
             assign(reg(reg_r, 2), const(llconst_int(Method))) -
                 "Index of class method in typeclass info"
         ])
     ;
-        HoCallVariant = unknown,
+        HoCallVariant = ho_call_unknown,
         code_info.clobber_regs([reg(reg_r, 2), reg(reg_r, 3)], !CI),
         list.length(InVars, NInVars),
         Code = node([
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.330
diff -u -b -r1.330 code_info.m
--- compiler/code_info.m	6 Sep 2006 04:02:55 -0000	1.330
+++ compiler/code_info.m	23 Sep 2006 09:15:15 -0000
@@ -708,8 +708,8 @@
 :- 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, goal_path::in, layout_label_info::in,
-    code_info::in, code_info::out) is det.
+    trace_port::in, bool::in, goal_path::in, maybe(solver_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.
 
@@ -895,10 +895,11 @@
 succip_is_used(!CI) :-
     set_succip_used(yes, !CI).
 
-add_trace_layout_for_label(Label, Context, Port, IsHidden, Path, Layout,
-        !CI) :-
+add_trace_layout_for_label(Label, Context, Port, IsHidden, Path,
+        MaybeSolverEventInfo, Layout, !CI) :-
     get_layout_info(!.CI, Internals0),
-    Exec = yes(trace_port_layout_info(Context, Port, IsHidden, Path, Layout)),
+    Exec = yes(trace_port_layout_info(Context, Port, IsHidden, Path,
+        MaybeSolverEventInfo, Layout)),
     (
         Label = internal(LabelNum, _)
     ;
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.79
diff -u -b -r1.79 continuation_info.m
--- compiler/continuation_info.m	20 Sep 2006 09:42:03 -0000	1.79
+++ compiler/continuation_info.m	23 Sep 2006 07:58:44 -0000
@@ -243,6 +243,7 @@
                 port_type       :: trace_port,
                 port_is_hidden  :: bool,
                 port_path       :: goal_path,
+                port_solver     :: maybe(solver_event_info),
                 port_label      :: layout_label_info
             ).
 
@@ -271,6 +272,19 @@
                                     % layout_var_info was created
             ).
 
+:- type solver_attribute
+    --->    solver_attribute(
+                attr_locn               :: rval,
+                attr_type               :: mer_type,
+                attr_name               :: string
+            ).
+
+:- type solver_event_info
+    --->    solver_event_info(
+                solver_port             :: string,
+                solver_attributes       :: list(solver_attribute)
+            ).
+
 :- type closure_layout_info
     --->    closure_layout_info(
                 list(closure_arg_info),
Index: compiler/global_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/global_data.m,v
retrieving revision 1.24
diff -u -b -r1.24 global_data.m
--- compiler/global_data.m	16 Sep 2006 10:46:39 -0000	1.24
+++ compiler/global_data.m	23 Sep 2006 07:02:11 -0000
@@ -19,7 +19,6 @@
 
 :- import_module hlds.hlds_pred.
 :- import_module ll_backend.continuation_info.
-:- import_module ll_backend.exprn_aux.
 :- import_module ll_backend.layout.
 :- import_module ll_backend.llds.
 :- import_module mdbcomp.prim_data.     % for module_name
@@ -92,12 +91,13 @@
     list(scalar_common_data_array)::out, list(vector_common_data_array)::out)
     is det.
 
-    % Given an rval, figure out the type it would have as an argument.
-    % Normally that's the same as its usual type; the exception is that for
-    % boxed floats, the type is data_ptr (i.e. the type of the boxed value)
-    % rather than float (the type of the unboxed value).
+    % Given an rval, and the value of the --unboxed_float option, figure out
+    % the type the rval would have as an argument. Normally that's the same
+    % as its usual type; the exception is that for boxed floats, the type
+    % is data_ptr (i.e. the type of the boxed value) rather than float
+    % (the type of the unboxed value).
     %
-:- pred rval_type_as_arg(rval::in, exprn_opts::in, llds_type::out) is det.
+:- pred rval_type_as_arg(rval::in, bool::in, llds_type::out) is det.
 
 %-----------------------------------------------------------------------------%
 
@@ -599,8 +599,8 @@
 
 %-----------------------------------------------------------------------------%
 
-rval_type_as_arg(Rval, ExprnOpts, Type) :-
-    natural_type(ExprnOpts ^ unboxed_float, Rval, Type).
+rval_type_as_arg(Rval, UnboxedFloat, Type) :-
+    natural_type(UnboxedFloat, Rval, Type).
 
 :- pred natural_type(bool::in, rval::in, llds_type::out) is det.
 
Index: compiler/layout.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout.m,v
retrieving revision 1.28
diff -u -b -r1.28 layout.m
--- compiler/layout.m	8 Jun 2006 08:19:15 -0000	1.28
+++ compiler/layout.m	23 Sep 2006 09:06:23 -0000
@@ -61,6 +61,7 @@
                 maybe_is_hidden         :: maybe(bool),
                 label_num_in_module     :: int,
                 maybe_goal_path         :: maybe(int), % offset
+                maybe_solver_info       :: maybe(solver_event_data),
                 maybe_var_info          :: maybe(label_var_info)
             )
     ;       proc_layout_data(           % defines MR_Proc_Layout
@@ -97,6 +98,15 @@
                 table_io_decl_type_params :: rval
             ).
 
+:- type solver_event_data
+    --->    solver_event_data(
+                solver_event_name       :: string,
+                solver_event_num_attr   :: int,
+                solver_event_locns      :: rval,
+                solver_event_types      :: rval,
+                solver_event_names      :: list(string)
+            ).
+
 :- type label_var_info
     --->    label_var_info(             % part of MR_Label_Layout
                 encoded_var_count       :: int,
@@ -108,9 +118,9 @@
 :- type proc_layout_stack_traversal     % defines MR_Stack_Traversal
     --->    proc_layout_stack_traversal(
                 entry_label             :: maybe(label),
-                                        % The proc entry label; will be
-                                        % `no' if we don't have static
-                                        % code addresses.
+                                        % The proc entry label; will be `no'
+                                        % if we don't have static code
+                                        % addresses.
                 succip_slot             :: maybe(int),
                 stack_slot_count        :: int,
                 detism                  :: determinism
@@ -187,6 +197,8 @@
 
 :- type layout_name
     --->    label_layout(proc_label, int, label_vars)
+    ;       solver_event_layout(proc_label, int)
+    ;       solver_event_attr_names(proc_label, int)
     ;       proc_layout(rtti_proc_label, proc_layout_kind)
             % A proc layout structure for stack tracing, accurate gc,
             % deep profiling and/or execution tracing.
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.72
diff -u -b -r1.72 layout_out.m
--- compiler/layout_out.m	20 Sep 2006 03:12:15 -0000	1.72
+++ compiler/layout_out.m	23 Sep 2006 14:34:41 -0000
@@ -126,10 +126,10 @@
     (
         Data = label_layout_data(ProcLabel, LabelNum, ProcLayoutAddr,
             MaybePort, MaybeIsHidden, LabelNumber, MaybeGoalPath,
-            MaybeVarInfo),
+            MaybeSolverData, MaybeVarInfo),
         output_label_layout_data_defn(ProcLabel, LabelNum, ProcLayoutAddr,
             MaybePort, MaybeIsHidden, LabelNumber, MaybeGoalPath,
-            MaybeVarInfo, !DeclSet, !IO)
+            MaybeSolverData, MaybeVarInfo, !DeclSet, !IO)
     ;
         Data = proc_layout_data(ProcLabel, Traversal, MaybeRest),
         output_proc_layout_data_defn(ProcLabel, Traversal, MaybeRest,
@@ -176,11 +176,16 @@
 
 extract_layout_name(Data, LayoutName) :-
     (
-        Data = label_layout_data(ProcLabel, LabelNum, _, _, _, _, _, yes(_)),
-        LayoutName = label_layout(ProcLabel, LabelNum, label_has_var_info)
+        Data = label_layout_data(ProcLabel, LabelNum, _, _, _, _, _, _,
+            MaybeVarInfo),
+        (
+            MaybeVarInfo = yes(_),
+            LabelVars = label_has_var_info
     ;
-        Data = label_layout_data(ProcLabel, LabelNum, _, _, _, _, _, no),
-        LayoutName = label_layout(ProcLabel, LabelNum, label_has_no_var_info)
+            MaybeVarInfo = no,
+            LabelVars = label_has_no_var_info
+        ),
+        LayoutName = label_layout(ProcLabel, LabelNum, LabelVars)
     ;
         Data = proc_layout_data(RttiProcLabel, _, MaybeRest),
         ProcLabel = make_proc_label_from_rtti(RttiProcLabel),
@@ -225,13 +230,25 @@
 
 output_layout_name(Data, !IO) :-
     (
-        Data =label_layout(ProcLabel, LabelNum, _),
+        Data = label_layout(ProcLabel, LabelNum, _),
         % This code should be kept in sync with make_label_layout_name/1 above.
         io.write_string(mercury_data_prefix, !IO),
         io.write_string("_label_layout__", !IO),
         io.write_string(label_to_c_string(internal(LabelNum, ProcLabel), yes),
             !IO)
     ;
+        Data = solver_event_layout(ProcLabel, LabelNum),
+        io.write_string(mercury_data_prefix, !IO),
+        io.write_string("_solver_event_layout__", !IO),
+        io.write_string(label_to_c_string(internal(LabelNum, ProcLabel), yes),
+            !IO)
+    ;
+        Data = solver_event_attr_names(ProcLabel, LabelNum),
+        io.write_string(mercury_data_prefix, !IO),
+        io.write_string("_solver_event_attr_names__", !IO),
+        io.write_string(label_to_c_string(internal(LabelNum, ProcLabel), yes),
+            !IO)
+    ;
         Data = proc_layout(RttiProcLabel, _),
         io.write_string(mercury_data_prefix, !IO),
         io.write_string("_proc_layout__", !IO),
@@ -353,6 +370,15 @@
         io.write_string(" ", !IO),
         output_layout_name(label_layout(ProcLabel, LabelNum, LabelVars), !IO)
     ;
+        Data = solver_event_layout(ProcLabel, LabelNum),
+        io.write_string("static const struct MR_Solver_Event_Struct ", !IO),
+        output_layout_name(solver_event_layout(ProcLabel, LabelNum), !IO)
+    ;
+        Data = solver_event_attr_names(ProcLabel, LabelNum),
+        io.write_string("static const char * ", !IO),
+        output_layout_name(solver_event_attr_names(ProcLabel, LabelNum), !IO),
+        io.write_string("[]", !IO)
+    ;
         Data = proc_layout(ProcLabel, Kind),
         ProcIsImported = ProcLabel ^ proc_is_imported,
         ProcIsExported = ProcLabel ^ proc_is_exported,
@@ -466,6 +492,8 @@
     ).
 
 layout_name_would_include_code_addr(label_layout(_, _, _)) = no.
+layout_name_would_include_code_addr(solver_event_layout(_, _)) = no.
+layout_name_would_include_code_addr(solver_event_attr_names(_, _)) = no.
 layout_name_would_include_code_addr(proc_layout(_, _)) = no.
 layout_name_would_include_code_addr(proc_layout_exec_trace(_)) = yes.
 layout_name_would_include_code_addr(proc_layout_head_var_nums(_)) = no.
@@ -499,33 +527,67 @@
 %-----------------------------------------------------------------------------%
 
 :- type rval_or_numpair_or_none
-    --->    rval(rval)
-    ;       num_pair(type_num, int)
-    ;       none.
+    --->    kind_rval(rval)
+    ;       kind_num_pair(type_num, int)
+    ;       kind_none.
 
 :- pred output_rval_or_numpair_or_none(rval_or_numpair_or_none::in,
     io::di, io::uo) is det.
 
-output_rval_or_numpair_or_none(rval(Rval), !IO) :-
+output_rval_or_numpair_or_none(kind_rval(Rval), !IO) :-
     io.write_string(", ", !IO),
     output_rval_as_addr(Rval, !IO).
-output_rval_or_numpair_or_none(num_pair(type_num(Num1), Num2), !IO) :-
+output_rval_or_numpair_or_none(kind_num_pair(type_num(Num1), Num2), !IO) :-
     io.write_string(", ", !IO),
     io.write_int(Num1, !IO),
     io.write_string(", ", !IO),
     io.write_int(Num2, !IO).
-output_rval_or_numpair_or_none(none, !IO).
+output_rval_or_numpair_or_none(kind_none, !IO).
 
 :- pred output_label_layout_data_defn(proc_label::in, int::in, layout_name::in,
     maybe(trace_port)::in, maybe(bool)::in, int::in, maybe(int)::in,
-    maybe(label_var_info)::in, decl_set::in, decl_set::out,
-    io::di, io::uo) is det.
+    maybe(solver_event_data)::in, maybe(label_var_info)::in,
+    decl_set::in, decl_set::out, io::di, io::uo) is det.
 
 output_label_layout_data_defn(ProcLabel, LabelNum, ProcLayoutAddr, MaybePort,
-        MaybeIsHidden, LabelNumberInModule, MaybeGoalPath, MaybeVarInfo,
-        !DeclSet, !IO) :-
+        MaybeIsHidden, LabelNumberInModule, MaybeGoalPath, MaybeSolverData,
+        MaybeVarInfo, !DeclSet, !IO) :-
     output_layout_decl(ProcLayoutAddr, !DeclSet, !IO),
     (
+        MaybeSolverData = no,
+        SolverChars = ""
+    ;
+        MaybeSolverData = yes(SolverData),
+        SolverChars = "_S",
+        SolverData = solver_event_data(SolverEventName, SolverNumAttributes,
+            SolverLocnsRval, SolverTypesRval, SolverAttrNames),
+
+        AttrNamesLayoutName = solver_event_attr_names(ProcLabel, LabelNum),
+        AttrNamesDataAddr = layout_addr(AttrNamesLayoutName),
+        AttrNamesRval = const(llconst_data_addr(AttrNamesDataAddr, no)),
+        decl_set_insert(decl_data_addr(AttrNamesDataAddr), !DeclSet),
+        output_layout_name_storage_type_name(SolverLayoutName, no, !IO),
+        io.write_string(" = {\n", !IO),
+        io.write_list(SolverAttrNames, ", ", io.write, !IO),
+        io.write_string("};\n\n", !IO),
+
+        SolverLayoutName = solver_event_layout(ProcLabel, LabelNum),
+        SolverDataAddr = layout_addr(SolverLayoutName),
+        decl_set_insert(decl_data_addr(SolverDataAddr), !DeclSet),
+        output_layout_name_storage_type_name(SolverLayoutName, no, !IO),
+        io.write_string(" = {\n""", !IO),
+        io.write_string(SolverEventName, !IO),
+        io.write_string(""",\n", !IO),
+        io.write_int(SolverNumAttributes, !IO),
+        io.write_string(",\n", !IO),
+        output_rval_as_addr(SolverLocnsRval, !IO),
+        io.write_string(",\n", !IO),
+        output_rval_as_addr(SolverTypesRval, !IO),
+        io.write_string(",\n", !IO),
+        output_rval_as_addr(AttrNamesRval, !IO),
+        io.write_string("};\n\n", !IO)
+    ),
+    (
         MaybeIsHidden = yes(yes),
         HiddenChars = "T"
     ;
@@ -556,37 +618,38 @@
                     scalar_common_ref(TPTypeNum, TPCellNum))
             ->
                 CommonChars = "XCCC",
-                LocnsTypes1 = num_pair(LTTypeNum, LTCellNum),
-                VarNums1 = num_pair(VNTypeNum, VNCellNum),
-                TypeParams1 = num_pair(TPTypeNum, TPCellNum)
+                LocnsTypes1 = kind_num_pair(LTTypeNum, LTCellNum),
+                VarNums1 = kind_num_pair(VNTypeNum, VNCellNum),
+                TypeParams1 = kind_num_pair(TPTypeNum, TPCellNum)
             ;
                 TypeParams0 = const(llconst_int(0))
             ->
                 CommonChars = "XCC0",
-                LocnsTypes1 = num_pair(LTTypeNum, LTCellNum),
-                VarNums1 = num_pair(VNTypeNum, VNCellNum),
-                TypeParams1 = none
+                LocnsTypes1 = kind_num_pair(LTTypeNum, LTCellNum),
+                VarNums1 = kind_num_pair(VNTypeNum, VNCellNum),
+                TypeParams1 = kind_none
             ;
                 CommonChars = "",
-                LocnsTypes1 = rval(LocnsTypes0),
-                VarNums1 = rval(VarNums0),
-                TypeParams1 = rval(TypeParams0)
+                LocnsTypes1 = kind_rval(LocnsTypes0),
+                VarNums1 = kind_rval(VarNums0),
+                TypeParams1 = kind_rval(TypeParams0)
             )
         ;
             CommonChars = "",
-            LocnsTypes1 = rval(LocnsTypes0),
-            VarNums1 = rval(VarNums0),
-            TypeParams1 = rval(TypeParams0)
+            LocnsTypes1 = kind_rval(LocnsTypes0),
+            VarNums1 = kind_rval(VarNums0),
+            TypeParams1 = kind_rval(TypeParams0)
         ),
-        Macro = "MR_DEF_LL" ++ HiddenChars ++ CommonChars,
+        Macro0 = "MR_DEF_LL" ++ HiddenChars ++ CommonChars,
         MaybeVarInfoTuple = yes({EncodedVarCount1, LocnsTypes1, VarNums1,
             TypeParams1})
     ;
         MaybeVarInfo = no,
         LabelVars = label_has_no_var_info,
-        Macro = "MR_DEF_LLNVI" ++ HiddenChars,
+        Macro0 = "MR_DEF_LLNVI" ++ HiddenChars,
         MaybeVarInfoTuple = no
     ),
+    Macro = Macro0 ++ SolverChars,
     LayoutName = label_layout(ProcLabel, LabelNum, LabelVars),
     io.write_string("\n", !IO),
     io.write_string(Macro, !IO),
@@ -646,23 +709,27 @@
         output_rval(Rval, !IO)
     ).
 
+    % Return the name of the given port, as in the enum MR_Trace_Port
+    % in runtime/mercury_stack_layout.h.
+    %
 :- func trace_port_to_string(trace_port) = string.
 
-trace_port_to_string(call) =                "CALL".
-trace_port_to_string(exit) =                "EXIT".
-trace_port_to_string(redo) =                "REDO".
-trace_port_to_string(fail) =                "FAIL".
-trace_port_to_string(exception) =           "EXCEPTION".
-trace_port_to_string(ite_cond) =            "COND".
-trace_port_to_string(ite_then) =            "THEN".
-trace_port_to_string(ite_else) =            "ELSE".
-trace_port_to_string(neg_enter) =           "NEG_ENTER".
-trace_port_to_string(neg_success) =         "NEG_SUCCESS".
-trace_port_to_string(neg_failure) =         "NEG_FAILURE".
-trace_port_to_string(disj) =                "DISJ".
-trace_port_to_string(switch) =              "SWITCH".
-trace_port_to_string(nondet_pragma_first) = "PRAGMA_FIRST".
-trace_port_to_string(nondet_pragma_later) = "PRAGMA_LATER".
+trace_port_to_string(port_call) =                "CALL".
+trace_port_to_string(port_exit) =                "EXIT".
+trace_port_to_string(port_redo) =                "REDO".
+trace_port_to_string(port_fail) =                "FAIL".
+trace_port_to_string(port_exception) =           "EXCEPTION".
+trace_port_to_string(port_ite_cond) =            "COND".
+trace_port_to_string(port_ite_then) =            "THEN".
+trace_port_to_string(port_ite_else) =            "ELSE".
+trace_port_to_string(port_neg_enter) =           "NEG_ENTER".
+trace_port_to_string(port_neg_success) =         "NEG_SUCCESS".
+trace_port_to_string(port_neg_failure) =         "NEG_FAILURE".
+trace_port_to_string(port_disj) =                "DISJ".
+trace_port_to_string(port_switch) =              "SWITCH".
+trace_port_to_string(port_nondet_pragma_first) = "PRAGMA_FIRST".
+trace_port_to_string(port_nondet_pragma_later) = "PRAGMA_LATER".
+trace_port_to_string(port_solver) =              "SOLVER".
 
 %-----------------------------------------------------------------------------%
 
@@ -793,7 +860,7 @@
         % by module initialization code.
         io.write_string("NULL", !IO)
     ),
-    io.write_string(",\n", !IO),
+    io.write_string(",\n{ ", !IO),
     (
         MaybeSuccipSlot = yes(SuccipSlot),
         io.write_int(SuccipSlot, !IO)
@@ -801,7 +868,7 @@
         MaybeSuccipSlot = no,
         io.write_int(-1, !IO)
     ),
-    io.write_string(",\n", !IO),
+    io.write_string(" },\n", !IO),
     io.write_int(StackSlotCount, !IO),
     io.write_string(",\n", !IO),
     io.write_string(detism_to_c_detism(Detism), !IO),
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.291
diff -u -b -r1.291 llds_out.m
--- compiler/llds_out.m	5 Sep 2006 04:23:21 -0000	1.291
+++ compiler/llds_out.m	23 Sep 2006 06:55:04 -0000
@@ -371,7 +371,7 @@
         !OtherLayouts) :-
     ( Layout = proc_layout_data(_, _, _) ->
         !:ProcLayouts = [Layout | !.ProcLayouts]
-    ; Layout = label_layout_data(_, _, _, _, _, _, _, _) ->
+    ; Layout = label_layout_data(_, _, _, _, _, _, _, _, _) ->
         !:LabelLayouts = [Layout | !.LabelLayouts]
     ;
         !:OtherLayouts = [Layout | !.OtherLayouts]
@@ -3263,25 +3263,6 @@
     ),
     output_cons_arg_group_types(Groups, Indent, ArgNum + 1, !IO).
 
-    % Given an rval, figure out the type it would have as an argument.
-    % Normally that's the same as its usual type; the exception is that
-    % for boxed floats, the type is data_ptr (i.e. the type of the boxed value)
-    % rather than float (the type of the unboxed value).
-    %
-:- pred rval_type_as_arg(rval::in, llds_type::out, io::di, io::uo) is det.
-
-rval_type_as_arg(Rval, ArgType, !IO) :-
-    llds.rval_type(Rval, Type),
-    globals.io_lookup_bool_option(unboxed_float, UnboxFloat, !IO),
-    (
-        Type = float,
-        UnboxFloat = no
-    ->
-        ArgType = data_ptr
-    ;
-        ArgType = Type
-    ).
-
     % Same as output_llds_type, but will put parentheses around the llds_type.
     %
 :- pred output_llds_type_cast(llds_type::in, io::di, io::uo) is det.
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.176
diff -u -b -r1.176 opt_debug.m
--- compiler/opt_debug.m	20 Sep 2006 09:42:10 -0000	1.176
+++ compiler/opt_debug.m	23 Sep 2006 13:45:34 -0000
@@ -454,6 +454,12 @@
         LabelVarsStr = "label_has_no_var_info"
     ),
     Str = "label_layout(" ++ LabelStr ++ ", " ++ LabelVarsStr ++ ")".
+dump_layout_name(solver_event_layout(ProcLabel, LabelNum)) = Str :-
+    LabelStr = dump_label(internal(LabelNum, ProcLabel)),
+    Str = "solver_event_layout(" ++ LabelStr ++ ")".
+dump_layout_name(solver_event_attr_names(ProcLabel, LabelNum)) = Str :-
+    LabelStr = dump_label(internal(LabelNum, ProcLabel)),
+    Str = "solver_event_attr_names(" ++ LabelStr ++ ")".
 dump_layout_name(proc_layout(RttiProcLabel, _)) =
     "proc_layout(" ++ dump_rttiproclabel(RttiProcLabel) ++ ")".
 dump_layout_name(proc_layout_exec_trace(RttiProcLabel)) =
Index: compiler/prog_event.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_event.m,v
retrieving revision 1.1
diff -u -b -r1.1 prog_event.m
--- compiler/prog_event.m	5 Sep 2006 06:21:29 -0000	1.1
+++ compiler/prog_event.m	23 Sep 2006 14:09:09 -0000
@@ -19,14 +19,23 @@
 
 :- import_module parse_tree.prog_data.
 
-:- import_module assoc_list.
 :- import_module list.
 
+:- type event_attribute
+    --->    event_attribute(
+                attr_name       :: string,
+                attr_type       :: mer_type,
+                attr_mode       :: mer_mode
+            ).
+
     % Given an event name, returns the types and modes of the arguments
     % of the event.
     %
-:- pred event_arg_types_modes(string::in,
-    assoc_list(mer_type, mer_mode)::out) is semidet.
+:- pred event_args(string::in, list(event_attribute)::out) is semidet.
+
+    % Given an event name, returns the names of the arguments of the event.
+    %
+:- pred event_arg_names(string::in, list(string)::out) is semidet.
 
     % Given an event name, returns the types of the arguments of the event.
     %
@@ -42,13 +51,29 @@
 
 :- import_module pair.
 
-event_arg_types_modes("test_event",
-    [builtin_type(builtin_type_string) - in_mode]).
+event_args("test_event",
+    [event_attribute("arg1", builtin_type(builtin_type_string), in_mode)]).
+
+event_arg_names(EventName, ArgNames) :-
+    event_args(EventName, ArgInfos),
+    ArgNames = list.map(project_event_arg_name, ArgInfos).
 
 event_arg_types(EventName, ArgTypes) :-
-    event_arg_types_modes(EventName, ArgTypesModes),
-    assoc_list.keys(ArgTypesModes, ArgTypes).
+    event_args(EventName, ArgInfos),
+    ArgTypes = list.map(project_event_arg_type, ArgInfos).
 
 event_arg_modes(EventName, ArgModes) :-
-    event_arg_types_modes(EventName, ArgTypesModes),
-    assoc_list.values(ArgTypesModes, ArgModes).
+    event_args(EventName, ArgInfos),
+    ArgModes = list.map(project_event_arg_mode, ArgInfos).
+
+:- func project_event_arg_name(event_attribute) = string.
+
+project_event_arg_name(Attribute) = Attribute ^ attr_name.
+
+:- func project_event_arg_type(event_attribute) = mer_type.
+
+project_event_arg_type(Attribute) = Attribute ^ attr_type.
+
+:- func project_event_arg_mode(event_attribute) = mer_mode.
+
+project_event_arg_mode(Attribute) = Attribute ^ attr_mode.
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.121
diff -u -b -r1.121 stack_layout.m
--- compiler/stack_layout.m	22 Aug 2006 05:04:07 -0000	1.121
+++ compiler/stack_layout.m	23 Sep 2006 11:01:22 -0000
@@ -392,7 +392,7 @@
         update_label_table_2(ProcLabel, LabelNum,
             LabelVars, Context, IsReturn, !LabelTables)
     ;
-        Port = yes(trace_port_layout_info(Context, _, _, _, _)),
+        Port = yes(trace_port_layout_info(Context, _, _, _, _, _)),
         context_is_valid(Context)
     ->
         update_label_table_2(ProcLabel, LabelNum, LabelVars, Context,
@@ -733,7 +733,7 @@
     Internal = internal_layout_info(MaybeTrace, MaybeResume, MaybeReturn),
     (
         MaybeTrace = yes(Trace),
-        Trace = trace_port_layout_info(_, _, _, _, TraceLayout),
+        Trace = trace_port_layout_info(_, _, _, _, _, TraceLayout),
         label_layout_var_number_map(TraceLayout, !VarNumMap, !Counter)
     ;
         MaybeTrace = no
@@ -805,9 +805,11 @@
     (
         Trace = no,
         set.init(TraceLiveVarSet),
-        map.init(TraceTypeVarMap)
+        map.init(TraceTypeVarMap),
+        MaybeSolverInfo = no
     ;
-        Trace = yes(trace_port_layout_info(_,_,_,_, TraceLayout)),
+        Trace = yes(trace_port_layout_info(_,_,_,_, MaybeSolverInfo,
+            TraceLayout)),
         TraceLayout = layout_label_info(TraceLiveVarSet, TraceTypeVarMap)
     ),
     (
@@ -819,7 +821,7 @@
         ResumeLayout = layout_label_info(ResumeLiveVarSet, ResumeTypeVarMap)
     ),
     (
-        Trace = yes(trace_port_layout_info(_, Port, IsHidden, GoalPath, _)),
+        Trace = yes(trace_port_layout_info(_, Port, IsHidden, GoalPath, _, _)),
         Return = no,
         MaybePort = yes(Port),
         MaybeIsHidden = yes(IsHidden),
@@ -832,14 +834,12 @@
         % We only ever use the port fields of these layout structures
         % when we process exception events. (Since exception events are
         % interface events, the goal path field is not meaningful then.)
-        MaybePort = yes(exception),
+        MaybePort = yes(port_exception),
         MaybeIsHidden = yes(no),
         % 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)
-        ->
+        ( find_valid_return_context(TargetsContexts, _, _, GoalPath) ->
             goal_path_to_string(GoalPath, GoalPathStr),
             lookup_string_in_table(GoalPathStr, GoalPathNum, !Info),
             MaybeGoalPath = yes(GoalPathNum)
@@ -859,8 +859,7 @@
     ;
         Trace = yes(_),
         Return = yes(_),
-        unexpected(this_file,
-            "label has both trace and return layout info")
+        unexpected(this_file, "label has both trace and return layout info")
     ),
     get_agc_stack_layout(!.Info, AgcStackLayout),
     (
@@ -908,13 +907,36 @@
         MaybeVarInfo = yes(VarInfo),
         LabelVars = label_has_var_info
     ),
+    (
+        MaybeSolverInfo = no,
+        MaybeSolverData = no
+    ;
+        MaybeSolverInfo = yes(SolverInfo),
+        SolverInfo = solver_event_info(SolverEventName, Attributes),
+        list.length(Attributes, NumAttributes),
+        construct_solver_data_array(Attributes,
+            SolverLocnsArray, SolverTypesArray, SolverAttrNames, !Info),
+
+        get_static_cell_info(!.Info, StaticCellInfo0),
+        add_scalar_static_cell(SolverLocnsArray, SolverLocnsDataAddr,
+            StaticCellInfo0, StaticCellInfo1),
+        add_scalar_static_cell(SolverTypesArray, SolverTypesDataAddr,
+            StaticCellInfo1, StaticCellInfo),
+        set_static_cell_info(StaticCellInfo, !Info),
+
+        SolverLocnsRval = const(llconst_data_addr(SolverLocnsDataAddr, no)),
+        SolverTypesRval = const(llconst_data_addr(SolverTypesDataAddr, no)),
+        SolverData = solver_event_data(SolverEventName, NumAttributes,
+            SolverLocnsRval, SolverTypesRval, SolverAttrNames),
+        MaybeSolverData = yes(SolverData)
+    ),
 
     (
         Trace = yes(_),
         allocate_label_number(LabelNumber0, !Info),
-        % MR_ml_label_exec_count[0] is never written out;
-        % it is reserved for cases like this, for labels without
-        % events, and for handwritten labels.
+        % MR_ml_label_exec_count[0] is never written out; it is reserved for
+        % cases like this, for labels without events, and for handwritten
+        % labels.
         ( LabelNumber0 < (1 << 16) ->
             LabelNumber = LabelNumber0
         ;
@@ -925,12 +947,37 @@
         LabelNumber = 0
     ),
     LayoutData = label_layout_data(ProcLabel, LabelNum, ProcLayoutName,
-        MaybePort, MaybeIsHidden, LabelNumber, MaybeGoalPath, MaybeVarInfo),
+        MaybePort, MaybeIsHidden, LabelNumber, MaybeGoalPath, MaybeSolverData,
+        MaybeVarInfo),
     LayoutName = label_layout(ProcLabel, LabelNum, LabelVars),
     Label = internal(LabelNum, ProcLabel),
     add_internal_layout_data(LayoutData, Label, LayoutName, !Info),
     LabelLayout = {ProcLabel, LabelNum, LabelVars, Internal}.
 
+:- pred construct_solver_data_array(list(solver_attribute)::in,
+    assoc_list(rval, llds_type)::out, assoc_list(rval, llds_type)::out,
+    list(string)::out, stack_layout_info::in, stack_layout_info::out) is det.
+
+construct_solver_data_array([], [], [], [], !Info).
+construct_solver_data_array([Attr | Attrs],
+        [LocnRvalAndType | LocnRvalAndTypes],
+        [TypeRvalAndType | TypeRvalAndTypes], [Name | Names], !Info) :-
+    Attr = solver_attribute(Locn, Type, Name),
+    represent_locn_or_const_as_int_rval(Locn, LocnRval, LocnRvalType, !Info),
+    LocnRvalAndType = LocnRval - LocnRvalType,
+
+    ExistQTvars = [],
+    NumUnivQTvars = -1,
+    get_static_cell_info(!.Info, StaticCellInfo0),
+    ll_pseudo_type_info.construct_typed_llds_pseudo_type_info(Type,
+        NumUnivQTvars, ExistQTvars, StaticCellInfo0, StaticCellInfo,
+        TypeRval, TypeRvalType),
+    set_static_cell_info(StaticCellInfo, !Info),
+    TypeRvalAndType = TypeRval - TypeRvalType,
+
+    construct_solver_data_array(Attrs, LocnRvalAndTypes, TypeRvalAndTypes,
+        Names, !Info).
+
 %---------------------------------------------------------------------------%
 
 :- pred construct_livelval_rvals(set(layout_var_info)::in,
@@ -1171,7 +1218,7 @@
         LiveValueType = live_value_var(_, _, Type, _),
         get_module_info(!.Info, ModuleInfo),
         is_dummy_argument_type(ModuleInfo, Type),
-        % We want to preserve I/O states in registers
+        % We want to preserve I/O states in registers.
         \+ (
             Locn = direct(reg(_, _))
         )
@@ -1384,6 +1431,39 @@
 
 %---------------------------------------------------------------------------%
 
+:- pred represent_locn_or_const_as_int_rval(rval::in, rval::out,
+    llds_type::out, stack_layout_info::in, stack_layout_info::out) is det.
+
+represent_locn_or_const_as_int_rval(LvalOrConst, Rval, Type, !Info) :-
+    (
+        LvalOrConst = lval(Lval),
+        represent_locn_as_int_rval(direct(Lval), Rval),
+        Type = uint_least32
+    ;
+        LvalOrConst = const(_Const),
+        get_module_info(!.Info, ModuleInfo),
+        module_info_get_globals(ModuleInfo, Globals),
+        globals.lookup_bool_option(Globals, unboxed_float, UnboxedFloat),
+        rval_type_as_arg(LvalOrConst, UnboxedFloat, LLDSType),
+
+        get_static_cell_info(!.Info, StaticCellInfo0),
+        add_scalar_static_cell([LvalOrConst - LLDSType], DataAddr,
+            StaticCellInfo0, StaticCellInfo),
+        set_static_cell_info(StaticCellInfo, !Info),
+        Rval = const(llconst_data_addr(DataAddr, no)),
+        Type = data_ptr
+    ;
+        ( LvalOrConst = binop(_, _, _)
+        ; LvalOrConst = unop(_, _)
+        ; LvalOrConst = mkword(_, _)
+        ; LvalOrConst = mem_addr(_)
+        ; LvalOrConst = var(_)
+        ),
+        unexpected(this_file, "represent_locn_or_const_as_int_rval: bad rval")
+    ).
+
+%---------------------------------------------------------------------------%
+
     % Construct a representation of a variable location as a 32-bit integer.
     %
     % Most of the time, a layout specifies a location as an lval.
@@ -1488,16 +1568,16 @@
 
 :- pred locn_type_code(locn_type::in, int::out) is det.
 
-locn_type_code(lval_r_reg,    0).
-locn_type_code(lval_f_reg,    1).
-locn_type_code(lval_stackvar, 2).
-locn_type_code(lval_framevar, 3).
-locn_type_code(lval_succip,   4).
-locn_type_code(lval_maxfr,    5).
-locn_type_code(lval_curfr,    6).
-locn_type_code(lval_hp,       7).
-locn_type_code(lval_sp,       8).
-locn_type_code(lval_indirect, 9).
+locn_type_code(lval_r_reg,    1).
+locn_type_code(lval_f_reg,    2).
+locn_type_code(lval_stackvar, 3).
+locn_type_code(lval_framevar, 5).
+locn_type_code(lval_succip,   6).
+locn_type_code(lval_maxfr,    7).
+locn_type_code(lval_curfr,    9).
+locn_type_code(lval_hp,       10).
+locn_type_code(lval_sp,       11).
+locn_type_code(lval_indirect, 13).
 
     % This number of tag bits must be able to encode all values of
     % locn_type_code.
Index: compiler/trace_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_gen.m,v
retrieving revision 1.6
diff -u -b -r1.6 trace_gen.m
--- compiler/trace_gen.m	20 Sep 2006 09:42:15 -0000	1.6
+++ compiler/trace_gen.m	23 Sep 2006 10:21:55 -0000
@@ -53,6 +53,7 @@
 :- import_module hlds.hlds_pred.
 :- import_module libs.globals.
 :- import_module ll_backend.code_info.
+:- import_module ll_backend.continuation_info.
 :- import_module ll_backend.llds.
 :- import_module parse_tree.prog_data.
 
@@ -195,6 +196,11 @@
 :- pred maybe_generate_pragma_event_code(nondet_pragma_trace_port::in,
     prog_context::in, code_tree::out, code_info::in, code_info::out) is det.
 
+    % Generate code for a solver trace event.
+    %
+:- pred generate_solver_event_code(solver_event_info::in, hlds_goal_info::in,
+    code_tree::out, code_info::in, code_info::out) is det.
+
 :- type external_event_info
     --->    external_event_info(
                 label,      % The label associated with the
@@ -242,7 +248,6 @@
 :- import_module libs.trace_params.
 :- import_module libs.tree.
 :- import_module ll_backend.code_util.
-:- import_module ll_backend.continuation_info.
 :- import_module ll_backend.layout_out.
 :- import_module ll_backend.llds_out.
 :- import_module mdbcomp.prim_data.
@@ -260,18 +265,21 @@
     % Information specific to a trace port.
     %
 :- type trace_port_info
-    --->    external
-    ;       internal(
+    --->    port_info_external
+    ;       port_info_internal(
                 goal_path,      % The path of the goal whose start
                                 % this port represents.
                 set(prog_var)   % The pre-death set of this goal.
             )
-    ;       negation_end(
+    ;       port_info_negation_end(
                 goal_path       % The path of the goal whose end
                                 % (one way or another) this port
                                 % represents.
             )
-    ;       nondet_pragma.
+    ;       port_info_solver(
+                goal_path       % The path of the goal.
+            )
+    ;       port_info_nondet_pragma.
 
 trace_fail_vars(ModuleInfo, ProcInfo, FailVars) :-
     proc_info_get_headvars(ProcInfo, HeadVars),
@@ -394,7 +402,7 @@
         (
             proc_info_interface_code_model(ProcInfo, model_non),
             eff_trace_needs_port(PredInfo, ProcInfo, TraceLevel,
-                TraceSuppress, redo) = yes
+                TraceSuppress, port_redo) = yes
         ->
             RedoLayout = 1
         ;
@@ -451,7 +459,7 @@
     globals.get_trace_suppress(Globals, TraceSuppress),
     globals.lookup_bool_option(Globals, trace_table_io, TraceTableIo),
     TraceRedo = eff_trace_needs_port(PredInfo, ProcInfo, TraceLevel,
-        TraceSuppress, redo),
+        TraceSuppress, port_redo),
     (
         TraceRedo = yes,
         CodeModel = model_non
@@ -677,22 +685,22 @@
             Path = [LastStep | _],
             (
                 LastStep = switch(_, _),
-                PortPrime = switch
+                PortPrime = port_switch
             ;
                 LastStep = disj(_),
-                PortPrime = disj
+                PortPrime = port_disj
             ;
                 LastStep = ite_cond,
-                PortPrime = ite_cond
+                PortPrime = port_ite_cond
             ;
                 LastStep = ite_then,
-                PortPrime = ite_then
+                PortPrime = port_ite_then
             ;
                 LastStep = ite_else,
-                PortPrime = ite_else
+                PortPrime = port_ite_else
             ;
                 LastStep = neg,
-                PortPrime = neg_enter
+                PortPrime = port_neg_enter
             )
         ->
             Port = PortPrime
@@ -716,8 +724,8 @@
             ;
                 HideEvent = no
             ),
-            generate_event_code(Port, internal(Path, PreDeaths),
-                TraceInfo, Context, HideEvent, _, _, Code, !CI)
+            generate_event_code(Port, port_info_internal(Path, PreDeaths),
+                yes(TraceInfo), Context, HideEvent, no, _, _, Code, !CI)
         ;
             Code = empty
         )
@@ -732,10 +740,10 @@
         MaybeTraceInfo = yes(TraceInfo),
         (
             NegPort = neg_failure,
-            Port = neg_failure
+            Port = port_neg_failure
         ;
             NegPort = neg_success,
-            Port = neg_success
+            Port = port_neg_success
         ),
         code_info.get_pred_info(!.CI, PredInfo),
         code_info.get_proc_info(!.CI, ProcInfo),
@@ -751,8 +759,8 @@
         ;
             HideEvent = no
         ),
-        generate_event_code(Port, negation_end(Path), TraceInfo, Context,
-            HideEvent, _, _, Code, !CI)
+        generate_event_code(Port, port_info_negation_end(Path), yes(TraceInfo),
+            Context, HideEvent, no, _, _, Code, !CI)
     ;
         Code = empty
     ).
@@ -768,12 +776,22 @@
             TraceInfo ^ trace_level,
             TraceInfo ^ trace_suppress_items, Port) = yes
     ->
-        generate_event_code(Port, nondet_pragma, TraceInfo, Context, no, _, _,
-            Code, !CI)
+        generate_event_code(Port, port_info_nondet_pragma, yes(TraceInfo),
+            Context, no, no, _, _, Code, !CI)
     ;
         Code = empty
     ).
 
+generate_solver_event_code(SolverInfo, GoalInfo, Code, !CI) :-
+    goal_info_get_goal_path(GoalInfo, Path),
+    goal_info_get_context(GoalInfo, Context),
+    Port = port_solver,
+    PortInfo = port_info_solver(Path),
+    MaybeTraceInfo = no,
+    HideEvent = no,
+    generate_event_code(Port, PortInfo, MaybeTraceInfo, Context, HideEvent,
+        yes(SolverInfo), _Label, _TvarDataMap, Code, !CI).
+
 generate_external_event_code(ExternalPort, TraceInfo, Context,
         MaybeExternalInfo, !CI) :-
     Port = convert_external_port_type(ExternalPort),
@@ -784,46 +802,49 @@
             TraceInfo ^ trace_level,
             TraceInfo ^ trace_suppress_items, Port) = yes
     ->
-        generate_event_code(Port, external, TraceInfo, Context, no, Label,
-            TvarDataMap, Code, !CI),
-        MaybeExternalInfo = yes(external_event_info(Label,
-            TvarDataMap, Code))
+        generate_event_code(Port, port_info_external, yes(TraceInfo), Context,
+            no, no, Label, TvarDataMap, Code, !CI),
+        MaybeExternalInfo = yes(external_event_info(Label, TvarDataMap, Code))
     ;
         MaybeExternalInfo = no
     ).
 
 :- pred generate_event_code(trace_port::in, trace_port_info::in,
-    trace_info::in, prog_context::in, bool::in, label::out,
+    maybe(trace_info)::in, prog_context::in, bool::in,
+    maybe(solver_event_info)::in, label::out,
     map(tvar, set(layout_locn))::out, code_tree::out,
     code_info::in, code_info::out) is det.
 
-generate_event_code(Port, PortInfo, TraceInfo, Context, HideEvent, Label,
-        TvarDataMap, Code, !CI) :-
+generate_event_code(Port, PortInfo, MaybeTraceInfo, Context, HideEvent,
+        MaybeSolverInfo, Label, TvarDataMap, Code, !CI) :-
     code_info.get_next_label(Label, !CI),
     code_info.get_known_variables(!.CI, LiveVars0),
     (
-        PortInfo = external,
+        PortInfo = port_info_external,
         LiveVars = LiveVars0,
         Path = []
     ;
-        PortInfo = internal(Path, PreDeaths),
+        PortInfo = port_info_internal(Path, PreDeaths),
         ResumeVars = code_info.current_resume_point_vars(!.CI),
         set.difference(PreDeaths, ResumeVars, RealPreDeaths),
         set.to_sorted_list(RealPreDeaths, RealPreDeathList),
         list.delete_elems(LiveVars0, RealPreDeathList, LiveVars)
     ;
-        PortInfo = negation_end(Path),
+        PortInfo = port_info_negation_end(Path),
+        LiveVars = LiveVars0
+    ;
+        PortInfo = port_info_solver(Path),
         LiveVars = LiveVars0
     ;
-        PortInfo = nondet_pragma,
+        PortInfo = port_info_nondet_pragma,
         LiveVars = [],
-        ( Port = nondet_pragma_first ->
+        ( Port = port_nondet_pragma_first ->
             Path = [first]
-        ; Port = nondet_pragma_later ->
+        ; Port = port_nondet_pragma_later ->
             Path = [later]
         ;
-            unexpected(this_file, "generate_event_code: " ++
-                "bad nondet pragma port")
+            unexpected(this_file,
+                "generate_event_code: bad nondet pragma port")
         )
     ),
     VarTypes = code_info.get_var_types(!.CI),
@@ -856,11 +877,18 @@
     set.list_to_set(VarInfoList, VarInfoSet),
     LayoutLabelInfo = layout_label_info(VarInfoSet, TvarDataMap),
     LabelStr = llds_out.label_to_c_string(Label, no),
-    string.append_list(["\t\tMR_EVENT(", LabelStr, ")\n"], TraceStmt),
+    (
+        MaybeSolverInfo = no,
+        TraceStmt = "\t\tMR_EVENT(" ++ LabelStr ++ ")\n"
+    ;
+        MaybeSolverInfo = yes(_),
+        TraceStmt = "\t\tMR_SOLVER_EVENT(" ++ LabelStr ++ ")\n"
+    ),
     code_info.add_trace_layout_for_label(Label, Context, Port, HideEvent,
-        Path, LayoutLabelInfo, !CI),
+        Path, MaybeSolverInfo, LayoutLabelInfo, !CI),
     (
-        Port = fail,
+        Port = port_fail,
+        MaybeTraceInfo = yes(TraceInfo),
         TraceInfo ^ redo_label = yes(RedoLabel)
     ->
         % The layout information for the redo event is the same as
@@ -873,8 +901,8 @@
         % at procedure entry. Therefore setup reserves a label
         % for the redo event, whose layout information is filled in
         % when we get to the fail event.
-        code_info.add_trace_layout_for_label(RedoLabel, Context, redo,
-            HideEvent, Path, LayoutLabelInfo, !CI)
+        code_info.add_trace_layout_for_label(RedoLabel, Context, port_redo,
+            HideEvent, Path, no, LayoutLabelInfo, !CI)
     ;
         true
     ),
@@ -1024,14 +1052,16 @@
 
 :- func convert_external_port_type(external_trace_port) = trace_port.
 
-convert_external_port_type(external_port_call) = call.
-convert_external_port_type(external_port_exit) = exit.
-convert_external_port_type(external_port_fail) = fail.
+convert_external_port_type(external_port_call) = port_call.
+convert_external_port_type(external_port_exit) = port_exit.
+convert_external_port_type(external_port_fail) = port_fail.
 
 :- func convert_nondet_pragma_port_type(nondet_pragma_trace_port) = trace_port.
 
-convert_nondet_pragma_port_type(nondet_pragma_first) = nondet_pragma_first.
-convert_nondet_pragma_port_type(nondet_pragma_later) = nondet_pragma_later.
+convert_nondet_pragma_port_type(nondet_pragma_first) =
+    port_nondet_pragma_first.
+convert_nondet_pragma_port_type(nondet_pragma_later) =
+    port_nondet_pragma_later. 
 
 %-----------------------------------------------------------------------------%
 
@@ -1065,8 +1095,8 @@
     ( CodeModel = model_non ->
         RedoLayoutSlot = framevar(4)
     ;
-        unexpected(this_file, "attempt to access redo layout slot " ++
-            "for det or semi procedure")
+        unexpected(this_file,
+            "attempt to access redo layout slot for det or semi procedure")
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/trace_params.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_params.m,v
retrieving revision 1.35
diff -u -b -r1.35 trace_params.m
--- compiler/trace_params.m	20 Sep 2006 09:42:15 -0000	1.35
+++ compiler/trace_params.m	23 Sep 2006 10:04:56 -0000
@@ -357,40 +357,42 @@
     % The exception port cannot be disabled, because it is never put into
     % compiler-generated code in the first place; such events are created
     % on the fly by library/exception.m.
-% convert_port_name("call") = call.
-convert_port_name("exit") = exit.
-convert_port_name("fail") = fail.
-convert_port_name("redo") = redo.
-% convert_port_name("excp") = exception.
-convert_port_name("exception") = exception.
-convert_port_name("cond") = ite_cond.
-convert_port_name("ite_cond") = ite_cond.
-convert_port_name("then") = ite_then.
-convert_port_name("ite_then") = ite_then.
-convert_port_name("else") = ite_else.
-convert_port_name("ite_else") = ite_else.
-convert_port_name("nege") = neg_enter.
-convert_port_name("neg_enter") = neg_enter.
-convert_port_name("negs") = neg_success.
-convert_port_name("neg_success") = neg_success.
-convert_port_name("negf") = neg_failure.
-convert_port_name("neg_failure") = neg_failure.
-convert_port_name("swtc") = switch.
-convert_port_name("switch") = switch.
-convert_port_name("disj") = disj.
-convert_port_name("frst") = nondet_pragma_first.
-convert_port_name("nondet_pragma_first") = nondet_pragma_first.
-convert_port_name("latr") = nondet_pragma_first.
-convert_port_name("nondet_pragma_later") = nondet_pragma_later.
+% convert_port_name("call") = port_call.
+convert_port_name("exit") = port_exit.
+convert_port_name("fail") = port_fail.
+convert_port_name("redo") = port_redo.
+% convert_port_name("excp") = port_exception.
+convert_port_name("exception") = port_exception.
+convert_port_name("cond") = port_ite_cond.
+convert_port_name("ite_cond") = port_ite_cond.
+convert_port_name("then") = port_ite_then.
+convert_port_name("ite_then") = port_ite_then.
+convert_port_name("else") = port_ite_else.
+convert_port_name("ite_else") = port_ite_else.
+convert_port_name("nege") = port_neg_enter.
+convert_port_name("neg_enter") = port_neg_enter.
+convert_port_name("negs") = port_neg_success.
+convert_port_name("neg_success") = port_neg_success.
+convert_port_name("negf") = port_neg_failure.
+convert_port_name("neg_failure") = port_neg_failure.
+convert_port_name("swtc") = port_switch.
+convert_port_name("switch") = port_switch.
+convert_port_name("disj") = port_disj.
+convert_port_name("frst") = port_nondet_pragma_first.
+convert_port_name("nondet_pragma_first") = port_nondet_pragma_first.
+convert_port_name("latr") = port_nondet_pragma_first.
+convert_port_name("nondet_pragma_later") = port_nondet_pragma_later.
+convert_port_name("slvr") = port_solver.
+convert_port_name("solver") = port_solver.
 
 :- func convert_port_class_name(string) = list(trace_port) is semidet.
 
 convert_port_class_name("interface") =
-    [call, exit, redo, fail, exception].
+    [port_call, port_exit, port_redo, port_fail, port_exception].
 convert_port_class_name("internal") =
-    [ite_then, ite_else, switch, disj].
+    [port_ite_then, port_ite_else, port_switch, port_disj].
 convert_port_class_name("context") =
-    [ite_cond, neg_enter, neg_success, neg_failure].
+    [port_ite_cond, port_neg_enter, port_neg_success, port_neg_failure].
 
 :- func convert_other_name(string) = trace_suppress_item is semidet.
 
@@ -429,38 +431,49 @@
 %-----------------------------------------------------------------------------%
 
 :- type port_category
-    --->    interface   % The events that describe the interface of a procedure
+    --->    port_cat_interface
+            % The events that describe the interface of a procedure
                         % with its callers.
-    ;       internal    % The events inside each procedure that were present
+
+    ;       port_cat_internal
+            % The events inside each procedure that were present
                         % in the initial procedural debugger.
-    ;       context.    % The events inside each procedure that we added
-                        % because the declarative debugger needs to know when
-                        % (potentially) negated contexts start and end.
+
+    ;       port_cat_context
+            % The events inside each procedure that we added because
+            % the declarative debugger needs to know when (potentially)
+            % negated contexts start and end.
+
+    ;       port_cat_solver.
+            % Solver events.
 
 :- func trace_port_category(trace_port) = port_category.
 
-trace_port_category(call)                   = interface.
-trace_port_category(exit)                   = interface.
-trace_port_category(fail)                   = interface.
-trace_port_category(redo)                   = interface.
-trace_port_category(exception)              = interface.
-trace_port_category(ite_cond)               = context.
-trace_port_category(ite_then)               = internal.
-trace_port_category(ite_else)               = internal.
-trace_port_category(neg_enter)              = context.
-trace_port_category(neg_success)            = context.
-trace_port_category(neg_failure)            = context.
-trace_port_category(switch)                 = internal.
-trace_port_category(disj)                   = internal.
-trace_port_category(nondet_pragma_first)    = internal.
-trace_port_category(nondet_pragma_later)    = internal.
+trace_port_category(port_call)                = port_cat_interface.
+trace_port_category(port_exit)                = port_cat_interface.
+trace_port_category(port_fail)                = port_cat_interface.
+trace_port_category(port_redo)                = port_cat_interface.
+trace_port_category(port_exception)           = port_cat_interface.
+trace_port_category(port_ite_cond)            = port_cat_context.
+trace_port_category(port_ite_then)            = port_cat_internal.
+trace_port_category(port_ite_else)            = port_cat_internal.
+trace_port_category(port_neg_enter)           = port_cat_context.
+trace_port_category(port_neg_success)         = port_cat_context.
+trace_port_category(port_neg_failure)         = port_cat_context.
+trace_port_category(port_switch)              = port_cat_internal.
+trace_port_category(port_disj)                = port_cat_internal.
+trace_port_category(port_nondet_pragma_first) = port_cat_internal.
+trace_port_category(port_nondet_pragma_later) = port_cat_internal.
+trace_port_category(port_solver)              = port_cat_solver.
 
 :- func trace_level_port_categories(trace_level) = list(port_category).
 
 trace_level_port_categories(none) = [].
-trace_level_port_categories(shallow) = [interface].
-trace_level_port_categories(deep) = [interface, internal, context].
-trace_level_port_categories(decl_rep) = [interface, internal, context].
+trace_level_port_categories(shallow) = [port_cat_interface].
+trace_level_port_categories(deep) =
+    [port_cat_interface, port_cat_internal, port_cat_context, port_cat_solver].
+trace_level_port_categories(decl_rep) =
+    [port_cat_interface, port_cat_internal, port_cat_context, port_cat_solver].
 
 :- func trace_level_allows_port_suppression(trace_level) = bool.
 
@@ -500,18 +513,19 @@
 
 :- func port_number(trace_port) = int.
 
-port_number(call) = 1.
-port_number(exit) = 2.
-port_number(redo) = 3.
-port_number(fail) = 4.
-port_number(exception) = 5.
-port_number(ite_cond) = 6.
-port_number(ite_then) = 7.
-port_number(ite_else) = 8.
-port_number(neg_enter) = 9.
-port_number(neg_success) = 10.
-port_number(neg_failure) = 11.
-port_number(disj) = 12.
-port_number(switch) = 13.
-port_number(nondet_pragma_first) = 14.
-port_number(nondet_pragma_later) = 15.
+port_number(port_call) = 1.
+port_number(port_exit) = 2.
+port_number(port_redo) = 3.
+port_number(port_fail) = 4.
+port_number(port_exception) = 5.
+port_number(port_ite_cond) = 6.
+port_number(port_ite_then) = 7.
+port_number(port_ite_else) = 8.
+port_number(port_neg_enter) = 9.
+port_number(port_neg_success) = 10.
+port_number(port_neg_failure) = 11.
+port_number(port_disj) = 12.
+port_number(port_switch) = 13.
+port_number(port_nondet_pragma_first) = 14.
+port_number(port_nondet_pragma_later) = 15.
+port_number(port_solver) = 16.
Index: compiler/tupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tupling.m,v
retrieving revision 1.30
diff -u -b -r1.30 tupling.m
--- compiler/tupling.m	22 Sep 2006 03:50:45 -0000	1.30
+++ compiler/tupling.m	23 Sep 2006 10:05:13 -0000
@@ -1872,7 +1872,7 @@
 :- pred get_proc_calls(proc_trace_counts::in, int::out) is det.
 
 get_proc_calls(ProcCounts, Count) :-
-    map.lookup(ProcCounts, port_only(call), ContextCount),
+    map.lookup(ProcCounts, port_only(port_call), ContextCount),
     Count = ContextCount ^ exec_count.
 
 :- pred get_path_only_count(proc_trace_counts::in, mdbcomp_goal_path::in,
Index: compiler/var_locn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.43
diff -u -b -r1.43 var_locn.m
--- compiler/var_locn.m	22 Aug 2006 05:04:14 -0000	1.43
+++ compiler/var_locn.m	23 Sep 2006 07:03:51 -0000
@@ -111,7 +111,7 @@
 :- pred check_and_set_magic_var_location(prog_var::in, lval::in,
     var_locn_info::in, var_locn_info::out) is det.
 
-    % lval_in_use(VarLocnInfo, Lval)
+    % lval_in_use(VarLocnInfo, Lval):
     %
     % Succeeds iff Lval, which should be a register or stack slot,
     % holds (a path to) a variable or is otherwise reserved.
@@ -1884,7 +1884,7 @@
 cell_is_constant(VarStateMap, ExprnOpts, [yes(Rval0) | MaybeRvals],
         [Rval - LldsType | RvalsTypes]) :-
     expr_is_constant(VarStateMap, ExprnOpts, Rval0, Rval),
-    rval_type_as_arg(Rval, ExprnOpts, LldsType),
+    rval_type_as_arg(Rval, ExprnOpts ^ unboxed_float, LldsType),
     cell_is_constant(VarStateMap, ExprnOpts, MaybeRvals, RvalsTypes).
 
     % expr_is_constant(VarStateMap, ExprnOpts, Rval0, Rval):
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/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_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/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/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/exception.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.111
diff -u -b -r1.111 exception.m
--- library/exception.m	31 Aug 2006 11:09:52 -0000	1.111
+++ library/exception.m	19 Sep 2006 07:27:02 -0000
@@ -1968,7 +1968,7 @@
 MR_proc_static_user_no_site(exception, builtin_throw, 1, 0,
     ""exception.m"", MR_DUMMY_LINE, MR_TRUE);
 MR_STATIC_USER_PROC_STATIC_PROC_LAYOUT(
-        MR_DETISM_DET, 1, MR_LONG_LVAL_STACKVAR(1),
+        MR_DETISM_DET, 1, MR_LONG_LVAL_STACKVAR_INT(1),
         MR_PREDICATE, exception, builtin_throw, 1, 0);
 MR_MAKE_USER_INTERNAL_LAYOUT(exception, builtin_throw, 1, 0, 1);
 
cvs diff: Diffing mdbcomp
Index: mdbcomp/prim_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/prim_data.m,v
retrieving revision 1.12
diff -u -b -r1.12 prim_data.m
--- mdbcomp/prim_data.m	28 Jun 2006 04:46:20 -0000	1.12
+++ mdbcomp/prim_data.m	23 Sep 2006 09:49:46 -0000
@@ -33,21 +33,22 @@
     % in runtime/mercury_trace_base.h, and in the same order, since the
     % code (in browser) assumes the representation is the same.
 :- type trace_port
-    --->    call
-    ;       exit
-    ;       redo
-    ;       fail
-    ;       exception
-    ;       ite_cond
-    ;       ite_then
-    ;       ite_else
-    ;       neg_enter
-    ;       neg_success
-    ;       neg_failure
-    ;       disj
-    ;       switch
-    ;       nondet_pragma_first
-    ;       nondet_pragma_later.
+    --->    port_call
+    ;       port_exit
+    ;       port_redo
+    ;       port_fail
+    ;       port_exception
+    ;       port_ite_cond
+    ;       port_ite_then
+    ;       port_ite_else
+    ;       port_neg_enter
+    ;       port_neg_success
+    ;       port_neg_failure
+    ;       port_disj
+    ;       port_switch
+    ;       port_nondet_pragma_first
+    ;       port_nondet_pragma_later
+    ;       port_solver.
 
 % was in compiler/prog_data.m
 
Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.13
diff -u -b -r1.13 trace_counts.m
--- mdbcomp/trace_counts.m	22 Sep 2006 03:50:45 -0000	1.13
+++ mdbcomp/trace_counts.m	23 Sep 2006 09:52:31 -0000
@@ -730,21 +730,22 @@
         string.to_int(NumTestsStr, NumTests)
     ).
 
-string_to_trace_port("CALL", call).
-string_to_trace_port("EXIT", exit).
-string_to_trace_port("REDO", redo).
-string_to_trace_port("FAIL", fail).
-string_to_trace_port("EXCP", exception).
-string_to_trace_port("COND", ite_cond).
-string_to_trace_port("THEN", ite_then).
-string_to_trace_port("ELSE", ite_else).
-string_to_trace_port("NEGE", neg_enter).
-string_to_trace_port("NEGS", neg_success).
-string_to_trace_port("NEGF", neg_failure).
-string_to_trace_port("DISJ", disj).
-string_to_trace_port("SWTC", switch).
-string_to_trace_port("FRST", nondet_pragma_first).
-string_to_trace_port("LATR", nondet_pragma_later).
+string_to_trace_port("CALL", port_call).
+string_to_trace_port("EXIT", port_exit).
+string_to_trace_port("REDO", port_redo).
+string_to_trace_port("FAIL", port_fail).
+string_to_trace_port("EXCP", port_exception).
+string_to_trace_port("COND", port_ite_cond).
+string_to_trace_port("THEN", port_ite_then).
+string_to_trace_port("ELSE", port_ite_else).
+string_to_trace_port("NEGE", port_neg_enter).
+string_to_trace_port("NEGS", port_neg_success).
+string_to_trace_port("NEGF", port_neg_failure).
+string_to_trace_port("DISJ", port_disj).
+string_to_trace_port("SWTC", port_switch).
+string_to_trace_port("FRST", port_nondet_pragma_first).
+string_to_trace_port("LATR", port_nondet_pragma_later).
+string_to_trace_port("SLVR", port_solver).
 
 :- func string_to_goal_path(string) = goal_path is semidet.
 
@@ -758,21 +759,25 @@
     % This function should be kept in sync with the MR_named_count_port array
     % in runtime/mercury_trace_base.c.
     %
-make_path_port(_GoalPath, call) = port_only(call).
-make_path_port(_GoalPath, exit) = port_only(exit).
-make_path_port(_GoalPath, redo) = port_only(redo).
-make_path_port(_GoalPath, fail) = port_only(fail).
-make_path_port(_GoalPath, exception) = port_only(exception).
-make_path_port(GoalPath, ite_cond) = path_only(GoalPath).
-make_path_port(GoalPath, ite_then) = path_only(GoalPath).
-make_path_port(GoalPath, ite_else) = path_only(GoalPath).
-make_path_port(GoalPath, neg_enter) = port_and_path(neg_enter, GoalPath).
-make_path_port(GoalPath, neg_success) = port_and_path(neg_success, GoalPath).
-make_path_port(GoalPath, neg_failure) = port_and_path(neg_failure, GoalPath).
-make_path_port(GoalPath, disj) = path_only(GoalPath).
-make_path_port(GoalPath, switch) = path_only(GoalPath).
-make_path_port(GoalPath, nondet_pragma_first) = path_only(GoalPath).
-make_path_port(GoalPath, nondet_pragma_later) = path_only(GoalPath).
+make_path_port(_GoalPath, port_call) = port_only(port_call).
+make_path_port(_GoalPath, port_exit) = port_only(port_exit).
+make_path_port(_GoalPath, port_redo) = port_only(port_redo).
+make_path_port(_GoalPath, port_fail) = port_only(port_fail).
+make_path_port(_GoalPath, port_exception) = port_only(port_exception).
+make_path_port(GoalPath, port_ite_cond) = path_only(GoalPath).
+make_path_port(GoalPath, port_ite_then) = path_only(GoalPath).
+make_path_port(GoalPath, port_ite_else) = path_only(GoalPath).
+make_path_port(GoalPath, port_neg_enter) =
+    port_and_path(port_neg_enter, GoalPath).
+make_path_port(GoalPath, port_neg_success) =
+    port_and_path(port_neg_success, GoalPath).
+make_path_port(GoalPath, port_neg_failure) =
+    port_and_path(port_neg_failure, GoalPath).
+make_path_port(GoalPath, port_disj) = path_only(GoalPath).
+make_path_port(GoalPath, port_switch) = path_only(GoalPath).
+make_path_port(GoalPath, port_nondet_pragma_first) = path_only(GoalPath).
+make_path_port(GoalPath, port_nondet_pragma_later) = path_only(GoalPath).
+make_path_port(_GoalPath, port_solver) = port_only(port_call).
 
 %-----------------------------------------------------------------------------%
 
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_deep_profiling_hand.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_profiling_hand.h,v
retrieving revision 1.6
diff -u -b -r1.6 mercury_deep_profiling_hand.h
--- runtime/mercury_deep_profiling_hand.h	19 May 2004 03:59:44 -0000	1.6
+++ runtime/mercury_deep_profiling_hand.h	19 Sep 2006 07:31:17 -0000
@@ -48,9 +48,9 @@
 		NULL,							\
 		MR_maybe_activation_count_field				\
 		NULL,							\
-		MR_LONG_LVAL_TYPE_UNKNOWN,				\
-		MR_LONG_LVAL_TYPE_UNKNOWN,				\
-		MR_LONG_LVAL_TYPE_UNKNOWN				\
+		-1,							\
+		-1,							\
+		-1							\
 	}
 
 #define	MR_proc_static_one_site(global_var_name, call_sites_var_name,	\
@@ -63,9 +63,9 @@
 		call_sites_var_name,					\
 		MR_maybe_activation_count_field				\
 		NULL,							\
-		MR_LONG_LVAL_TYPE_UNKNOWN,				\
-		MR_LONG_LVAL_TYPE_UNKNOWN,				\
-		MR_LONG_LVAL_TYPE_UNKNOWN				\
+		-1,							\
+		-1,							\
+		-1							\
 	}
 
 #define	MR_proc_static_user_no_site(module, name, arity, mode,		\
Index: runtime/mercury_goto.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.45
diff -u -b -r1.45 mercury_goto.h
--- runtime/mercury_goto.h	2 Aug 2006 06:48:55 -0000	1.45
+++ runtime/mercury_goto.h	23 Sep 2006 10:45:57 -0000
@@ -84,6 +84,8 @@
 	MR_PASTE2(mercury_data__proc_layout__,label)
 #define MR_LABEL_LAYOUT_NAME(label)					\
 	MR_PASTE2(mercury_data__label_layout__,label)
+#define MR_SOLVER_LAYOUT_NAME(label)					\
+	MR_PASTE2(mercury_data__solver_layout__,label)
 
 #define MR_PROC_LAYOUT(label)						\
 	((const MR_Proc_Layout *) (MR_Word) &MR_PROC_LAYOUT_NAME(label))
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.63
diff -u -b -r1.63 mercury_grade.h
--- runtime/mercury_grade.h	8 Jun 2006 08:19:59 -0000	1.63
+++ runtime/mercury_grade.h	19 Sep 2006 01:51:21 -0000
@@ -61,7 +61,7 @@
 */
 
 #define MR_GRADE_PART_0	v14_
-#define MR_GRADE_EXEC_TRACE_VERSION_NO	5
+#define MR_GRADE_EXEC_TRACE_VERSION_NO	6
 #define MR_GRADE_DEEP_PROF_VERSION_NO	1
 
 #ifdef MR_HIGHLEVEL_CODE
@@ -365,7 +365,7 @@
   #define MR_GRADE_PART_14		MR_PASTE3(MR_GRADE_PART_13, _decldebug, MR_GRADE_EXEC_TRACE_VERSION_NO)
   #define MR_GRADE_OPT_PART_14		MR_GRADE_OPT_PART_13 ".decldebug"
   #if ! defined(MR_EXEC_TRACE)
-    #error "declarative debugging require execution tracing"
+    #error "declarative debugging requires execution tracing"
   #endif
 #else
   #if defined(MR_EXEC_TRACE)
Index: runtime/mercury_layout_util.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_layout_util.c,v
retrieving revision 1.38
diff -u -b -r1.38 mercury_layout_util.c
--- runtime/mercury_layout_util.c	26 Oct 2005 05:40:10 -0000	1.38
+++ runtime/mercury_layout_util.c	23 Sep 2006 06:01:37 -0000
@@ -98,7 +98,7 @@
         type_params = (MR_TypeInfoParams) MR_NEW_ARRAY(MR_Word, count + 1);
 
         for (i = 0; i < count; i++) {
-            if (tvar_locns->MR_tp_param_locns[i] != 0) {
+            if (tvar_locns->MR_tp_param_locns[i].MR_long_lval != 0) {
                 type_params[i + 1] = (MR_TypeInfo)
                     MR_lookup_long_lval_base(tvar_locns->MR_tp_param_locns[i],
                         saved_regs, base_sp, base_curfr, &succeeded);
@@ -132,7 +132,7 @@
         type_params = (MR_TypeInfoParams) MR_NEW_ARRAY(MR_Word, count + 1);
 
         for (i = 0; i < count; i++) {
-            if (tvar_locns->MR_tp_param_locns[i] != 0) {
+            if (tvar_locns->MR_tp_param_locns[i].MR_long_lval != 0) {
                 type_params[i + 1] = (MR_TypeInfo)
                     MR_lookup_closure_long_lval(
                         tvar_locns->MR_tp_param_locns[i], closure, &succeeded);
@@ -166,7 +166,7 @@
         type_params = (MR_TypeInfoParams) MR_NEW_ARRAY(MR_Word, count + 1);
 
         for (i = 0; i < count; i++) {
-            if (tvar_locns->MR_tp_param_locns[i] != 0)
+            if (tvar_locns->MR_tp_param_locns[i].MR_long_lval != 0)
             {
                 type_params[i + 1] = (MR_TypeInfo)
                     MR_lookup_typeclass_info_long_lval(
@@ -199,7 +199,7 @@
         type_params = (MR_TypeInfoParams) MR_NEW_ARRAY(MR_Word, count + 1);
 
         for (i = 0; i < count; i++) {
-            if (tvar_locns->MR_tp_param_locns[i] != 0) {
+            if (tvar_locns->MR_tp_param_locns[i].MR_long_lval != 0) {
                 type_params[i + 1] = (MR_TypeInfo)
                     MR_lookup_answer_block_long_lval(
                         tvar_locns->MR_tp_param_locns[i], answer_block,
@@ -258,7 +258,8 @@
     int     offset;
     MR_Word value;
     MR_Word baseaddr;
-    MR_Word sublocn;
+    MR_Long_Lval    indirect_lval;
+    MR_Long_Lval    sublocn;
 
     *succeeded = MR_FALSE;
     value = 0;
@@ -324,8 +325,12 @@
             break;
 
         case MR_LONG_LVAL_TYPE_INDIRECT:
-            offset = MR_LONG_LVAL_INDIRECT_OFFSET(locn_num);
-            sublocn = MR_LONG_LVAL_INDIRECT_BASE_LVAL(locn_num);
+            indirect_lval.MR_long_lval = locn_num;
+
+            offset = MR_LONG_LVAL_INDIRECT_OFFSET(indirect_lval);
+            sublocn.MR_long_lval =
+                MR_LONG_LVAL_INDIRECT_BASE_LVAL_INT(indirect_lval);
+
             if (MR_print_locn) {
                 printf("closure offset %d from ", offset);
             }
@@ -338,6 +343,14 @@
             *succeeded = MR_TRUE;
             break;
 
+        case MR_LONG_LVAL_TYPE_CONS_0:
+        case MR_LONG_LVAL_TYPE_CONS_1:
+        case MR_LONG_LVAL_TYPE_CONS_2:
+        case MR_LONG_LVAL_TYPE_CONS_3:
+            value = MR_LONG_LVAL_CONST(locn);
+            *succeeded = MR_TRUE;
+            break;
+
         case MR_LONG_LVAL_TYPE_UNKNOWN:
             if (MR_print_locn) {
                 printf("closure unknown\n");
@@ -362,7 +375,8 @@
     int     offset;
     MR_Word value;
     MR_Word baseaddr;
-    MR_Word sublocn;
+    MR_Long_Lval    indirect_lval;
+    MR_Long_Lval    sublocn;
 
     *succeeded = MR_FALSE;
     value = 0;
@@ -431,8 +445,12 @@
             break;
 
         case MR_LONG_LVAL_TYPE_INDIRECT:
-            offset = MR_LONG_LVAL_INDIRECT_OFFSET(locn_num);
-            sublocn = MR_LONG_LVAL_INDIRECT_BASE_LVAL(locn_num);
+            indirect_lval.MR_long_lval = locn_num;
+
+            offset = MR_LONG_LVAL_INDIRECT_OFFSET(indirect_lval);
+            sublocn.MR_long_lval =
+                MR_LONG_LVAL_INDIRECT_BASE_LVAL_INT(indirect_lval);
+
             if (MR_print_locn) {
                 printf("typeclassinfo offset %d from ", offset);
             }
@@ -445,6 +463,14 @@
             *succeeded = MR_TRUE;
             break;
 
+        case MR_LONG_LVAL_TYPE_CONS_0:
+        case MR_LONG_LVAL_TYPE_CONS_1:
+        case MR_LONG_LVAL_TYPE_CONS_2:
+        case MR_LONG_LVAL_TYPE_CONS_3:
+            value = MR_LONG_LVAL_CONST(locn);
+            *succeeded = MR_TRUE;
+            break;
+
         case MR_LONG_LVAL_TYPE_UNKNOWN:
             if (MR_print_locn) {
                 printf("typeclassinfo unknown\n");
@@ -469,7 +495,8 @@
     int     offset;
     MR_Word value;
     MR_Word baseaddr;
-    MR_Word sublocn;
+    MR_Long_Lval    indirect_lval;
+    MR_Long_Lval    sublocn;
 
     *succeeded = MR_FALSE;
     value = 0;
@@ -535,8 +562,12 @@
             break;
 
         case MR_LONG_LVAL_TYPE_INDIRECT:
-            offset = MR_LONG_LVAL_INDIRECT_OFFSET(locn_num);
-            sublocn = MR_LONG_LVAL_INDIRECT_BASE_LVAL(locn_num);
+            indirect_lval.MR_long_lval = locn_num;
+
+            offset = MR_LONG_LVAL_INDIRECT_OFFSET(indirect_lval);
+            sublocn.MR_long_lval =
+                MR_LONG_LVAL_INDIRECT_BASE_LVAL_INT(indirect_lval);
+
             if (MR_print_locn) {
                 printf("answer_block offset %d from ", offset);
             }
@@ -549,6 +580,14 @@
             *succeeded = MR_TRUE;
             break;
 
+        case MR_LONG_LVAL_TYPE_CONS_0:
+        case MR_LONG_LVAL_TYPE_CONS_1:
+        case MR_LONG_LVAL_TYPE_CONS_2:
+        case MR_LONG_LVAL_TYPE_CONS_3:
+            value = MR_LONG_LVAL_CONST(locn);
+            *succeeded = MR_TRUE;
+            break;
+
         case MR_LONG_LVAL_TYPE_UNKNOWN:
             if (MR_print_locn) {
                 printf("answer_block unknown\n");
@@ -573,7 +612,8 @@
     int     offset;
     MR_Word value;
     MR_Word baseaddr;
-    MR_Word sublocn;
+    MR_Long_Lval    indirect_lval;
+    MR_Long_Lval    sublocn;
 
     *succeeded = MR_FALSE;
     value = 0;
@@ -643,8 +683,12 @@
             break;
 
         case MR_LONG_LVAL_TYPE_INDIRECT:
-            offset = MR_LONG_LVAL_INDIRECT_OFFSET(locn_num);
-            sublocn = MR_LONG_LVAL_INDIRECT_BASE_LVAL(locn_num);
+            indirect_lval.MR_long_lval = locn_num;
+
+            offset = MR_LONG_LVAL_INDIRECT_OFFSET(indirect_lval);
+            sublocn.MR_long_lval =
+                MR_LONG_LVAL_INDIRECT_BASE_LVAL_INT(indirect_lval);
+
             if (MR_print_locn) {
                 printf("long offset %d from ", offset);
             }
@@ -657,6 +701,14 @@
             *succeeded = MR_TRUE;
             break;
 
+        case MR_LONG_LVAL_TYPE_CONS_0:
+        case MR_LONG_LVAL_TYPE_CONS_1:
+        case MR_LONG_LVAL_TYPE_CONS_2:
+        case MR_LONG_LVAL_TYPE_CONS_3:
+            value = MR_LONG_LVAL_CONST(locn);
+            *succeeded = MR_TRUE;
+            break;
+
         case MR_LONG_LVAL_TYPE_UNKNOWN:
             if (MR_print_locn) {
                 printf("long unknown\n");
@@ -781,6 +833,8 @@
 {
     MR_PseudoTypeInfo   pseudo_type_info;
     MR_bool             succeeded;
+    MR_Long_Lval        long_locn;
+    MR_Short_Lval       short_locn;
 
     pseudo_type_info = MR_var_pti(label_layout, i);
     *type_info = MR_create_type_info(type_params, pseudo_type_info);
@@ -790,16 +844,16 @@
             printf("looking up long lval\n");
         }
 
-        *value = MR_lookup_long_lval_base(
-            MR_long_desc_var_locn(label_layout, i),
+        long_locn.MR_long_lval = MR_long_desc_var_locn(label_layout, i);
+        *value = MR_lookup_long_lval_base(long_locn,
             saved_regs, base_sp, base_curfr, &succeeded);
     } else {
         if (MR_print_locn) {
             printf("looking up short lval\n");
         }
 
-        *value = MR_lookup_short_lval_base(
-            MR_short_desc_var_locn(label_layout, i),
+        short_locn = MR_short_desc_var_locn(label_layout, i),
+        *value = MR_lookup_short_lval_base(short_locn,
             saved_regs, base_sp, base_curfr, &succeeded);
     }
 
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.99
diff -u -b -r1.99 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	8 Jun 2006 08:19:59 -0000	1.99
+++ runtime/mercury_stack_layout.h	25 Sep 2006 02:20:35 -0000
@@ -97,18 +97,24 @@
 ** describes the different tag values. The interpretation of the rest of
 ** the word depends on the location type:
 **
-** Locn			Tag	Rest
-** MR_r(Num)		 0	Num (register number)
-** MR_f(Num)		 1	Num (register number)
-** MR_stackvar(Num)	 2	Num (stack slot number)
-** MR_framevar(Num)	 3	Num (stack slot number)
-** MR_succip		 4
-** MR_maxfr		 5
-** MR_curfr		 6
-** MR_hp		 7
-** MR_sp		 8
-** indirect(Base, N)	 9	See below
-** unknown		10	(The location is not known)
+** Locn			Rest
+**
+** MR_r(Num)		Num (register number)
+** MR_f(Num)		Num (register number)
+** MR_stackvar(Num)	Num (stack slot number)
+** MR_framevar(Num)	Num (stack slot number)
+** MR_succip
+** MR_maxfr
+** MR_curfr
+** MR_hp
+** MR_sp
+** constant		See below
+** indirect(Base, N)	See below
+** unknown		(The location is not known)
+**
+** For constants, the rest of the word is a pointer to static data. The
+** pointer has only two low tag bits free, so we reserve every four-bit tag
+** which has 00 as its bottom two bits for representing them.
 **
 ** For indirect references, the word exclusive of the tag consists of
 ** (a) an integer with MR_LONG_LVAL_OFFSETBITS bits giving the index of
@@ -119,53 +125,67 @@
 ** type class info. This MR_Long_Lval value will *not* have an indirect
 ** tag.
 **
-** This data is generated in stack_layout__represent_locn_as_int,
+** This data is generated in stack_layout.represent_locn_as_int,
 ** which must be kept in sync with the constants and macros defined here.
 */
 
-typedef MR_uint_least32_t	MR_Long_Lval;
+struct MR_Long_Lval_Struct {
+	MR_uint_least32_t	MR_long_lval;
+};
 
 typedef enum {
+	MR_LONG_LVAL_TYPE_CONS_0,
 	MR_LONG_LVAL_TYPE_R,
 	MR_LONG_LVAL_TYPE_F,
 	MR_LONG_LVAL_TYPE_STACKVAR,
+	MR_LONG_LVAL_TYPE_CONS_1,
 	MR_LONG_LVAL_TYPE_FRAMEVAR,
 	MR_LONG_LVAL_TYPE_SUCCIP,
 	MR_LONG_LVAL_TYPE_MAXFR,
+	MR_LONG_LVAL_TYPE_CONS_2,
 	MR_LONG_LVAL_TYPE_CURFR,
 	MR_LONG_LVAL_TYPE_HP,
 	MR_LONG_LVAL_TYPE_SP,
+	MR_LONG_LVAL_TYPE_CONS_3,
 	MR_LONG_LVAL_TYPE_INDIRECT,
 	MR_LONG_LVAL_TYPE_UNKNOWN 
 } MR_Long_Lval_Type;
 
-/* This must be in sync with stack_layout__long_lval_tag_bits */
+/* This must be in sync with stack_layout.long_lval_tag_bits */
 #define MR_LONG_LVAL_TAGBITS	4
 
+#define MR_LONG_LVAL_CONST_TAGBITS	2
+
 #define MR_LONG_LVAL_TYPE(Locn) 					\
 	((MR_Long_Lval_Type)						\
-		(((MR_Word) Locn) & ((1 << MR_LONG_LVAL_TAGBITS) - 1)))
+		((Locn).MR_long_lval & ((1 << MR_LONG_LVAL_TAGBITS) - 1)))
 
 #define MR_LONG_LVAL_NUMBER(Locn) 					\
-	((int) ((MR_Word) Locn) >> MR_LONG_LVAL_TAGBITS)
+	((int) (Locn).MR_long_lval >> MR_LONG_LVAL_TAGBITS)
 
-/* This must be in sync with stack_layout__offset_bits */
+#define MR_LONG_LVAL_CONST(Locn)					\
+	(* (MR_Word *) ((Locn).MR_long_lval &				\
+		~ ((1 << MR_LONG_LVAL_CONST_TAGBITS) - 1)))
+
+/* This must be in sync with stack_layout.offset_bits */
 #define MR_LONG_LVAL_OFFSETBITS	6
 
 #define MR_LONG_LVAL_INDIRECT_OFFSET(LocnNumber) 			\
-	((int) ((LocnNumber) & ((1 << MR_LONG_LVAL_OFFSETBITS) - 1)))
+	((int) ((LocnNumber).MR_long_lval &				\
+		((1 << MR_LONG_LVAL_OFFSETBITS) - 1)))
 
-#define MR_LONG_LVAL_INDIRECT_BASE_LVAL(LocnNumber)			\
-	(((MR_Word) (LocnNumber)) >> MR_LONG_LVAL_OFFSETBITS)
+#define MR_LONG_LVAL_INDIRECT_BASE_LVAL_INT(LocnNumber)			\
+	(((MR_uint_least32_t) (LocnNumber).MR_long_lval)		\
+		>> MR_LONG_LVAL_OFFSETBITS)
 
-#define	MR_LONG_LVAL_STACKVAR(n)					\
-	((MR_Word) ((n) << MR_LONG_LVAL_TAGBITS) + MR_LONG_LVAL_TYPE_STACKVAR)
+#define	MR_LONG_LVAL_STACKVAR_INT(n)					\
+	(((n) << MR_LONG_LVAL_TAGBITS) + MR_LONG_LVAL_TYPE_STACKVAR)
 
-#define	MR_LONG_LVAL_FRAMEVAR(n)					\
-	((MR_Word) ((n) << MR_LONG_LVAL_TAGBITS) + MR_LONG_LVAL_TYPE_FRAMEVAR)
+#define	MR_LONG_LVAL_FRAMEVAR_INT(n)					\
+	(((n) << MR_LONG_LVAL_TAGBITS) + MR_LONG_LVAL_TYPE_FRAMEVAR)
 
-#define	MR_LONG_LVAL_R_REG(n)						\
-	((MR_Word) ((n) << MR_LONG_LVAL_TAGBITS) + MR_LONG_LVAL_TYPE_R)
+#define	MR_LONG_LVAL_R_REG_INT(n)					\
+	(((n) << MR_LONG_LVAL_TAGBITS) + MR_LONG_LVAL_TYPE_R)
 
 /*
 ** MR_Short_Lval is a MR_uint_least8_t which describes an location. This
@@ -183,7 +203,7 @@
 ** MR_framevar(Num)	 2	Num (stack slot number)
 ** special reg		 3	MR_Long_Lval_Type
 **
-** This data is generated in stack_layout__represent_locn_as_byte,
+** This data is generated in stack_layout.represent_locn_as_byte,
 ** which must be kept in sync with the constants and macros defined here.
 */
 
@@ -196,7 +216,7 @@
 	MR_SHORT_LVAL_TYPE_SPECIAL
 } MR_Short_Lval_Type;
 
-/* This must be in sync with stack_layout__short_lval_tag_bits */
+/* This must be in sync with stack_layout.short_lval_tag_bits */
 #define MR_SHORT_LVAL_TAGBITS	2
 
 #define MR_SHORT_LVAL_TYPE(Locn) 					\
@@ -220,6 +240,47 @@
 
 /*-------------------------------------------------------------------------*/
 /*
+** Definitions for MR_Solver_Event
+*/
+
+/*
+** This is the initial, temporary definition of the solver event structure.
+**
+** The port is initially represented as a string. Later, once the set of solver
+** event kinds is settled, it will be a value of an enum type representing all
+** those kinds.
+**
+** The num_attributes field gives the number of attributes. Once the runtime
+** system knows the number of attributes of each kind of event, this field may
+** disappear.
+**
+** The next three fields all point to an array whose length is the number of
+** attributes.
+**
+** solver_event->MR_se_attribute_locns[i] gives the location where we can find
+** the value of the (i+1)th attribute (since we start counting attributes at
+** one). This field will stay.
+**
+** solver_event->MR_se_attribute_types[i] is the typeinfo giving the type
+** of the (i+1)th attribute. If we find that all attributes of all events
+** have a fixed type, this field may disappear.
+**
+** solver_event->MR_se_attribute_names[i] gives the name of the (i+1)th
+** attribute. Once attribute names have settled down and the future code in the
+** trace directory that manipulates solver events has learned these names,
+** this field will disappear.
+*/
+
+struct MR_Solver_Event_Struct {
+	const char			*MR_se_port;
+	MR_uint_least16_t		MR_se_num_attributes;
+	MR_Long_Lval			*MR_se_attribute_locns;
+	MR_TypeInfo			*MR_se_attribute_types;
+	const char			**MR_se_attribute_names;
+};
+
+/*-------------------------------------------------------------------------*/
+/*
 ** Definitions for MR_Label_Layout
 */
 
@@ -251,6 +312,10 @@
 ** MR_label_goal_path to convert the value in the MR_sll_goal_path field to a
 ** string.
 **
+** If the label is the label of a solver event, then the MR_sll_solver_event
+** field will point to information about the solver event; otherwise, the field
+** will be NULL.
+**
 ** The remaining fields give information about the values live at the given
 ** label, if this information is available. If it is available, the
 ** MR_has_valid_var_count macro will return true and the last three fields are
@@ -328,7 +393,7 @@
 ** indicated by this index will be incremented (when MR_trace_count_enabled
 ** is set). The array element at index zero is ignored. A label layout will
 ** have zero in its MR_sll_label_num_in_module field if the label doesn't
-** corresponding to an event.
+** correspond to an event.
 **
 ** XXX: Presently, inst information is ignored; we assume that all live values
 ** are ground.
@@ -345,6 +410,7 @@
 	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_Solver_Event		*MR_sll_solver_event;
 	MR_Integer			MR_sll_var_count; /* >= 0 */
 	const void			*MR_sll_locns_types;
 	const MR_uint_least16_t		*MR_sll_var_nums;
@@ -357,6 +423,7 @@
 	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_Solver_Event		*MR_sll_solver_event;
 	MR_Integer			MR_sll_var_count; /* < 0 */
 } MR_Label_Layout_No_Var_Info;
 
@@ -416,6 +483,7 @@
 	MR_label_layout_user_name(module, name, arity, mode, label) = {	\
 		(MR_Proc_Layout *) &					\
 			MR_proc_layout_user_name(module, name, arity, mode), \
+		0,							\
 		-1,							\
 		MR_FALSE,						\
 		0,							\
@@ -429,60 +497,111 @@
 ** the others are the fields of MR_Label_Layouts.
 */
 
-#define	MR_DEF_LL_GEN(e, ln, port, h, num, path, vc, lt, vn, tv)	\
+#define	MR_DEF_LL_GEN(e, ln, port, h, num, path, s, vc, lt, vn, tv)	\
 	static const MR_Label_Layout 					\
 		MR_LABEL_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)) \
 	= {								\
 		MR_PROC_LAYOUT(MR_add_prefix(e)),			\
 		MR_PASTE2(MR_PORT_, port),				\
-		(h), (num), (path), (vc),				\
+		(h), (num), (path), (s), (vc),				\
 		((const void *) lt),					\
 		((const MR_uint_least16_t *) vn),			\
 		((const MR_Type_Param_Locns *) tv)			\
 	}
 
-#define	MR_DEF_LLNVI_GEN(e, ln, port, h, num, path)			\
+#define	MR_DEF_LLNVI_GEN(e, ln, port, s, h, num, path)			\
 	static const MR_Label_Layout_No_Var_Info			\
 		MR_LABEL_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)) \
 	= {								\
 		MR_PROC_LAYOUT(MR_add_prefix(e)),			\
 		MR_PASTE2(MR_PORT_, port),				\
-		(h), (path), (num), -1					\
+		(h), (path), (s), (num), -1				\
 	}
 
+
 #define	MR_DEF_LL(e, ln, port, num, path, vc, lt, vn, tv)		\
-	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path, vc, lt, vn, tv)
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path, NULL, vc, lt, vn, tv)
 
 #define	MR_DEF_LLT(e, ln, port, num, path, vc, lt, vn, tv)		\
-	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path, vc, lt, vn, tv)
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path, NULL, vc, lt, vn, tv)
+
+#define	MR_DEF_LL_S(e, ln, port, num, path, vc, lt, vn, tv)		\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path,			\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		vc, lt, vn, tv)
+
+#define	MR_DEF_LLT_S(e, ln, port, num, path, vc, lt, vn, tv)		\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path,			\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		vc, lt, vn, tv)
 
 #define	MR_DEF_LLXCCC(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc, tvt, tvc)\
-	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path, vc,		\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path, NULL, vc,	\
 		MR_XCOMMON(ltt, ltc),					\
 		MR_XCOMMON(vnt, vnc),					\
 		MR_XCOMMON(tvt, tvc))
 
 #define	MR_DEF_LLXCC0(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc)	\
-	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path, vc,		\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path, NULL, vc,	\
 		MR_XCOMMON(ltt, ltc),					\
 		MR_XCOMMON(vnt, vnc), 0)
 
 #define	MR_DEF_LLTXCCC(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc, tvt,tvc)\
-	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path, vc,		\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path, NULL, vc,	\
 		MR_XCOMMON(ltt, ltc),					\
 		MR_XCOMMON(vnt, vnc),					\
 		MR_XCOMMON(tvt, tvc))
 
 #define	MR_DEF_LLTXCC0(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc)	\
-	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path, vc,		\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path, NULL, vc,	\
+		MR_XCOMMON(ltt, ltc),					\
+		MR_XCOMMON(vnt, vnc), 0)
+
+#define	MR_DEF_LLXCCC_S(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc, tvt, tvc)\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path,			\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		vc,							\
+		MR_XCOMMON(ltt, ltc),					\
+		MR_XCOMMON(vnt, vnc),					\
+		MR_XCOMMON(tvt, tvc))
+
+#define	MR_DEF_LLXCC0_S(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc)	\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, num, path,			\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		vc,							\
+		MR_XCOMMON(ltt, ltc),					\
+		MR_XCOMMON(vnt, vnc), 0)
+
+#define	MR_DEF_LLTXCCC_S(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc, tvt,tvc)\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path,			\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		vc,							\
+		MR_XCOMMON(ltt, ltc),					\
+		MR_XCOMMON(vnt, vnc),					\
+		MR_XCOMMON(tvt, tvc))
+
+#define	MR_DEF_LLTXCC0_S(e, ln, port, num, path, vc, ltt, ltc, vnt, vnc)	\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, num, path,			\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		vc,							\
 		MR_XCOMMON(ltt, ltc),					\
 		MR_XCOMMON(vnt, vnc), 0)
 
 #define	MR_DEF_LLNVI(e, ln, port, num, path)				\
-	MR_DEF_LLNVI_GEN(e, ln, port, MR_FALSE, path)
+	MR_DEF_LLNVI_GEN(e, ln, port, NULL, MR_FALSE, path)
 
 #define	MR_DEF_LLNVIT(e, ln, port, num, path)				\
-	MR_DEF_LLNVI_GEN(e, ln, port, MR_TRUE, path)
+	MR_DEF_LLNVI_GEN(e, ln, port, NULL, MR_TRUE, path)
+
+#define	MR_DEF_LLNVI_S(e, ln, port, num, path)				\
+	MR_DEF_LLNVI_GEN(e, ln, port,					\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		MR_FALSE, path)
+
+#define	MR_DEF_LLNVIT_S(e, ln, port, num, path)				\
+	MR_DEF_LLNVI_GEN(e, ln, port,					\
+		MR_SOLVER_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)), \
+		MR_TRUE, path)
 
 #define MR_DECL_LL(e, ln)						\
 	MR_declare_label(MR_label_name(MR_add_prefix(e), ln));		\
@@ -979,7 +1098,7 @@
 			MR_MAKE_PROC_LAYOUT_ADDR(			\
 				MR_proc_entry_user_name(module, name,	\
 					arity, mode)),			\
-			succip_locn,					\
+			{ succip_locn },				\
 			slots,						\
 			detism						\
 		},							\
@@ -1005,7 +1124,7 @@
 			MR_MAKE_PROC_LAYOUT_ADDR(			\
 				MR_proc_entry_uci_name(module, name,	\
 					type, arity, mode)),		\
-			succip_locn,					\
+			{ succip_locn },				\
 			slots,						\
 			detism						\
 		},							\
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.73
diff -u -b -r1.73 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	19 Sep 2005 08:04:18 -0000	1.73
+++ runtime/mercury_stack_trace.c	19 Sep 2006 02:37:36 -0000
@@ -288,7 +288,7 @@
             entry_layout->MR_sle_stack_slots;
     } else {
         /* succip is always saved in succip_slot */
-        assert(location == -1);
+        assert(location.MR_long_lval == -1);
         /*
         ** Note that curfr always points to an ordinary procedure frame,
         ** never to a temp frame, and this property continues to hold
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.75
diff -u -b -r1.75 mercury_trace_base.c
--- runtime/mercury_trace_base.c	22 Sep 2006 03:50:46 -0000	1.75
+++ runtime/mercury_trace_base.c	23 Sep 2006 09:48:46 -0000
@@ -119,6 +119,7 @@
     "SWTC",
     "FRST",
     "LATR",
+    "SLVR",
     "NONE",
 };
 
@@ -145,6 +146,16 @@
     return (*MR_selected_trace_func_ptr)(layout);
 }
 
+MR_Code *
+MR_solver_trace(const MR_Label_Layout *layout)
+{
+    if (! MR_trace_func_enabled) {
+        return NULL;
+    }
+
+    return (*MR_selected_trace_func_ptr)(layout);
+}
+
 void
 MR_tracing_not_enabled(void)
 {
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.54
diff -u -b -r1.54 mercury_trace_base.h
--- runtime/mercury_trace_base.h	22 Sep 2006 03:50:46 -0000	1.54
+++ runtime/mercury_trace_base.h	23 Sep 2006 10:09:54 -0000
@@ -24,9 +24,9 @@
 
 /*
 ** This enum should EXACTLY match the definition of the `trace_port_type'
-** type in browser/util.m, the definition of the predicate
-** `layout_out__trace_port_to_string' and the function
-** `stack_layout__port_number', and the port names list
+** type in mdbcomp/prim_data.m, the definition of the predicate
+** `layout_out.trace_port_to_string' and the function
+** `stack_layout.port_number', and the port names list
 ** in the C source file of this module (mercury_trace_base.c),
 */
 
@@ -46,6 +46,7 @@
 	MR_PORT_SWITCH,
 	MR_PORT_PRAGMA_FIRST,
 	MR_PORT_PRAGMA_LATER,
+	MR_PORT_SOLVER,
 	MR_PORT_NONE
 } MR_Trace_Port;
 
@@ -101,6 +102,8 @@
 extern	MR_Code	*MR_trace_fake(const MR_Label_Layout *);
 extern	MR_Code	*MR_trace_count(const MR_Label_Layout *);
 
+extern	MR_Code	*MR_solver_trace(const MR_Label_Layout *);
+
 /*
 ** These three variables implement a table of module layout structures,
 ** sorted on module name, maintained by the macros in mercury_array_macros.h.
@@ -575,7 +578,7 @@
 #endif	/* !MR_HIGHLEVEL_CODE */
 
 /*
-** The compiler emits the following macro at each trace event.
+** The compiler emits the following macro at each non-solver trace event.
 */
 
 #define	MR_EVENT(label)							\
@@ -589,6 +592,20 @@
 	}
 
 /*
+** The compiler emits the following macro at each solver trace event.
+*/
+
+#define	MR_SOLVER_EVENT(label)						\
+	{								\
+		MR_Code *MR_jumpaddr;					\
+		MR_save_transient_registers();				\
+		MR_jumpaddr = MR_solver_trace((const MR_Label_Layout *)	\
+			&MR_LABEL_LAYOUT_NAME(MR_add_prefix(label)));	\
+		MR_restore_transient_registers();			\
+		if (MR_jumpaddr != NULL) MR_GOTO(MR_jumpaddr);		\
+	}
+
+/*
 ** When using the heap pointer, we need to restore it, in case it is
 ** transient.
 */
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.44
diff -u -b -r1.44 mercury_types.h
--- runtime/mercury_types.h	8 Jun 2006 08:20:02 -0000	1.44
+++ runtime/mercury_types.h	19 Sep 2006 02:04:20 -0000
@@ -229,9 +229,11 @@
 
 typedef struct MR_CallSiteDynList_Struct        MR_CallSiteDynList;
 
+typedef struct MR_Long_Lval_Struct              MR_Long_Lval;
 typedef struct MR_Proc_Layout_Struct            MR_Proc_Layout;
 typedef struct MR_Module_Layout_Struct          MR_Module_Layout;
 typedef struct MR_Label_Layout_Struct           MR_Label_Layout;
+typedef struct MR_Solver_Event_Struct           MR_Solver_Event;
 
 typedef union MR_TableNode_Union                MR_TableNode;
 typedef MR_TableNode                            *MR_TrieNode;
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
Index: slice/mcov.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/mcov.m,v
retrieving revision 1.1
diff -u -b -r1.1 mcov.m
--- slice/mcov.m	22 Sep 2006 03:50:47 -0000	1.1
+++ slice/mcov.m	23 Sep 2006 10:48:43 -0000
@@ -192,7 +192,7 @@
         !Count) :-
     LineNumberAndCount = line_no_and_count(LineNumber, CurCount, _NumTests),
     !:Count = !.Count + CurCount,
-    ( PathPort = port_only(call) ->
+    ( PathPort = port_only(port_call) ->
         require(unify(!.MaybeCallInfo, no),
             "proc_process_path_port_count: duplicate call port:"),
         !:MaybeCallInfo = yes(LineNumber)
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/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/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.95
diff -u -b -r1.95 mercury_trace.c
--- trace/mercury_trace.c	8 Jun 2006 08:20:16 -0000	1.95
+++ trace/mercury_trace.c	19 Sep 2006 07:35:38 -0000
@@ -753,11 +753,15 @@
             }
 
             if (i < MR_long_desc_var_count(call_label)) {
-                arg_num = MR_get_register_number_long(
-                    MR_long_desc_var_locn(call_label, i));
+                MR_Long_Lval    long_locn;
+
+                long_locn.MR_long_lval = MR_long_desc_var_locn(call_label, i);
+                arg_num = MR_get_register_number_long(long_locn);
             } else {
-                arg_num = MR_get_register_number_short(
-                    MR_short_desc_var_locn(call_label, i));
+                MR_Short_Lval    short_locn;
+
+                short_locn = MR_short_desc_var_locn(call_label, i);
+                arg_num = MR_get_register_number_short(short_locn);
             }
 
             if (arg_num > 0) {
@@ -1294,12 +1298,17 @@
     for (i = 0; i < MR_all_desc_var_count(label_layout); i++) {
         if (var_num == label_layout->MR_sll_var_nums[i]) {
             if (i < MR_long_desc_var_count(label_layout)) {
-                return MR_lookup_long_lval_base(
-                    MR_long_desc_var_locn(label_layout, i),
+                MR_Long_Lval    long_locn;
+
+                long_locn.MR_long_lval =
+                    MR_long_desc_var_locn(label_layout, i);
+                return MR_lookup_long_lval_base(long_locn,
                     saved_regs, base_sp, base_curfr, succeeded);
             } else {
-                return MR_lookup_short_lval_base(
-                    MR_short_desc_var_locn(label_layout, i),
+                MR_Short_Lval    short_locn;
+
+                short_locn = MR_short_desc_var_locn(label_layout, i);
+                return MR_lookup_short_lval_base(short_locn,
                     saved_regs, base_sp, base_curfr, succeeded);
             }
         }
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.101
diff -u -b -r1.101 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	7 Aug 2006 06:21:32 -0000	1.101
+++ trace/mercury_trace_declarative.c	23 Sep 2006 11:03:18 -0000
@@ -690,46 +690,64 @@
         case MR_PORT_CALL:
             trace = MR_trace_decl_call(event_info, trace);
             break;
+
         case MR_PORT_EXIT:
             trace = MR_trace_decl_exit(event_info, trace);
             break;
+
         case MR_PORT_REDO:
             trace = MR_trace_decl_redo(event_info, trace);
             break;
+
         case MR_PORT_FAIL:
             trace = MR_trace_decl_fail(event_info, trace);
             break;
+
         case MR_PORT_DISJ:
             trace = MR_trace_decl_disj(event_info, trace);
             break;
+
         case MR_PORT_SWITCH:
             trace = MR_trace_decl_switch(event_info, trace);
             break;
+
         case MR_PORT_COND:
             trace = MR_trace_decl_cond(event_info, trace);
             break;
+
         case MR_PORT_THEN:
             trace = MR_trace_decl_then(event_info, trace);
             break;
+
         case MR_PORT_ELSE:
             trace = MR_trace_decl_else(event_info, trace);
             break;
+
         case MR_PORT_NEG_ENTER:
             trace = MR_trace_decl_neg_enter(event_info, trace);
             break;
+
         case MR_PORT_NEG_SUCCESS:
             trace = MR_trace_decl_neg_success(event_info, trace);
             break;
+
         case MR_PORT_NEG_FAILURE:
             trace = MR_trace_decl_neg_failure(event_info, trace);
             break;
+
         case MR_PORT_PRAGMA_FIRST:
         case MR_PORT_PRAGMA_LATER:
             MR_fatal_error("MR_trace_construct_node: "
                 "foreign language code is not handled (yet)");
+
         case MR_PORT_EXCEPTION:
             trace = MR_trace_decl_excp(event_info, trace);
             break;
+
+        case MR_PORT_SOLVER:
+            /* do nothing */
+            break;
+
         default:
             MR_fatal_error("MR_trace_construct_node: unknown port");
     }
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post 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