[m-dev.] for review: one-arg MR_trace
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Dec 8 16:04:57 AEDT 1999
For Tyson to review.
WARNING: this change affects binary compatibility for debuggable code;
the debuggable modules of the program and the runtime linked into the
executable must either all come from before this change, or they must all
come from after this change. However, this change does *not* affect binary
compatibility for non-debuggable executables.
Reduce the number of arguments of MR_trace() to one. Two of the arguments,
the port and the goal path, move into the label layout structure, as 16-bit
numbers; the port as a simple enumeration type, and the goal path as an
index into the module-wide string table. (The latter will eventually allow the
debugger to support the placement of breakpoints on labels with specific goal
paths.) The third argument, the number of the highest-numbered rN register in
use at the label, has been moved into the proc layout structure. In theory,
this will require more register saves and restores, since the number in the
proc layout is conservative (it is the max of the numbers that would be
required at the individual labels). However, this is not important, for two
reasons. First, we always save and restore all the rM registers that
appear in the mrM array before the last special-purpose register, and in
most cases this dictates how many registers we save/restore. Second, we
save/restore registers only when the debugger starts interaction, so
save/restore is a time critical activity only for the external debugger.
This change reduces the execution time of debuggable executables by about
4-5% when executing outside mdb and 3-4% when executing under mdb. It also
reduces executable sizes, but only by about 0.7% on x86.
This change eliminates the --trace-just-in-case compiler option, since
we now have the best of both --trace-just-in-case and --no-trace-just-in-case.
The drawback of this scheme is slightly increased executable size with the
accurage garbage collector, but that seems a small enough price to pay.
compiler/code_gen.m:
compiler/code_info.m:
Record the number of the highest numbered rN register live at a trace
label.
compiler/continuation_info.m:
Record the number of the highest numbered rN register live at a trace
label, and the port and goal path associated with the labels of trace
events.
compiler/stack_layout.m:
Put the number of the highest numbered rN register live at a trace
label into proc layouts, and the port and goal path into label layouts.
Since we are breaking binary compatibility with old debuggable modules
anyway, compress the procedure id parts of proc layouts by using
only 16 bits to store the procedure's arity and mode number, instead
of 32 or 64.
compiler/trace.m:
Update the handling of ports, goal paths and max live register numbers,
so that instead of being passed as MR_trace arguments, they are
recorded in data structures.
Generate separate labels and layouts for the fail and redo events.
Although they still have the same layout information, they now record
different ports.
compiler/llds.m:
Since trace.m now generates a label layout structure for the redo
event, we must include redo events in the llds goal path type.
compiler/hlds_goal.m:
Since the code for handling the port type for nondet pragma events
has moved from the nondet-pragma-specific to the generic part of
trace.m, we must now include their event types in the hlds goal path
type.
compiler/llds_out.m:
Add a predicate for converting ports into numbers, now that we
must store ports in static data. Using their symbolic names would
be better, but that would require complications in the llds type
system, which would be inadvisable just before the release.
compiler/options.m:
compiler/handle_options.m:
Eliminate --trace-just-in-case.
compiler/llds.m:
compiler/llds_common.m:
compiler/llds_out.m:
Eliminate the data structure needed by --trace-just-in-case.
compiler/optimize.m:
Trivial update to conform to data structure changes.
library/exception.m:
Update the call to MR_trace.
runtime/mercury_stack_layout.h:
Update the C structure declarations for the layout structures
as discussed above.
runtime/mercury_init.h:
Update the declarations of MR_trace_real and MR_trace_fake
to use only one argument.
runtime/mercury_wrapper.[ch]:
Update the declaration of MR_trace_func to use only one argument.
runtime/mercury_trace_base.[ch]:
Update the declarations of MR_trace, MR_trace_real and MR_trace_fake
to use only one argument.
Delete MR_trace_struct(); since we deleted --trace-just-in-case, there
will not be calls to it anymore.
Since we are breaking binary compatibility anyway, move the exception
port to be with the other interface ports. This should speed up a
frequently executed test in the debugger.
Update the handling of redo events.
trace/mercury_trace.h:
Simplify and speed up the macro that tests a port for being an
interface port, now that exceptions are grouped with other interface
events.
trace/mercury_trace.c:
Update the definition of MR_trace_real to use only one argument.
The port is pulled out of the label layout structure only when
needed to perform the termination tests for the current debugger
command, and the goal path and the max live register number are
looked up only when the termination test succeeds.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.70
diff -u -b -r1.70 code_gen.m
--- compiler/code_gen.m 1999/11/15 00:42:10 1.70
+++ compiler/code_gen.m 1999/11/29 18:37:30
@@ -216,6 +216,7 @@
generate_category_code(CodeModel, Goal, OutsideResumePoint,
TraceSlotInfo, CodeTree, MaybeTraceCallLabel, FrameInfo,
CodeInfo0, CodeInfo),
+ code_info__get_max_reg_in_use_at_trace(MaxTraceReg, CodeInfo, _),
code_info__get_cell_count(CellCount, CodeInfo, _),
% Turn the code tree into a list.
@@ -243,7 +244,7 @@
code_util__make_local_entry_label(ModuleInfo, PredId, ProcId,
no, EntryLabel),
ProcLayout = proc_layout_info(EntryLabel, Detism, TotalSlots,
- MaybeSuccipSlot, MaybeTraceCallLabel,
+ MaybeSuccipSlot, MaybeTraceCallLabel, MaxTraceReg,
TraceSlotInfo, ForceProcId, InternalMap),
global_data_add_new_proc_layout(GlobalData0,
proc(PredId, ProcId), ProcLayout, GlobalData1)
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.245
diff -u -b -r1.245 code_info.m
--- compiler/code_info.m 1999/11/17 01:35:26 1.245
+++ compiler/code_info.m 1999/11/29 19:00:33
@@ -143,6 +143,12 @@
code_info, code_info).
:- mode code_info__get_non_common_static_data(out, in, out) is det.
+:- pred code_info__get_max_reg_in_use_at_trace(int, code_info, code_info).
+:- mode code_info__get_max_reg_in_use_at_trace(out, in, out) is det.
+
+:- pred code_info__set_max_reg_in_use_at_trace(int, code_info, code_info).
+:- mode code_info__set_max_reg_in_use_at_trace(in, in, out) is det.
+
%---------------------------------------------------------------------------%
:- implementation.
@@ -243,7 +249,7 @@
maybe(trace_info),
% Information about which stack slots
% the call sequence number and depth
- % are stored, provided tracing is
+ % are stored in, provided tracing is
% switched on.
% LOCATION DEPENDENT fields
@@ -287,10 +293,19 @@
% which would make it impossible to describe
% to gc what the slot contains after the end
% of the branched control structure.
- list(comp_gen_c_data)
+ list(comp_gen_c_data),
% Static data structures created for this
% procedure which do not need to be scanned
% by llds_common.
+ int % At each call to MR_trace, we compute the
+ % highest rN register number that contains
+ % a useful value. This slot contains the
+ % maximum of these highest values. Therefore
+ % at all calls to MR_trace in the procedure,
+ % we need only save the registers whose numbers
+ % are equal to or smaller than this field.
+ % This slot contains -1 if tracing is not
+ % enabled.
).
%---------------------------------------------------------------------------%
@@ -350,7 +365,8 @@
LayoutMap,
0,
TempContentMap,
- []
+ [],
+ -1
),
code_info__init_maybe_trace_info(Globals, ModuleInfo, ProcInfo,
MaybeFailVars, TraceSlotInfo, CodeInfo0, CodeInfo1),
@@ -378,173 +394,183 @@
code_info__get_globals(SA, CI, CI) :-
CI = code_info(SA, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_module_info(SB, CI, CI) :-
CI = code_info(_, SB, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_pred_id(SC, CI, CI) :-
CI = code_info(_, _, SC, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_proc_id(SD, CI, CI) :-
CI = code_info(_, _, _, SD, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_proc_info(SE, CI, CI) :-
CI = code_info(_, _, _, _, SE, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_varset(SF, CI, CI) :-
CI = code_info(_, _, _, _, _, SF, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_var_slot_count(SG, CI, CI) :-
CI = code_info(_, _, _, _, _, _, SG, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_maybe_trace_info(SH, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, SH,
- _, _, _, _, _, _, _, _, _, _, _, _, _).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_forward_live_vars(LA, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- LA, _, _, _, _, _, _, _, _, _, _, _, _).
+ LA, _, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_instmap(LB, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, LB, _, _, _, _, _, _, _, _, _, _, _).
+ _, LB, _, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_zombies(LC, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, LC, _, _, _, _, _, _, _, _, _, _).
+ _, _, LC, _, _, _, _, _, _, _, _, _, _, _).
code_info__get_exprn_info(LD, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, LD, _, _, _, _, _, _, _, _, _).
+ _, _, _, LD, _, _, _, _, _, _, _, _, _, _).
code_info__get_temps_in_use(LE, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, LE, _, _, _, _, _, _, _, _).
+ _, _, _, _, LE, _, _, _, _, _, _, _, _, _).
code_info__get_fail_info(LF, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, LF, _, _, _, _, _, _, _).
+ _, _, _, _, _, LF, _, _, _, _, _, _, _, _).
code_info__get_label_count(PA, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, PA, _, _, _, _, _, _).
+ _, _, _, _, _, _, PA, _, _, _, _, _, _, _).
code_info__get_cell_count(PB, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, PB, _, _, _, _, _).
+ _, _, _, _, _, _, _, PB, _, _, _, _, _, _).
code_info__get_succip_used(PC, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, PC, _, _, _, _).
+ _, _, _, _, _, _, _, _, PC, _, _, _, _, _).
code_info__get_layout_info(PD, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, PD, _, _, _).
+ _, _, _, _, _, _, _, _, _, PD, _, _, _, _).
code_info__get_max_temp_slot_count(PE, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, PE, _, _).
+ _, _, _, _, _, _, _, _, _, _, PE, _, _, _).
code_info__get_temp_content_map(PF, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, PF, _).
+ _, _, _, _, _, _, _, _, _, _, _, PF, _, _).
code_info__get_non_common_static_data(PG, CI, CI) :-
+ CI = code_info(_, _, _, _, _, _, _, _,
+ _, _, _, _, _, _, _, _, _, _, _, _, PG, _).
+
+code_info__get_max_reg_in_use_at_trace(PH, CI, CI) :-
CI = code_info(_, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, PG).
+ _, _, _, _, _, _, _, _, _, _, _, _, _, PH).
%---------------------------------------------------------------------------%
code_info__set_maybe_trace_info(SH, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, _,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG),
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_forward_live_vars(LA, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- _, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG),
+ _, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_instmap(LB, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, _, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG),
+ LA, _, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_zombies(LC, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, _, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG),
+ LA, LB, _, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_exprn_info(LD, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, _, LE, LF, PA, PB, PC, PD, PE, PF, PG),
+ LA, LB, LC, _, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_temps_in_use(LE, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, _, LF, PA, PB, PC, PD, PE, PF, PG),
+ LA, LB, LC, LD, _, LF, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_fail_info(LF, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, _, PA, PB, PC, PD, PE, PF, PG),
+ LA, LB, LC, LD, LE, _, PA, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_label_count(PA, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, _, PB, PC, PD, PE, PF, PG),
+ LA, LB, LC, LD, LE, LF, _, PB, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_cell_count(PB, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, _, PC, PD, PE, PF, PG),
+ LA, LB, LC, LD, LE, LF, PA, _, PC, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_succip_used(PC, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, _, PD, PE, PF, PG),
+ LA, LB, LC, LD, LE, LF, PA, PB, _, PD, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_layout_info(PD, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, _, PE, PF, PG),
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, _, PE, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_max_temp_slot_count(PE, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, _, PF, PG),
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, _, PF, PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_temp_content_map(PF, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, _ , PG),
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, _ , PG, PH),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__set_non_common_static_data(PG, CI0, CI) :-
+ CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, _ , PH),
+ CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
+
+code_info__set_max_reg_in_use_at_trace(PH, CI0, CI) :-
CI0 = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, _ ),
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, _ ),
CI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
@@ -656,8 +682,9 @@
:- mode code_info__succip_is_used(in, out) is det.
:- pred code_info__add_trace_layout_for_label(label, term__context,
- layout_label_info, code_info, code_info).
-:- mode code_info__add_trace_layout_for_label(in, in, in, in, out) is det.
+ trace_port, goal_path, layout_label_info, code_info, code_info).
+:- mode code_info__add_trace_layout_for_label(in, in, in,in, in, in, out)
+ is det.
:- pred code_info__add_non_common_static_data(comp_gen_c_data,
code_info, code_info).
@@ -835,9 +862,9 @@
code_info__succip_is_used -->
code_info__set_succip_used(yes).
-code_info__add_trace_layout_for_label(Label, Context, LayoutInfo) -->
+code_info__add_trace_layout_for_label(Label, Context, Port, Path, Layout) -->
code_info__get_layout_info(Internals0),
- { Exec = yes(Context - LayoutInfo) },
+ { Exec = yes(trace_port_layout_info(Context, Port, Path, Layout)) },
{ map__search(Internals0, Label, Internal0) ->
Internal0 = internal_layout_info(Exec0, Resume, Return),
( Exec0 = no ->
@@ -937,11 +964,11 @@
code_info__reset_to_position(position_info(PosCI), CurCI, NextCI) :-
% The static fields in PosCI and CurCI should be identical.
PosCI = code_info(_, _, _, _, _, _, _, _,
- LA, LB, LC, LD, LE, LF, _, _, _, _, _, _, _ ),
+ LA, LB, LC, LD, LE, LF, _, _, _, _, _, _, _, _ ),
CurCI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- _, _, _, _, _, _, PA, PB, PC, PD, PE, PF, PG),
+ _, _, _, _, _, _, PA, PB, PC, PD, PE, PF, PG, PH),
NextCI = code_info(SA, SB, SC, SD, SE, SF, SG, SH,
- LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG).
+ LA, LB, LC, LD, LE, LF, PA, PB, PC, PD, PE, PF, PG, PH).
code_info__reset_resume_known(BranchStart) -->
{ BranchStart = position_info(BranchStartCI) },
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.28
diff -u -b -r1.28 continuation_info.m
--- compiler/continuation_info.m 1999/11/15 00:42:17 1.28
+++ compiler/continuation_info.m 1999/11/29 18:59:09
@@ -51,7 +51,7 @@
:- interface.
-:- import_module llds, hlds_module, hlds_pred, prog_data.
+:- import_module llds, hlds_module, hlds_pred, hlds_goal, prog_data.
:- import_module (inst), instmap, trace, globals.
:- import_module bool, std_util, list, assoc_list, set, map.
@@ -70,6 +70,10 @@
% with the call event, whose stack
% layout says which variables were
% live and where on entry.
+ int, % The number of the highest numbered
+ % rN register that can contain useful
+ % information during a call to MR_trace
+ % from within this procedure.
trace_slot_info,% Info about the stack slots used
% for tracing.
bool, % Do we require the procedure id
@@ -164,11 +168,19 @@
%
:- type internal_layout_info
---> internal_layout_info(
- maybe(pair(prog_context, layout_label_info)),
+ maybe(trace_port_layout_info),
maybe(layout_label_info),
maybe(return_layout_info)
).
+:- type trace_port_layout_info
+ ---> trace_port_layout_info(
+ prog_context,
+ trace_port,
+ goal_path,
+ layout_label_info
+ ).
+
:- type return_layout_info
---> return_layout_info(
list(pair(code_addr, prog_context)),
@@ -326,7 +338,7 @@
% Get all the continuation info from the call instructions.
global_data_get_proc_layout(GlobalData0, PredProcId, ProcLayoutInfo0),
- ProcLayoutInfo0 = proc_layout_info(A, B, C, D, E, F, G, Internals0),
+ ProcLayoutInfo0 = proc_layout_info(A, B, C, D, E, F, G, H, Internals0),
GetCallInfo = lambda([Instr::in, Call::out] is semidet, (
Instr = call(Target, label(ReturnLabel), LiveInfo, Context, _)
- _Comment,
@@ -338,7 +350,7 @@
list__foldl(continuation_info__process_continuation(WantReturnInfo),
Calls, Internals0, Internals),
- ProcLayoutInfo = proc_layout_info(A, B, C, D, E, F, G, Internals),
+ ProcLayoutInfo = proc_layout_info(A, B, C, D, E, F, G, H, Internals),
global_data_update_proc_layout(GlobalData0, PredProcId, ProcLayoutInfo,
GlobalData).
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.85
diff -u -b -r1.85 handle_options.m
--- compiler/handle_options.m 1999/11/15 00:57:36 1.85
+++ compiler/handle_options.m 1999/11/30 13:43:05
@@ -274,9 +274,6 @@
% --split-c-files implies --procs-per-c-function 1
option_implies(split_c_files, procs_per_c_function, int(1)),
- % --trace-just-in-case does not work with --split-c-files
- option_implies(split_c_files, trace_just_in_case, bool(no)),
-
% Minimal model tabling is not compatible with trailing;
% see the comment in runtime/mercury_tabling.c.
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.65
diff -u -b -r1.65 hlds_goal.m
--- compiler/hlds_goal.m 1999/11/22 05:49:29 1.65
+++ compiler/hlds_goal.m 1999/11/29 18:51:17
@@ -598,7 +598,9 @@
; ite_then
; ite_else
; neg
- ; exist.
+ ; exist
+ ; first
+ ; later.
:- type goal_path == list(goal_path_step).
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.253
diff -u -b -r1.253 llds.m
--- compiler/llds.m 1999/11/15 00:42:29 1.253
+++ compiler/llds.m 1999/11/30 13:33:21
@@ -150,26 +150,6 @@
% arguments of the create.
list(pred_proc_id) % The procedures referenced.
% Used by dead_proc_elim.
- )
- ; trace_call_info(
- % This structure contains all the information
- % we pass to a particular call to MR_trace_struct.
-
- label, % The label corresponding
- % to this point in the code,
- % whose layout structure
- % describes the current
- % contents of registers and
- % stack slots.
- string, % A representation of the
- % goal_path of the current
- % position in the procedure.
- int, % The number of the highest
- % numbered r register that is
- % in use at the time of the
- % call.
- trace_port % The type of port we are
- % tracing.
).
:- type comp_gen_c_module
@@ -533,15 +513,15 @@
.
% The kinds of ports for which the code we generate will
- % call MR_trace. The redo port is not on this list, because for that
- % port the code that calls MR_trace is not in compiler-generated code,
- % but in the runtime system. Likewise for the exception port.
- % (The same comment applies to the type `external_trace_port'
- % in trace.m.)
+ % call MR_trace. The exception port is not on this list, because for
+ % that port the code that calls MR_trace is not in compiler-generated
+ % code, but in the runtime system. (The same comment applies to the
+ % type `external_trace_port' in trace.m.)
:- type trace_port
---> call
; exit
; fail
+ ; redo
; ite_cond
; ite_then
; ite_else
Index: compiler/llds_common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_common.m,v
retrieving revision 1.25
diff -u -b -r1.25 llds_common.m
--- compiler/llds_common.m 1999/11/15 00:42:31 1.25
+++ compiler/llds_common.m 1999/11/30 13:51:51
@@ -123,10 +123,6 @@
comp_gen_c_data(Name, DataName, Export, Args, ArgTypes, Refs),
Info0, Info) :-
llds_common__process_maybe_rvals(Args0, Args, Info0, Info).
-llds_common__process_data(
- trace_call_info(Label, Path, MaxRegInUse, Port),
- trace_call_info(Label, Path, MaxRegInUse, Port),
- Info, Info).
:- pred llds_common__process_procs(list(c_procedure)::in,
list(c_procedure)::out, common_info::in, common_info::out) is det.
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.131
diff -u -b -r1.131 llds_out.m
--- compiler/llds_out.m 1999/11/15 00:42:33 1.131
+++ compiler/llds_out.m 1999/11/30 13:33:10
@@ -144,6 +144,9 @@
:- pred llds_out__trace_port_to_string(trace_port, string).
:- mode llds_out__trace_port_to_string(in, out) is det.
+:- pred llds_out__trace_port_to_num(trace_port, int).
+:- mode llds_out__trace_port_to_num(in, out) is det.
+
%-----------------------------------------------------------------------------%
:- implementation.
@@ -729,7 +732,6 @@
output_const_term_decl(ArgVals, ArgTypes, DataAddr, ExportedFromFile,
yes, yes, no, "", "", 0, _),
{ decl_set_insert(DeclSet0, DataAddr, DeclSet) }.
-output_c_data_def(trace_call_info(_, _, _, _), DeclSet, DeclSet) --> [].
:- pred output_comp_gen_c_module_list(list(comp_gen_c_module)::in,
set_bbbtree(label)::in, decl_set::in, decl_set::out,
@@ -830,30 +832,10 @@
output_const_term_decl(ArgVals, ArgTypes, DataAddr, ExportedFromFile,
no, yes, yes, "", "", 0, _),
{ decl_set_insert(DeclSet1, DataAddr, DeclSet) }.
-output_comp_gen_c_data(trace_call_info(Label, Path, MaxRegInUse, Port),
- DeclSet0, DeclSet) -->
- io__write_string("static const MR_Trace_Call_Info\nmercury_data__tci__"),
- output_label(Label),
- io__write_string(" = {\n\t(const MR_Stack_Layout_Label *)\n"),
- io__write_string("\t&mercury_data__layout__"),
- output_label(Label),
- io__write_string(",\n\t"""),
- io__write_string(Path),
- io__write_string(""", "),
- io__write_int(MaxRegInUse),
- io__write_string(", "),
- { llds_out__trace_port_to_string(Port, PortStr) },
- io__write_string(PortStr),
- io__write_string(" };\n"),
- % Global data structures that hold trace call info
- % are only ever referred to from calls to MR_trace_struct.
- % We could add a new kind of data_addr that represents these
- % structures so that we could put that data_addr inside DeclSet,
- % but that would require significant extra there for no benefit.
- { DeclSet = DeclSet0 }.
llds_out__trace_port_to_string(call, "MR_PORT_CALL").
llds_out__trace_port_to_string(exit, "MR_PORT_EXIT").
+llds_out__trace_port_to_string(redo, "MR_PORT_REDO").
llds_out__trace_port_to_string(fail, "MR_PORT_FAIL").
llds_out__trace_port_to_string(ite_cond, "MR_PORT_COND").
llds_out__trace_port_to_string(ite_then, "MR_PORT_THEN").
@@ -861,10 +843,25 @@
llds_out__trace_port_to_string(neg_enter, "MR_PORT_NEG_ENTER").
llds_out__trace_port_to_string(neg_success, "MR_PORT_NEG_SUCCESS").
llds_out__trace_port_to_string(neg_failure, "MR_PORT_NEG_FAILURE").
-llds_out__trace_port_to_string(switch, "MR_PORT_SWITCH").
llds_out__trace_port_to_string(disj, "MR_PORT_DISJ").
+llds_out__trace_port_to_string(switch, "MR_PORT_SWITCH").
llds_out__trace_port_to_string(nondet_pragma_first, "MR_PORT_PRAGMA_FIRST").
llds_out__trace_port_to_string(nondet_pragma_later, "MR_PORT_PRAGMA_LATER").
+
+llds_out__trace_port_to_num(call, 0).
+llds_out__trace_port_to_num(exit, 1).
+llds_out__trace_port_to_num(redo, 2).
+llds_out__trace_port_to_num(fail, 3).
+llds_out__trace_port_to_num(ite_cond, 5). % exception is 4
+llds_out__trace_port_to_num(ite_then, 6).
+llds_out__trace_port_to_num(ite_else, 7).
+llds_out__trace_port_to_num(neg_enter, 8).
+llds_out__trace_port_to_num(neg_success, 9).
+llds_out__trace_port_to_num(neg_failure, 10).
+llds_out__trace_port_to_num(disj, 11).
+llds_out__trace_port_to_num(switch, 12).
+llds_out__trace_port_to_num(nondet_pragma_first, 13).
+llds_out__trace_port_to_num(nondet_pragma_later, 14).
:- pred output_user_c_code_list(list(user_c_code)::in,
io__state::di, io__state::uo) is det.
Index: compiler/optimize.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/optimize.m,v
retrieving revision 1.19
diff -u -b -r1.19 optimize.m
--- compiler/optimize.m 1999/11/15 00:42:43 1.19
+++ compiler/optimize.m 1999/11/29 18:37:31
@@ -51,7 +51,8 @@
global_data_maybe_get_proc_layout(GlobalData, PredProcId,
ProcLayout)
->
- ProcLayout = proc_layout_info(_, _, _, _, _, _, _, LabelMap),
+ ProcLayout = proc_layout_info(_, _, _, _, _, _, _, _,
+ LabelMap),
map__sorted_keys(LabelMap, LayoutLabels),
set__sorted_list_to_set(LayoutLabels, LayoutLabelSet)
;
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.274
diff -u -b -r1.274 options.m
--- compiler/options.m 1999/11/15 00:57:38 1.274
+++ compiler/options.m 1999/11/30 13:32:30
@@ -99,7 +99,6 @@
; trace_redo
; trace_optimized
; trace_decl
- ; trace_just_in_case
; stack_trace_higher_order
; generate_bytecode
; generate_prolog
@@ -469,7 +468,6 @@
trace_redo - bool(yes),
trace_optimized - bool(no),
trace_decl - bool(no),
- trace_just_in_case - bool(no),
stack_trace_higher_order - bool(no),
generate_bytecode - bool(no),
generate_prolog - bool(no),
@@ -836,7 +834,6 @@
long_option("trace-optimised", trace_optimized).
long_option("trace-optimized", trace_optimized).
long_option("trace-decl", trace_decl).
-long_option("trace-just-in-case", trace_just_in_case).
long_option("stack-trace-higher-order", stack_trace_higher_order).
long_option("generate-bytecode", generate_bytecode).
long_option("generate-prolog", generate_prolog).
@@ -1592,12 +1589,6 @@
% "--trace-decl",
% "\tMake the generated tracing code include support for an",
% "\texperimental declarative debugger.",
- "--trace-just-in-case",
- "\tGenerate code that supports execution tracing,",
- "\tbut which is optimized to execute outside mdb.",
- "\t(If tracing is enabled, the default is to generate code",
- "\tthat optimizes execution speed inside mdb",
- "\tat the expense of execution speed outside mdb.)",
"--stack-trace-higher-order",
"\tEnable stack traces through predicates and functions with",
"\thigher-order arguments, even if stack tracing is not",
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.39
diff -u -b -r1.39 stack_layout.m
--- compiler/stack_layout.m 1999/11/25 09:09:32 1.39
+++ compiler/stack_layout.m 1999/12/08 04:35:45
@@ -40,12 +40,12 @@
% information on the identity of the procedure. This information will take
% one of two forms. Almost all procedures use the first form:
%
-% predicate/function (Int) actually, MR_pred_func
+% predicate/function (Integer) actually, MR_pred_func
% declaring module name (String)
% defining module name (String)
% predicate name (String)
-% predicate arity (Integer)
-% procedure number (Integer)
+% predicate arity (int_least16_t)
+% procedure number (int_least16_t)
%
% Automatically generated unification, index and comparison predicates
% use the second form:
@@ -54,8 +54,8 @@
% type module's name (String)
% defining module name (String)
% predicate name (String)
-% predicate arity (Integer)
-% procedure number (Integer)
+% predicate arity (int_least16_t)
+% procedure number (int_least16_t)
%
% The runtime system can figure out which form is present by testing
% the value of the first slot. A value of 0 or 1 indicates the first form;
@@ -72,15 +72,18 @@
% layout structure of the call event
% module layout (MR_Module_Layout *) - points to the layout
% struct of the containing module.
+% max reg at trace event (int_least16_t) - the number of the highest
+% numbered rN register live at a trace event
+% inside the procedure
% maybe from full (int_least8_t) - number of the stack slot of
% the from_full flag, if the procedure is
% shallow traced
-% maybe decl debug (int_least8_t) - number of the first of two
-% stack slots used by the declarative debugger,
-% if --trace-decl is set
% maybe trail (int_least8_t) - number of the first of two
% stack slots used for recording the state of
% the trail, if trailing is enabled
+% maybe decl debug (int_least8_t) - number of the first of two
+% stack slots used by the declarative debugger,
+% if --trace-decl is set
%
% The first will point to the per-label layout info for the label associated
% with the call event at the entry to the procedure. The purpose of this
@@ -90,14 +93,14 @@
% (If trace_stack_layout is not set, this field will be present,
% but it will be set to NULL.)
%
-% If the procedure is compiled with deep tracing, the third field will contain
+% If the procedure is compiled with deep tracing, the fourth field will contain
% a negative number. If it is compiled with shallow tracing, it will contain
% the number of the stack slot that holds the flag that says whether this
% incarnation of the procedure was called from deeply traced code or not.
% (The determinism of the procedure decides whether the stack slot refers
% to a stackvar or a framevar.)
%
-% If --trace-decl is not set, the fourth field will contain a negative number.
+% If --trace-decl is not set, the sixth field will contain a negative number.
% If it is set, it will contain the number of the first of two stack slots
% used by the declarative debugger; the other slot is the next higher numbered
% one. (The determinism of the procedure decides whether the stack slot refers
@@ -111,6 +114,11 @@
%
% proc layout (Word *) - pointer to the layout structure of
% the procedure containing this label
+% trace port (int_least16) - a representation of the trace
+% port associated with the label, or -1
+% goal path (int_least16) - an index into the module's
+% string table giving the goal path associated
+% with the trace port of the label, or -1
% # of live data items (Integer) - an encoded representation of
% the number of live data items at the label
% live data types locns (void *) - pointer to an area of memory
@@ -509,11 +517,11 @@
stack_layout__construct_layouts(ProcLayoutInfo) -->
{ ProcLayoutInfo = proc_layout_info(EntryLabel, Detism,
- StackSlots, SuccipLoc, MaybeCallLabel, TraceSlotInfo,
- ForceProcIdLayout, InternalMap) },
+ StackSlots, SuccipLoc, MaybeCallLabel, MaxTraceReg,
+ TraceSlotInfo, ForceProcIdLayout, InternalMap) },
stack_layout__construct_proc_layout(EntryLabel, Detism,
- StackSlots, SuccipLoc, MaybeCallLabel, TraceSlotInfo,
- ForceProcIdLayout),
+ StackSlots, SuccipLoc, MaybeCallLabel, MaxTraceReg,
+ TraceSlotInfo, ForceProcIdLayout),
{ map__to_assoc_list(InternalMap, Internals) },
list__foldl(stack_layout__construct_internal_layout(EntryLabel),
Internals),
@@ -540,7 +548,7 @@
},
stack_layout__update_label_table_2(Label, Context, IsReturn)
;
- { Port = yes(Context - _) },
+ { Port = yes(trace_port_layout_info(Context, _, _, _)) },
{ stack_layout__context_is_valid(Context) }
->
stack_layout__update_label_table_2(Label, Context,
@@ -610,11 +618,12 @@
% Construct a procedure-specific layout.
:- pred stack_layout__construct_proc_layout(label::in, determinism::in,
- int::in, maybe(int)::in, maybe(label)::in, trace_slot_info::in,
- bool::in, stack_layout_info::in, stack_layout_info::out) is det.
+ int::in, maybe(int)::in, maybe(label)::in, int::in,
+ trace_slot_info::in, bool::in,
+ stack_layout_info::in, stack_layout_info::out) is det.
stack_layout__construct_proc_layout(EntryLabel, Detism, StackSlots,
- MaybeSuccipLoc, MaybeCallLabel, TraceSlotInfo,
+ MaybeSuccipLoc, MaybeCallLabel, MaxTraceReg, TraceSlotInfo,
ForceProcIdLayout) -->
{
MaybeSuccipLoc = yes(Location0)
@@ -680,7 +689,7 @@
{ stack_layout__construct_procid_rvals(ProcLabel, IdRvals,
IdArgTypes) },
stack_layout__construct_trace_layout(MaybeCallLabel,
- TraceSlotInfo, TraceRvals, TraceArgTypes),
+ MaxTraceReg, TraceSlotInfo, TraceRvals, TraceArgTypes),
{ list__append(IdRvals, TraceRvals, IdTraceRvals) },
{ IdTraceArgTypes = initial(IdArgTypes, TraceArgTypes) }
;
@@ -702,12 +711,12 @@
Rvals, ArgTypes, []) },
stack_layout__add_proc_layout_data(CData, CDataName, EntryLabel).
-:- pred stack_layout__construct_trace_layout(maybe(label)::in,
+:- pred stack_layout__construct_trace_layout(maybe(label)::in, int::in,
trace_slot_info::in, list(maybe(rval))::out, create_arg_types::out,
stack_layout_info::in, stack_layout_info::out) is det.
-stack_layout__construct_trace_layout(MaybeCallLabel, TraceSlotInfo,
- Rvals, ArgTypes) -->
+stack_layout__construct_trace_layout(MaybeCallLabel, MaxTraceReg,
+ TraceSlotInfo, Rvals, ArgTypes) -->
stack_layout__get_module_name(ModuleName),
stack_layout__get_trace_stack_layout(TraceLayout),
{
@@ -722,6 +731,7 @@
),
ModuleRval = yes(const(data_addr_const(
data_addr(ModuleName, module_layout)))),
+ MaxTraceRegRval = yes(const(int_const(MaxTraceReg))),
TraceSlotInfo = trace_slot_info(MaybeFromFullSlot,
MaybeDeclSlots, MaybeTrailSlot),
( MaybeFromFullSlot = yes(FromFullSlot) ->
@@ -740,8 +750,11 @@
TrailRval = yes(const(int_const(-1)))
),
Rvals = [CallRval, ModuleRval,
- FromFullRval, DeclRval, TrailRval],
- ArgTypes = initial([2 - yes(data_ptr), 3 - yes(int_least8)],
+ MaxTraceRegRval, FromFullRval, TrailRval, DeclRval],
+ ArgTypes = initial([
+ 2 - yes(data_ptr),
+ 1 - yes(int_least16),
+ 3 - yes(int_least8)],
none)
;
% Indicate the absence of the trace layout fields.
@@ -770,7 +783,7 @@
yes(const(int_const(Arity))),
yes(const(int_const(Mode)))
],
- ArgTypes = [6 - no]
+ ArgTypes = [4 - no, 2 - yes(int_least16)]
;
ProcLabel = special_proc(DefModule, PredName, TypeModule,
TypeName, Arity, ProcId),
@@ -785,7 +798,7 @@
yes(const(int_const(Arity))),
yes(const(int_const(Mode)))
],
- ArgTypes = [6 - no]
+ ArgTypes = [4 - no, 2 - yes(int_least16)]
).
:- pred stack_layout__represent_pred_or_func(pred_or_func::in, int::out) is det.
@@ -821,15 +834,25 @@
stack_layout_info::in, stack_layout_info::out) is det.
stack_layout__construct_internal_rvals(Internal, RvalList, ArgTypes) -->
- { Internal = internal_layout_info(Port, Resume, Return) },
- {
- Port = no,
- set__init(PortLiveVarSet),
- map__init(PortTypeVarMap)
- ;
- Port = yes(_ - PortLayout),
- PortLayout = layout_label_info(PortLiveVarSet, PortTypeVarMap)
- },
+ { Internal = internal_layout_info(Trace, Resume, Return) },
+ (
+ { Trace = no },
+ { set__init(TraceLiveVarSet) },
+ { map__init(TraceTypeVarMap) },
+ { TraceRvals = [yes(const(int_const(-1))),
+ yes(const(int_const(-1)))] }
+ ;
+ { Trace = yes(trace_port_layout_info(_, Port, Path,
+ TraceLayout)) },
+ { TraceLayout = layout_label_info(TraceLiveVarSet,
+ TraceTypeVarMap) },
+ { llds_out__trace_port_to_num(Port, PortNum) },
+ { trace__path_to_string(Path, PathStr) },
+ stack_layout__lookup_string_in_table(PathStr, PathNum),
+ { TraceRvals = [yes(const(int_const(PortNum))),
+ yes(const(int_const(PathNum)))] }
+ ),
+ { TraceArgTypes = [2 - yes(int_least16)] },
{
Resume = no,
set__init(ResumeLiveVarSet),
@@ -866,7 +889,7 @@
)
},
(
- { Port = no },
+ { Trace = no },
{ Resume = no },
{ Return = no }
->
@@ -878,14 +901,16 @@
{ ArgTypes = initial([1 - yes(integer)], none) }
;
% XXX ignore differences in insts inside var_infos
- { set__union(PortLiveVarSet, ResumeLiveVarSet, LiveVarSet0) },
+ { set__union(TraceLiveVarSet, ResumeLiveVarSet, LiveVarSet0) },
{ set__union(LiveVarSet0, ReturnLiveVarSet, LiveVarSet) },
- { map__union(set__intersect, PortTypeVarMap, ResumeTypeVarMap,
+ { map__union(set__intersect, TraceTypeVarMap, ResumeTypeVarMap,
TypeVarMap0) },
{ map__union(set__intersect, TypeVarMap0, ReturnTypeVarMap,
TypeVarMap) },
stack_layout__construct_livelval_rvals(LiveVarSet,
- TypeVarMap, RvalList, ArgTypes)
+ TypeVarMap, LivelvalRvalList, LivelvalArgTypes),
+ { append(TraceRvals, LivelvalRvalList, RvalList) },
+ { ArgTypes = initial(TraceArgTypes, LivelvalArgTypes) }
).
%---------------------------------------------------------------------------%
@@ -918,6 +943,7 @@
:- pred stack_layout__construct_tvar_vector(map(tvar, set(layout_locn))::in,
rval::out, int::in, int::out) is det.
+
stack_layout__construct_tvar_vector(TVarLocnMap, TypeParamRval, CNum0, CNum) :-
( map__is_empty(TVarLocnMap) ->
TypeParamRval = const(int_const(0)),
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.27
diff -u -b -r1.27 trace.m
--- compiler/trace.m 1999/11/15 00:57:41 1.27
+++ compiler/trace.m 1999/11/30 13:33:38
@@ -118,7 +118,7 @@
:- pred trace__setup(globals::in, trace_slot_info::out, trace_info::out,
code_info::in, code_info::out) is det.
- % Generate code to fill in the reserevd stack slots.
+ % Generate code to fill in the reserved stack slots.
:- pred trace__generate_slot_fill_code(trace_info::in, code_tree::out,
code_info::in, code_info::out) is det.
@@ -553,45 +553,31 @@
trace__generate_event_code(Port, PortInfo, TraceInfo, Context,
Label, TvarDataMap, Code) -->
- (
- { Port = fail },
- { trace_info_get_maybe_redo_layout_slot(TraceInfo,
- yes(RedoLabel)) }
- ->
- % The layout information for the redo event is the same as
- % for the fail event; all the non-clobbered inputs in their
- % stack slots. It is convenient to generate this common layout
- % when the code generator state is set up for the fail event;
- % generating it for the redo event would be much harder.
- % On the other hand, the address of the layout structure
- % for the redo event should be put into its fixed stack slot
- % at procedure entry. Therefore trace__setup reserves a label
- % whose layout structure serves for both the fail and redo
- % events.
- { Label = RedoLabel }
- ;
- code_info__get_next_label(Label)
- ),
+ code_info__get_next_label(Label),
code_info__get_known_variables(LiveVars0),
(
{ PortInfo = external },
{ LiveVars = LiveVars0 },
- { PathStr = "" }
+ { Path = [] }
;
{ PortInfo = internal(Path, PreDeaths) },
code_info__current_resume_point_vars(ResumeVars),
{ set__difference(PreDeaths, ResumeVars, RealPreDeaths) },
{ set__to_sorted_list(RealPreDeaths, RealPreDeathList) },
- { list__delete_elems(LiveVars0, RealPreDeathList, LiveVars) },
- { trace__path_to_string(Path, PathStr) }
+ { list__delete_elems(LiveVars0, RealPreDeathList, LiveVars) }
;
{ PortInfo = negation_end(Path) },
- { LiveVars = LiveVars0 },
- { trace__path_to_string(Path, PathStr) }
+ { LiveVars = LiveVars0 }
;
{ PortInfo = nondet_pragma },
{ LiveVars = [] },
- { PathStr = "" }
+ { Port = nondet_pragma_first ->
+ Path = [first]
+ ; Port = nondet_pragma_later ->
+ Path = [later]
+ ;
+ error("bad nondet pragma port")
+ }
),
code_info__get_varset(VarSet),
code_info__get_instmap(InstMap),
@@ -599,7 +585,12 @@
trace__produce_vars(LiveVars, VarSet, InstMap, TvarSet0, TvarSet,
VarInfoList, ProduceCode),
code_info__max_reg_in_use(MaxReg),
- code_info__get_globals(Globals),
+ code_info__get_max_reg_in_use_at_trace(MaxTraceReg0),
+ ( { MaxTraceReg0 < MaxReg } ->
+ code_info__set_max_reg_in_use_at_trace(MaxReg)
+ ;
+ []
+ ),
code_info__variable_locations(VarLocs),
code_info__get_proc_info(ProcInfo),
{
@@ -612,34 +603,35 @@
DeclStmt = "\t\tCode *MR_jumpaddr;\n",
SaveStmt = "\t\tsave_transient_registers();\n",
RestoreStmt = "\t\trestore_transient_registers();\n",
- GotoStmt = "\t\tif (MR_jumpaddr != NULL) GOTO(MR_jumpaddr);",
- globals__lookup_bool_option(Globals, trace_just_in_case,
- TraceJustInCase)
+ GotoStmt = "\t\tif (MR_jumpaddr != NULL) GOTO(MR_jumpaddr);"
},
- ( { TraceJustInCase = yes } ->
{ string__append_list([
- "\t\tMR_jumpaddr = MR_trace_struct(\n",
- "\t\t\t&mercury_data__tci__", LabelStr, ");\n"],
- CallStmt) },
- { TraceCallInfo = trace_call_info(Label, PathStr,
- MaxReg, Port) },
- code_info__add_non_common_static_data(TraceCallInfo)
- ;
- {
- Quote = """",
- Comma = ", ",
- llds_out__trace_port_to_string(Port, PortStr),
- string__int_to_string(MaxReg, MaxRegStr),
- string__append_list([
"\t\tMR_jumpaddr = MR_trace(\n",
"\t\t\t(const MR_Stack_Layout_Label *)\n",
- "\t\t\t&mercury_data__layout__", LabelStr, Comma, "\n",
- "\t\t\t", PortStr, Comma, Quote, PathStr, Quote, Comma,
- MaxRegStr, ");\n"],
- CallStmt)
- }
+ "\t\t\t&mercury_data__layout__", LabelStr, ");\n"],
+ CallStmt) },
+ code_info__add_trace_layout_for_label(Label, Context, Port, Path,
+ LayoutLabelInfo),
+ (
+ { Port = fail },
+ { trace_info_get_maybe_redo_layout_slot(TraceInfo,
+ yes(RedoLabel)) }
+ ->
+ % The layout information for the redo event is the same as
+ % for the fail event; all the non-clobbered inputs in their
+ % stack slots. It is convenient to generate this common layout
+ % when the code generator state is set up for the fail event;
+ % generating it for the redo event would be much harder.
+ % On the other hand, the address of the layout structure
+ % for the redo event should be put into its fixed stack slot
+ % at procedure entry. Therefore trace__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,
+ Path, LayoutLabelInfo)
+ ;
+ []
),
- code_info__add_trace_layout_for_label(Label, Context, LayoutLabelInfo),
{
string__append_list([DeclStmt, SaveStmt, CallStmt, RestoreStmt,
GotoStmt], TraceStmt),
@@ -798,6 +790,8 @@
trace__path_step_to_string(ite_else, "e;").
trace__path_step_to_string(neg, "~;").
trace__path_step_to_string(exist, "q;").
+trace__path_step_to_string(first, "f;").
+trace__path_step_to_string(later, "l;").
:- pred trace__convert_external_port_type(external_trace_port::in,
trace_port::out) is det.
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/opium_m
cvs diff: Diffing extras/opium_m/non-regression-tests
cvs diff: Diffing extras/opium_m/scripts
cvs diff: Diffing extras/opium_m/source
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.6
diff -u -b -r1.6 exception.m
--- library/exception.m 1999/10/04 09:04:38 1.6
+++ library/exception.m 1999/11/30 22:04:55
@@ -506,6 +506,7 @@
Code *MR_jumpaddr;
MR_Stack_Walk_Step_Result result;
const char *problem;
+ MR_Stack_Layout_Label exception_layout;
/*
** check if we've reached a frame with an exception handler
@@ -521,8 +522,21 @@
/*
** invoke MR_trace() to trace the exception
*/
- MR_jumpaddr = MR_trace(return_label_layout, MR_PORT_EXCEPTION,
- """", 0);
+ exception_layout.MR_sll_entry =
+ return_label_layout->MR_sll_entry;
+ exception_layout.MR_sll_var_info.MR_slvs_var_count =
+ return_label_layout->MR_sll_var_info.MR_slvs_var_count;
+ exception_layout.MR_sll_var_info.MR_slvs_locns_types =
+ return_label_layout->MR_sll_var_info.
+ MR_slvs_locns_types;
+ exception_layout.MR_sll_var_info.MR_slvs_names =
+ return_label_layout->MR_sll_var_info.MR_slvs_names;
+ exception_layout.MR_sll_var_info.MR_slvs_tvars =
+ return_label_layout->MR_sll_var_info.MR_slvs_tvars;
+ exception_layout.MR_sll_port = MR_PORT_EXCEPTION;
+ exception_layout.MR_sll_goal_path = 0;
+
+ MR_jumpaddr = MR_trace(&exception_layout);
if (MR_jumpaddr != NULL) {
return MR_jumpaddr;
}
cvs diff: Diffing profiler
cvs diff: Diffing runtime
Index: runtime/mercury_init.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.17
diff -u -b -r1.17 mercury_init.h
--- runtime/mercury_init.h 1999/11/30 00:04:45 1.17
+++ runtime/mercury_init.h 1999/12/04 14:17:21
@@ -144,12 +144,10 @@
extern String ML_type_name(Word);
/* in runtime/mercury_trace_base.c */
-extern Code *MR_trace_fake(const MR_Stack_Layout_Label *, MR_Trace_Port,
- const char *, int);
+extern Code *MR_trace_fake(const MR_Stack_Layout_Label *);
/* in trace/mercury_trace.c */
-extern Code *MR_trace_real(const MR_Stack_Layout_Label *, MR_Trace_Port,
- const char *, int);
+extern Code *MR_trace_real(const MR_Stack_Layout_Label *);
/* in trace/mercury_trace_tables.c */
extern void MR_register_module_layout_real(const MR_Module_Layout *);
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.32
diff -u -b -r1.32 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h 1999/11/15 10:17:05 1.32
+++ runtime/mercury_stack_layout.h 1999/12/08 04:35:41
@@ -348,8 +348,8 @@
ConstString MR_user_decl_module;
ConstString MR_user_def_module;
ConstString MR_user_name;
- Integer MR_user_arity;
- Integer MR_user_mode;
+ MR_int_least16_t MR_user_arity;
+ MR_int_least16_t MR_user_mode;
} MR_Stack_Layout_User_Proc;
typedef struct MR_Stack_Layout_Compiler_Proc_Struct {
@@ -357,8 +357,8 @@
ConstString MR_comp_type_module;
ConstString MR_comp_def_module;
ConstString MR_comp_pred_name;
- Integer MR_comp_arity;
- Integer MR_comp_mode;
+ MR_int_least16_t MR_comp_arity;
+ MR_int_least16_t MR_comp_mode;
} MR_Stack_Layout_Compiler_Proc;
typedef union MR_Stack_Layout_Proc_Id_Union {
@@ -381,9 +381,10 @@
*MR_sle_call_label;
struct MR_Module_Layout_Struct
*MR_sle_module_layout;
+ MR_int_least16_t MR_sle_max_r_num;
MR_int_least8_t MR_sle_maybe_from_full;
- MR_int_least8_t MR_sle_maybe_decl_debug;
MR_int_least8_t MR_sle_maybe_trail;
+ MR_int_least8_t MR_sle_maybe_decl_debug;
} MR_Stack_Layout_Entry;
#define MR_sle_user MR_sle_proc_id.MR_proc_user
@@ -510,6 +511,8 @@
typedef struct MR_Stack_Layout_Label_Struct {
MR_Stack_Layout_Entry *MR_sll_entry;
+ MR_int_least16_t MR_sll_port;
+ MR_int_least16_t MR_sll_goal_path;
MR_Stack_Layout_Vars MR_sll_var_info;
} MR_Stack_Layout_Label;
@@ -537,6 +540,8 @@
#define MR_MAKE_INTERNAL_LAYOUT_WITH_ENTRY(label, entry) \
MR_Stack_Layout_Label mercury_data__layout__##label = { \
&mercury_data__layout__##entry, \
+ -1, \
+ -1, \
{ \
-1, /* No info about live values */ \
NULL, \
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.21
diff -u -b -r1.21 mercury_trace_base.c
--- runtime/mercury_trace_base.c 1999/11/05 02:36:23 1.21
+++ runtime/mercury_trace_base.c 1999/11/30 11:47:23
@@ -108,6 +108,7 @@
"EXIT",
"REDO",
"FAIL",
+ "EXCP",
"COND",
"THEN",
"ELSE",
@@ -118,31 +119,16 @@
"SWTC",
"FRST",
"LATR",
- "EXCP",
};
-Code *
-MR_trace_struct(const MR_Trace_Call_Info *trace_call_info)
-{
- if (! MR_trace_enabled) {
- return NULL;
- }
-
- return (*MR_trace_func_ptr)(trace_call_info->MR_trace_sll,
- trace_call_info->MR_trace_port,
- trace_call_info->MR_trace_path,
- trace_call_info->MR_trace_max_r_num);
-}
-
Code *
-MR_trace(const MR_Stack_Layout_Label *layout, MR_Trace_Port port,
- const char *path, int max_r_num)
+MR_trace(const MR_Stack_Layout_Label *layout)
{
if (! MR_trace_enabled) {
return NULL;
}
- return (*MR_trace_func_ptr)(layout, port, path, max_r_num);
+ return (*MR_trace_func_ptr)(layout);
}
void
@@ -161,8 +147,7 @@
}
Code *
-MR_trace_fake(const MR_Stack_Layout_Label *layout, MR_Trace_Port port,
- const char *path, int max_r_num)
+MR_trace_fake(const MR_Stack_Layout_Label *layout)
{
MR_tracing_not_enabled();
/*NOTREACHED*/
@@ -292,22 +277,6 @@
#endif /* MR_TRACE_HISTOGRAM */
-/*
-** This structure is only used by MR_do_trace_redo_fail.
-** Every call to MR_trace_struct from MR_do_trace_redo_fail will set the
-** label layout field to the value it finds in the stack slot reserved
-** for this purpose. The other three fields ("", 0, and MR_PORT_REDO)
-** are the same for all calls to MR_trace_struct from here.
-*/
-
-static MR_Trace_Call_Info MR_retry_trace_call_info =
- {
- NULL,
- "",
- 0,
- MR_PORT_REDO
- };
-
Define_extern_entry(MR_do_trace_redo_fail_shallow);
Define_extern_entry(MR_do_trace_redo_fail_deep);
@@ -324,11 +293,9 @@
if (MR_redo_fromfull_framevar(MR_redofr_slot(MR_curfr)))
{
Code *MR_jumpaddr;
- MR_retry_trace_call_info.MR_trace_sll =
- (const MR_Stack_Layout_Label *)
- MR_redo_layout_framevar(MR_redofr_slot(MR_curfr));
save_transient_registers();
- MR_jumpaddr = MR_trace_struct(&MR_retry_trace_call_info);
+ MR_jumpaddr = MR_trace((const MR_Stack_Layout_Label *)
+ MR_redo_layout_framevar(MR_redofr_slot(MR_curfr)));
restore_transient_registers();
if (MR_jumpaddr != NULL) {
GOTO(MR_jumpaddr);
@@ -348,15 +315,13 @@
#endif
/*
** If this code ever needs changing, you may also need to change
- ** the code in extras/exceptions/exception.m similarly.
+ ** the code in library/exception.m similarly.
*/
{
Code *MR_jumpaddr;
- MR_retry_trace_call_info.MR_trace_sll =
- (const MR_Stack_Layout_Label *)
- MR_redo_layout_framevar(MR_redofr_slot(MR_curfr));
save_transient_registers();
- MR_jumpaddr = MR_trace_struct(&MR_retry_trace_call_info);
+ MR_jumpaddr = MR_trace((const MR_Stack_Layout_Label *)
+ MR_redo_layout_framevar(MR_redofr_slot(MR_curfr)));
restore_transient_registers();
if (MR_jumpaddr != NULL) {
GOTO(MR_jumpaddr);
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_trace_base.h
--- runtime/mercury_trace_base.h 1999/10/15 09:31:46 1.10
+++ runtime/mercury_trace_base.h 1999/12/08 04:20:41
@@ -21,8 +21,9 @@
/*
** This enum should EXACTLY match the definition of the `trace_port_type'
-** type in browser/debugger_interface, and the port names list in the
-** C source file of this module.
+** type in browser/debugger_interface, the definition of the predicates
+** `llds_out__trace_port_to_{int,string}', and port names list in the C source
+** file of this module.
*/
typedef enum {
@@ -30,6 +31,7 @@
MR_PORT_EXIT,
MR_PORT_REDO,
MR_PORT_FAIL,
+ MR_PORT_EXCEPTION,
MR_PORT_COND,
MR_PORT_THEN,
MR_PORT_ELSE,
@@ -39,8 +41,7 @@
MR_PORT_DISJ,
MR_PORT_SWITCH,
MR_PORT_PRAGMA_FIRST,
- MR_PORT_PRAGMA_LATER,
- MR_PORT_EXCEPTION
+ MR_PORT_PRAGMA_LATER
} MR_Trace_Port;
extern const char *MR_port_names[];
@@ -50,24 +51,6 @@
#define MR_trace_reset_depth(d) (MR_trace_call_depth = (Unsigned) (d))
/*
-** This structure holds all the information passed to MR_trace() by the
-** tracing code generated by the compiler. This info is all in one structure
-** to allow calls to MR_trace to simply pass the address of a static data
-** structure. This should be faster than moving several separate arguments
-** into their registers. If tracing is not enabled, the arguments are
-** not looked at anyway. If tracing is enabled, the speed advantage
-** may or may not evaporate, depending on how many of these fields
-** the current trace command looks at.
-*/
-
-typedef struct MR_Trace_Call_Info_Struct {
- const MR_Stack_Layout_Label *MR_trace_sll;
- const char *MR_trace_path;
- int MR_trace_max_r_num;
- MR_Trace_Port MR_trace_port;
-} MR_Trace_Call_Info;
-
-/*
** MR_trace is called from Mercury modules compiled with tracing.
** If the event is supposed to be traced, it performs an indirect call
** through MR_trace_func_ptr, which will point either to MR_trace_real,
@@ -76,17 +59,10 @@
**
** The return value, if not NULL, says where execution should continue
** after the event. (NULL means it should continue as usual.)
-**
-** MR_trace_struct is the same as MR_trace, except it takes its arguments
-** in a structure (which is not modified by MR_trace_struct).
*/
-
-extern Code *MR_trace(const MR_Stack_Layout_Label *, MR_Trace_Port,
- const char *, int);
-extern Code *MR_trace_struct(const MR_Trace_Call_Info *trace_call_info);
-extern Code *MR_trace_fake(const MR_Stack_Layout_Label *, MR_Trace_Port,
- const char *, int);
+extern Code *MR_trace(const MR_Stack_Layout_Label *);
+extern Code *MR_trace_fake(const MR_Stack_Layout_Label *);
/*
** MR_trace_init() is called from mercury_runtime_init()
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.50
diff -u -b -r1.50 mercury_wrapper.c
--- runtime/mercury_wrapper.c 1999/11/30 00:04:49 1.50
+++ runtime/mercury_wrapper.c 1999/12/04 14:17:26
@@ -187,9 +187,7 @@
Code *MR_library_trace_browser;
-Code *(*MR_trace_func_ptr)(const MR_Stack_Layout_Label *, MR_Trace_Port,
- const char *, int);
-
+Code *(*MR_trace_func_ptr)(const MR_Stack_Layout_Label *);
void (*MR_register_module_layout)(const MR_Module_Layout *);
#ifdef USE_GCC_NONLOCAL_GOTOS
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_wrapper.h
--- runtime/mercury_wrapper.h 1999/11/30 00:04:50 1.25
+++ runtime/mercury_wrapper.h 1999/12/04 14:17:27
@@ -93,15 +93,13 @@
extern Code *MR_library_trace_browser;
/*
-** MR_trace_func_ptr is set to either MR_trace_real (trace/mercury_trace.c), or
-** MR_trace_fake (runtime/mercury_trace_base.c),
+** MR_trace_func_ptr is set to either MR_trace_real (trace/mercury_trace.c),
+** or MR_trace_fake (runtime/mercury_trace_base.c),
** depending on whether tracing was enabled when creating the _init.c
** file. It is called from MR_trace (runtime/mercury_trace_base.c).
*/
-extern Code *(*MR_trace_func_ptr)(const MR_Stack_Layout_Label *,
- MR_Trace_Port, const char *, int);
-
+extern Code *(*MR_trace_func_ptr)(const MR_Stack_Layout_Label *);
extern void (*MR_register_module_layout)(const MR_Module_Layout *);
extern void do_init_modules(void);
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 scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.15
diff -u -b -r1.15 mercury_trace.c
--- trace/mercury_trace.c 1999/10/15 08:26:39 1.15
+++ trace/mercury_trace.c 1999/12/08 04:39:17
@@ -56,12 +56,10 @@
TRUE /* must check */
};
-Code *MR_trace_real(const MR_Stack_Layout_Label *layout,
- MR_Trace_Port port, const char *path, int max_r_num);
+Code *MR_trace_real(const MR_Stack_Layout_Label *layout);
static Code *MR_trace_event(MR_Trace_Cmd_Info *cmd, bool interactive,
const MR_Stack_Layout_Label *layout,
- MR_Trace_Port port, Unsigned seqno, Unsigned depth,
- const char *path, int max_r_num);
+ MR_Trace_Port port, Unsigned seqno, Unsigned depth);
static Word MR_trace_find_input_arg(const MR_Stack_Layout_Label *label,
Word *saved_regs, MR_uint_least16_t var_num,
bool *succeeded);
@@ -79,14 +77,14 @@
*/
Code *
-MR_trace_real(const MR_Stack_Layout_Label *layout, MR_Trace_Port port,
- const char *path, int max_r_num)
+MR_trace_real(const MR_Stack_Layout_Label *layout)
{
Integer maybe_from_full;
Unsigned seqno;
Unsigned depth;
MR_Spy_Action action;
bool match;
+ MR_Trace_Port port;
/* in case MR_sp or MR_curfr is transient */
restore_transient_registers();
@@ -132,62 +130,66 @@
switch (MR_trace_ctrl.MR_trace_cmd) {
case MR_CMD_FINISH:
- if (MR_trace_ctrl.MR_trace_stop_depth == depth
- && MR_port_is_final(port))
- {
- return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ if (MR_trace_ctrl.MR_trace_stop_depth != depth) {
+ goto check_stop_print;
} else {
+ port = (MR_Trace_Port) layout->MR_sll_port;
+
+ if (! MR_port_is_final(port)) {
goto check_stop_print;
+ } else {
+ return MR_trace_event(&MR_trace_ctrl,
+ TRUE, layout, port,
+ seqno, depth);
+ }
}
case MR_CMD_GOTO:
if (MR_trace_event_number >=
MR_trace_ctrl.MR_trace_stop_event)
{
+ port = (MR_Trace_Port) layout->MR_sll_port;
return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
} else {
goto check_stop_print;
}
case MR_CMD_RESUME_FORWARD:
+ port = (MR_Trace_Port) layout->MR_sll_port;
if (port != MR_PORT_REDO &&
port != MR_PORT_FAIL &&
port != MR_PORT_EXCEPTION)
{
return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
} else {
goto check_stop_print;
}
case MR_CMD_RETURN:
+ port = (MR_Trace_Port) layout->MR_sll_port;
if (port != MR_PORT_EXIT) {
return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
} else {
goto check_stop_print;
}
case MR_CMD_MIN_DEPTH:
if (MR_trace_ctrl.MR_trace_stop_depth <= depth) {
+ port = (MR_Trace_Port) layout->MR_sll_port;
return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
} else {
goto check_stop_print;
}
case MR_CMD_MAX_DEPTH:
if (MR_trace_ctrl.MR_trace_stop_depth >= depth) {
+ port = (MR_Trace_Port) layout->MR_sll_port;
return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
} else {
goto check_stop_print;
}
@@ -213,28 +215,27 @@
** very frequent case that MR_trace_must_check is false.
*/
+ port = (MR_Trace_Port) layout->MR_sll_port;
match = MR_event_matches_spy_point(layout, port, &action);
if (! match) {
if (MR_trace_ctrl.MR_trace_print_level ==
MR_PRINT_LEVEL_ALL)
{
return MR_trace_event(&MR_trace_ctrl, FALSE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
}
return NULL;
}
- if ((! MR_trace_ctrl.MR_trace_strict)
- && action == MR_SPY_STOP)
+ if ((! MR_trace_ctrl.MR_trace_strict) && action == MR_SPY_STOP)
{
return MR_trace_event(&MR_trace_ctrl, TRUE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
}
- if (MR_trace_ctrl.MR_trace_print_level != MR_PRINT_LEVEL_NONE) {
+ if (MR_trace_ctrl.MR_trace_print_level != MR_PRINT_LEVEL_NONE)
+ {
/*
** It doesn't matter whether action is MR_SPY_STOP or
** MR_SPY_PRINT; even if it is MR_SPY_STOP, we want
@@ -243,8 +244,7 @@
*/
return MR_trace_event(&MR_trace_ctrl, FALSE,
- layout, port, seqno, depth,
- path, max_r_num);
+ layout, port, seqno, depth);
}
}
@@ -254,19 +254,22 @@
static Code *
MR_trace_event(MR_Trace_Cmd_Info *cmd, bool interactive,
const MR_Stack_Layout_Label *layout, MR_Trace_Port port,
- Unsigned seqno, Unsigned depth, const char *path, int max_r_num)
+ Unsigned seqno, Unsigned depth)
{
Code *jumpaddr;
MR_Event_Info event_info;
Word *saved_regs = event_info.MR_saved_regs;
+ int max_r_num;
event_info.MR_event_number = MR_trace_event_number;
event_info.MR_call_seqno = seqno;
event_info.MR_call_depth = depth;
event_info.MR_trace_port = port;
event_info.MR_event_sll = layout;
- event_info.MR_event_path = path;
+ event_info.MR_event_path = layout->MR_sll_entry->MR_sle_module_layout
+ ->MR_ml_string_table + layout->MR_sll_goal_path;
+ max_r_num = layout->MR_sll_entry->MR_sle_max_r_num;
if (max_r_num + MR_NUM_SPECIAL_REG > MR_MAX_SPECIAL_REG_MR) {
event_info.MR_max_mr_num = max_r_num + MR_NUM_SPECIAL_REG;
} else {
Index: trace/mercury_trace.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.h,v
retrieving revision 1.11
diff -u -b -r1.11 mercury_trace.h
--- trace/mercury_trace.h 1999/11/18 07:27:10 1.11
+++ trace/mercury_trace.h 1999/11/30 12:41:04
@@ -121,8 +121,7 @@
(port) == MR_PORT_FAIL || \
(port) == MR_PORT_EXCEPTION)
-#define MR_port_is_interface(port) ((port) <= MR_PORT_FAIL || \
- (port) == MR_PORT_EXCEPTION)
+#define MR_port_is_interface(port) ((port) <= MR_PORT_EXCEPTION)
#define MR_port_is_entry(port) ((port) == MR_PORT_CALL)
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list