[m-dev.] for review: trace levels for declarative debugging
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Sep 27 14:36:55 AEDT 2000
For review by anyone.
Make declarative debugging a trace level, not a separate option.
compiler/globals.m:
Make trace_level an abstract data type. Define and export several
functions that check whether the current trace level requires
particular kinds of treatment.
compiler/options.m:
Remove --trace-decl as an option.
compiler/*.m:
Instead of checking for particular values of the trace level, use
the functions now exported by globals.m.
tests/debugger/declarative/Mmakefile:
Use the trace level to ask for declarative debugging.
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.83
diff -u -r1.83 code_gen.m
--- compiler/code_gen.m 2000/09/25 04:37:07 1.83
+++ compiler/code_gen.m 2000/09/25 08:41:24
@@ -145,7 +145,7 @@
% modules, we must switch off the tracing
% of such preds on a pred-by-pred basis.
globals__get_trace_level(Globals0, TraceLevel),
- globals__set_trace_level(Globals0, none, Globals1),
+ globals__set_trace_level_none(Globals0, Globals1),
module_info_set_globals(ModuleInfo0, Globals1,
ModuleInfo1),
generate_pred_code(ModuleInfo1, ModuleInfo2,
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.254
diff -u -r1.254 code_info.m
--- compiler/code_info.m 2000/09/20 00:21:40 1.254
+++ compiler/code_info.m 2000/09/25 08:55:04
@@ -339,7 +339,7 @@
globals__lookup_bool_option(Globals, lazy_code, LazyCode),
globals__get_options(Globals, Options),
globals__get_trace_level(Globals, TraceLevel),
- ( TraceLevel \= none ->
+ ( trace_level_is_none(TraceLevel) = no ->
trace__fail_vars(ModuleInfo, ProcInfo, FailVars),
MaybeFailVars = yes(FailVars),
set__union(Liveness, FailVars, EffLiveness)
@@ -413,7 +413,7 @@
trace_slot_info::out, code_info::in, code_info::out) is det.
code_info__init_maybe_trace_info(TraceLevel, Globals, TraceSlotInfo) -->
- ( { TraceLevel \= none } ->
+ ( { trace_level_is_none(TraceLevel) = no } ->
trace__setup(Globals, TraceSlotInfo, TraceInfo),
code_info__set_maybe_trace_info(yes(TraceInfo))
;
Index: compiler/globals.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.35
diff -u -r1.35 globals.m
--- compiler/globals.m 2000/09/06 05:20:51 1.35
+++ compiler/globals.m 2000/09/25 08:42:08
@@ -16,8 +16,8 @@
%-----------------------------------------------------------------------------%
:- interface.
-:- import_module bool, getopt, list.
:- import_module options.
+:- import_module bool, getopt, list.
:- type globals.
@@ -49,10 +49,7 @@
; num_data_elems
; size_data_elems.
-:- type trace_level
- ---> none
- ; shallow
- ; deep.
+:- type trace_level.
:- pred convert_target(string::in, compilation_target::out) is semidet.
:- pred convert_gc_method(string::in, gc_method::out) is semidet.
@@ -62,6 +59,17 @@
:- pred convert_trace_level(string::in, bool::in, trace_level::out) is semidet.
% the bool should be the setting of the `require_tracing' option.
+ % These functions check for various properties of the trace level.
+:- func trace_level_is_none(trace_level) = bool.
+:- func trace_level_needs_fixed_slots(trace_level) = bool.
+:- func trace_level_needs_from_full_slot(trace_level) = bool.
+:- func trace_level_needs_decl_debug_slots(trace_level) = bool.
+:- func trace_level_needs_interface_events(trace_level) = bool.
+:- func trace_level_needs_internal_events(trace_level) = bool.
+:- func trace_level_needs_neg_context_events(trace_level) = bool.
+:- func trace_level_needs_all_var_names(trace_level) = bool.
+:- func trace_level_needs_proc_body_reps(trace_level) = bool.
+
%-----------------------------------------------------------------------------%
% Access predicates for the `globals' structure.
@@ -84,6 +92,7 @@
:- pred globals__set_trace_level(globals::in, trace_level::in, globals::out)
is det.
+:- pred globals__set_trace_level_none(globals::in, globals::out) is det.
:- pred globals__lookup_option(globals::in, option::in, option_data::out)
is det.
@@ -219,9 +228,72 @@
convert_trace_level("minimum", yes, shallow).
convert_trace_level("shallow", _, shallow).
convert_trace_level("deep", _, deep).
+convert_trace_level("decl", _, decl).
+convert_trace_level("rep", _, decl_rep).
convert_trace_level("default", no, none).
convert_trace_level("default", yes, deep).
+:- type trace_level
+ ---> none
+ ; shallow
+ ; deep
+ ; decl
+ ; decl_rep.
+
+trace_level_is_none(none) = yes.
+trace_level_is_none(shallow) = no.
+trace_level_is_none(deep) = no.
+trace_level_is_none(decl) = no.
+trace_level_is_none(decl_rep) = no.
+
+trace_level_needs_fixed_slots(none) = no.
+trace_level_needs_fixed_slots(shallow) = yes.
+trace_level_needs_fixed_slots(deep) = yes.
+trace_level_needs_fixed_slots(decl) = yes.
+trace_level_needs_fixed_slots(decl_rep) = yes.
+
+trace_level_needs_from_full_slot(none) = no.
+trace_level_needs_from_full_slot(shallow) = yes.
+trace_level_needs_from_full_slot(deep) = no.
+trace_level_needs_from_full_slot(decl) = no.
+trace_level_needs_from_full_slot(decl_rep) = no.
+
+trace_level_needs_decl_debug_slots(none) = no.
+trace_level_needs_decl_debug_slots(shallow) = no.
+trace_level_needs_decl_debug_slots(deep) = no.
+trace_level_needs_decl_debug_slots(decl) = yes.
+trace_level_needs_decl_debug_slots(decl_rep) = yes.
+
+trace_level_needs_interface_events(none) = no.
+trace_level_needs_interface_events(shallow) = yes.
+trace_level_needs_interface_events(deep) = yes.
+trace_level_needs_interface_events(decl) = yes.
+trace_level_needs_interface_events(decl_rep) = yes.
+
+trace_level_needs_internal_events(none) = no.
+trace_level_needs_internal_events(shallow) = no.
+trace_level_needs_internal_events(deep) = yes.
+trace_level_needs_internal_events(decl) = yes.
+trace_level_needs_internal_events(decl_rep) = yes.
+
+trace_level_needs_neg_context_events(none) = no.
+trace_level_needs_neg_context_events(shallow) = no.
+trace_level_needs_neg_context_events(deep) = no.
+trace_level_needs_neg_context_events(decl) = yes.
+trace_level_needs_neg_context_events(decl_rep) = yes.
+
+trace_level_needs_all_var_names(none) = no.
+trace_level_needs_all_var_names(shallow) = no.
+trace_level_needs_all_var_names(deep) = no.
+trace_level_needs_all_var_names(decl) = yes.
+trace_level_needs_all_var_names(decl_rep) = yes.
+
+trace_level_needs_proc_body_reps(none) = no.
+trace_level_needs_proc_body_reps(shallow) = no.
+trace_level_needs_proc_body_reps(deep) = no.
+trace_level_needs_proc_body_reps(decl) = no.
+trace_level_needs_proc_body_reps(decl_rep) = yes.
+
%-----------------------------------------------------------------------------%
:- type globals
@@ -240,18 +312,19 @@
globals(Options, Target, GC_Method, TagsMethod,
PrologDialect, TerminationNorm, TraceLevel)).
-globals__get_options(Globals, Globals^options).
-globals__get_target(Globals, Globals^target).
-globals__get_gc_method(Globals, Globals^gc_method).
-globals__get_tags_method(Globals, Globals^tags_method).
-globals__get_prolog_dialect(Globals, Globals^prolog_dialect).
-globals__get_termination_norm(Globals, Globals^termination_norm).
-globals__get_trace_level(Globals, Globals^trace_level).
+globals__get_options(Globals, Globals ^ options).
+globals__get_target(Globals, Globals ^ target).
+globals__get_gc_method(Globals, Globals ^ gc_method).
+globals__get_tags_method(Globals, Globals ^ tags_method).
+globals__get_prolog_dialect(Globals, Globals ^ prolog_dialect).
+globals__get_termination_norm(Globals, Globals ^ termination_norm).
+globals__get_trace_level(Globals, Globals ^ trace_level).
-globals__set_options(Globals, Options, Globals^options := Options).
+globals__set_options(Globals, Options, Globals ^ options := Options).
globals__set_trace_level(Globals, TraceLevel,
- Globals^trace_level := TraceLevel).
+ Globals ^ trace_level := TraceLevel).
+globals__set_trace_level_none(Globals, Globals ^ trace_level := none).
globals__lookup_option(Globals, Option, OptionData) :-
globals__get_options(Globals, OptionTable),
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.90
diff -u -r1.90 handle_options.m
--- compiler/handle_options.m 2000/09/06 05:20:52 1.90
+++ compiler/handle_options.m 2000/09/25 08:41:01
@@ -345,7 +345,7 @@
% - enabling stack layouts
% - enabling typeinfo liveness
globals__io_lookup_bool_option(trace_optimized, TraceOptimized),
- ( { TraceLevel \= none } ->
+ ( { trace_level_is_none(TraceLevel) = no } ->
( { TraceOptimized = no } ->
% The following options modify the structure
% of the program, which makes it difficult to
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.52
diff -u -r1.52 jumpopt.m
--- compiler/jumpopt.m 2000/08/11 08:19:06 1.52
+++ compiler/jumpopt.m 2000/09/25 08:54:33
@@ -252,7 +252,7 @@
( CallModel = det ; CallModel = semidet ),
map__search(Procmap, RetLabel, Between0),
PrevInstr = livevals(Livevals),
- TraceLevel = none,
+ trace_level_is_none(TraceLevel) = yes,
not set__member(RetLabel, LayoutLabels)
->
opt_util__filter_out_livevals(Between0, Between1),
@@ -265,7 +265,7 @@
CallModel = semidet,
map__search(Forkmap, RetLabel, Between),
PrevInstr = livevals(Livevals),
- TraceLevel = none,
+ trace_level_is_none(TraceLevel) = yes,
not set__member(RetLabel, LayoutLabels)
->
list__append(Between, [livevals(Livevals) - "",
@@ -279,7 +279,7 @@
map__search(Succmap, RetLabel, BetweenIncl),
BetweenIncl = [livevals(_) - _, goto(_) - _],
PrevInstr = livevals(Livevals),
- TraceLevel = none,
+ trace_level_is_none(TraceLevel) = yes,
not set__member(RetLabel, LayoutLabels)
->
NewInstrs = [
@@ -303,7 +303,7 @@
map__search(Succmap, RetLabel, BetweenIncl),
BetweenIncl = [livevals(_) - _, goto(_) - _],
PrevInstr = livevals(Livevals),
- TraceLevel = none,
+ trace_level_is_none(TraceLevel) = yes,
not set__member(RetLabel, LayoutLabels)
->
counter__allocate(LabelNum, Counter0, Counter1),
@@ -328,7 +328,7 @@
;
% Short circuit the return label if possible.
map__search(Instrmap, RetLabel, RetInstr),
- TraceLevel = none,
+ trace_level_is_none(TraceLevel) = yes,
not set__member(RetLabel, LayoutLabels)
->
jumpopt__final_dest(RetLabel, RetInstr, Instrmap,
Index: compiler/live_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/live_vars.m,v
retrieving revision 1.90
diff -u -r1.90 live_vars.m
--- compiler/live_vars.m 2000/08/15 09:57:48 1.90
+++ compiler/live_vars.m 2000/09/25 08:55:56
@@ -56,7 +56,7 @@
set__init(LiveSets0),
module_info_globals(ModuleInfo, Globals),
globals__get_trace_level(Globals, TraceLevel),
- ( TraceLevel \= none ->
+ ( trace_level_is_none(TraceLevel) = no ->
trace__fail_vars(ModuleInfo, ProcInfo0, ResumeVars0),
set__insert(LiveSets0, ResumeVars0, LiveSets1)
;
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.110
diff -u -r1.110 liveness.m
--- compiler/liveness.m 2000/09/07 01:46:26 1.110
+++ compiler/liveness.m 2000/09/25 08:56:19
@@ -189,7 +189,7 @@
detect_deadness_in_goal(Goal1, Deadness0, LiveInfo, _, Goal2),
globals__get_trace_level(Globals, TraceLevel),
- ( TraceLevel \= none ->
+ ( trace_level_is_none(TraceLevel) = no ->
trace__fail_vars(ModuleInfo, ProcInfo0, ResumeVars0)
;
set__init(ResumeVars0)
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.155
diff -u -r1.155 llds_out.m
--- compiler/llds_out.m 2000/09/18 11:51:25 1.155
+++ compiler/llds_out.m 2000/09/25 08:57:17
@@ -419,7 +419,7 @@
output_c_file_mercury_headers -->
globals__io_get_trace_level(TraceLevel),
- ( { TraceLevel \= none } ->
+ ( { trace_level_is_none(TraceLevel) = no } ->
io__write_string("#include ""mercury_imp.h""\n"),
io__write_string("#include ""mercury_trace_base.h""\n")
;
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.177
diff -u -r1.177 mercury_compile.m
--- compiler/mercury_compile.m 2000/09/21 07:10:30 1.177
+++ compiler/mercury_compile.m 2000/09/25 08:44:34
@@ -1268,7 +1268,7 @@
% of such preds on a pred-by-pred basis.
{ module_info_globals(ModuleInfo0, Globals0) },
{ globals__get_trace_level(Globals0, TraceLevel) },
- { globals__set_trace_level(Globals0, none, Globals1) },
+ { globals__set_trace_level_none(Globals0, Globals1) },
{ module_info_set_globals(ModuleInfo0, Globals1,
ModuleInfo1) },
{ copy(Globals1, Globals1Unique) },
@@ -1358,7 +1358,7 @@
PredId, ProcId, ModuleInfo3),
{ store_alloc_in_proc(ProcInfo5, PredId, ModuleInfo3, ProcInfo6) },
globals__io_get_trace_level(TraceLevel),
- ( { TraceLevel \= none } ->
+ ( { trace_level_is_none(TraceLevel) = no } ->
write_proc_progress_message(
"% Calculating goal paths in ",
PredId, ProcId, ModuleInfo3),
@@ -2085,7 +2085,7 @@
mercury_compile__maybe_goal_paths(HLDS0, Verbose, Stats, HLDS) -->
globals__io_get_trace_level(TraceLevel),
- ( { TraceLevel \= none } ->
+ ( { trace_level_is_none(TraceLevel) = no } ->
maybe_write_string(Verbose, "% Calculating goal paths..."),
maybe_flush_output(Verbose),
process_all_nonimported_procs(
@@ -2776,7 +2776,7 @@
% create the initialization C file
maybe_write_string(Verbose, "% Creating initialization file...\n"),
globals__io_get_trace_level(TraceLevel),
- { TraceLevel \= none ->
+ { trace_level_is_none(TraceLevel) = no ->
TraceOpt = "--trace "
;
TraceOpt = ""
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.133
diff -u -r1.133 modules.m
--- compiler/modules.m 2000/09/20 12:12:07 1.133
+++ compiler/modules.m 2000/09/25 08:56:53
@@ -1426,7 +1426,8 @@
UseDeps = UseDeps1
).
-:- pred contains_tabling_pragma(item_list).
+:- pred contains_tabling_pragma(item_list::in) is semidet.
+
contains_tabling_pragma([Item|Items]) :-
(
Item = pragma(Pragma) - _Context,
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.290
diff -u -r1.290 options.m
--- compiler/options.m 2000/09/17 09:18:59 1.290
+++ compiler/options.m 2000/09/25 07:23:44
@@ -99,7 +99,6 @@
; trace_return
; trace_redo
; trace_optimized
- ; trace_decl
; stack_trace_higher_order
; generate_bytecode
; generate_prolog % Currently not used
@@ -490,7 +489,6 @@
trace_return - bool(yes),
trace_redo - bool(yes),
trace_optimized - bool(no),
- trace_decl - bool(no),
stack_trace_higher_order - bool(no),
generate_bytecode - bool(no),
generate_prolog - bool(no),
@@ -877,7 +875,6 @@
long_option("trace-redo", trace_redo).
long_option("trace-optimised", trace_optimized).
long_option("trace-optimized", trace_optimized).
-long_option("trace-decl", trace_decl).
long_option("stack-trace-higher-order", stack_trace_higher_order).
long_option("generate-bytecode", generate_bytecode).
long_option("generate-prolog", generate_prolog).
@@ -1657,14 +1654,15 @@
"\tWhen generating `.dep' files, generate Makefile",
"\tfragments that use only the features of standard make;",
"\tdo not assume the availability of GNU Make extensions.",
- "--trace {minimum, shallow, deep, default}",
+% "--trace {minimum, shallow, deep, default}",
+ "--trace {minimum, shallow, deep, decl, rep, default}",
"\tGenerate code that includes the specified level",
"\tof execution tracing.",
"\tSee the Debugging chapter of the Mercury User's Guide",
"\tfor details.",
"--no-trace-internal",
"\tDo not generate code for internal events even if the trace",
- "\tlevel is deep.",
+ "\tlevel would normally require it.",
"--no-trace-return",
"\tDo not generate trace information for call return sites.",
"\tPrevents the printing of the values of variables in ancestors",
@@ -1673,10 +1671,6 @@
"\tDo not generate code to trace REDO events.",
"--trace-optimized",
"\tDo not disable optimizations that can change the trace.",
-% --trace-decl is commented out in the absence of runtime support
-% "--trace-decl",
-% "\tMake the generated tracing code include support for an",
-% "\texperimental declarative debugger.",
"--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.51
diff -u -r1.51 stack_layout.m
--- compiler/stack_layout.m 2000/09/25 04:37:13 1.51
+++ compiler/stack_layout.m 2000/09/25 08:37:16
@@ -285,7 +285,7 @@
globals__lookup_bool_option(Globals, trace_stack_layout, TraceLayout),
globals__lookup_bool_option(Globals, procid_stack_layout,
ProcIdLayout),
- globals__lookup_bool_option(Globals, trace_decl, TraceDecl),
+ globals__get_trace_level(Globals, TraceLevel),
globals__have_static_code_addresses(Globals, StaticCodeAddr),
set_bbbtree__init(LayoutLabels0),
@@ -293,7 +293,7 @@
map__init(LabelTables0),
StringTable0 = string_table(StringMap0, [], 0),
LayoutInfo0 = stack_layout_info(ModuleInfo0,
- AgcLayout, TraceLayout, ProcIdLayout, TraceDecl,
+ AgcLayout, TraceLayout, ProcIdLayout, TraceLevel,
StaticCodeAddr, [], [], LayoutLabels0, [],
StringTable0, LabelTables0, map__init),
stack_layout__lookup_string_in_table("", _, LayoutInfo0, LayoutInfo1),
@@ -763,12 +763,13 @@
( { TraceLayout = yes } ->
stack_layout__construct_var_name_vector(VarSet, UsedVarNameMap,
VarNameCount, VarNameVector),
- stack_layout__get_trace_decl(TraceDecl),
+ stack_layout__get_trace_level(TraceLevel),
+ { trace_level_needs_proc_body_reps(TraceLevel) = BodyReps },
(
- { TraceDecl = no },
+ { BodyReps = no },
{ GoalRepRval = yes(const(int_const(0))) }
;
- { TraceDecl = yes },
+ { BodyReps = yes },
stack_layout__get_module_info(ModuleInfo0),
{ prog_rep__represent_goal(Goal, InstMap, ModuleInfo0,
GoalRep) },
@@ -829,14 +830,15 @@
stack_layout__construct_var_name_vector(VarSet, UsedVarNameMap, Count, Vector)
-->
- stack_layout__get_trace_decl(TraceDecl),
+ stack_layout__get_trace_level(TraceLevel),
+ { trace_level_needs_all_var_names(TraceLevel) = NeedsAllNames },
(
- { TraceDecl = yes },
+ { NeedsAllNames = yes },
{ varset__var_name_list(VarSet, VarNameList) },
{ list__map(stack_layout__convert_var_name_to_int,
VarNameList, VarNames) }
;
- { TraceDecl = no },
+ { NeedsAllNames = no },
{ map__to_assoc_list(UsedVarNameMap, VarNames) }
),
(
@@ -1748,7 +1750,7 @@
agc_stack_layout :: bool, % generate agc info?
trace_stack_layout :: bool, % generate tracing info?
procid_stack_layout :: bool, % generate proc id info?
- trace_decl :: bool, % declarative debugging?
+ trace_level :: trace_level,
static_code_addresses :: bool, % have static code addresses?
proc_layouts :: list(comp_gen_c_data),
internal_layouts :: list(comp_gen_c_data),
@@ -1785,7 +1787,7 @@
:- pred stack_layout__get_procid_stack_layout(bool::out,
stack_layout_info::in, stack_layout_info::out) is det.
-:- pred stack_layout__get_trace_decl(bool::out,
+:- pred stack_layout__get_trace_level(trace_level::out,
stack_layout_info::in, stack_layout_info::out) is det.
:- pred stack_layout__get_static_code_addresses(bool::out,
@@ -1813,7 +1815,7 @@
stack_layout__get_agc_stack_layout(LI ^ agc_stack_layout, LI, LI).
stack_layout__get_trace_stack_layout(LI ^ trace_stack_layout, LI, LI).
stack_layout__get_procid_stack_layout(LI ^ procid_stack_layout, LI, LI).
-stack_layout__get_trace_decl(LI ^ trace_decl, LI, LI).
+stack_layout__get_trace_level(LI ^ trace_level, LI, LI).
stack_layout__get_static_code_addresses(LI ^ static_code_addresses, LI, LI).
stack_layout__get_proc_layout_data(LI ^ proc_layouts, LI, LI).
stack_layout__get_internal_layout_data(LI ^ internal_layouts, LI, LI).
Index: compiler/store_alloc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/store_alloc.m,v
retrieving revision 1.72
diff -u -r1.72 store_alloc.m
--- compiler/store_alloc.m 2000/09/04 22:33:51 1.72
+++ compiler/store_alloc.m 2000/09/25 09:36:18
@@ -73,7 +73,7 @@
),
initial_liveness(ProcInfo0, PredId, ModuleInfo, Liveness0),
globals__get_trace_level(Globals, TraceLevel),
- ( TraceLevel \= none ->
+ ( trace_level_is_none(TraceLevel) = no ->
trace__fail_vars(ModuleInfo, ProcInfo0, ResumeVars0)
;
set__init(ResumeVars0)
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.34
diff -u -r1.34 trace.m
--- compiler/trace.m 2000/09/04 22:33:53 1.34
+++ compiler/trace.m 2000/09/25 08:34:57
@@ -186,12 +186,6 @@
)
; nondet_pragma.
-:- type trace_type
- ---> deep_trace
- ; shallow_trace(lval). % This holds the saved value of a bool
- % that is true iff we were called from
- % code with full tracing.
-
trace__fail_vars(ModuleInfo, ProcInfo, FailVars) :-
proc_info_headvars(ProcInfo, HeadVars),
proc_info_argmodes(ProcInfo, Modes),
@@ -263,11 +257,12 @@
trace__reserved_slots(ProcInfo, Globals, ReservedSlots) :-
globals__get_trace_level(Globals, TraceLevel),
+ FixedSlots = trace_level_needs_fixed_slots(TraceLevel),
(
- TraceLevel = none
- ->
+ FixedSlots = no,
ReservedSlots = 0
;
+ FixedSlots = yes,
Fixed = 3, % event#, call#, call depth
(
globals__lookup_bool_option(Globals, trace_redo, yes),
@@ -277,13 +272,12 @@
;
RedoLayout = 0
),
- ( TraceLevel = deep ->
- FromFull = 0
- ;
+ ( trace_level_needs_from_full_slot(TraceLevel) = yes ->
FromFull = 1
+ ;
+ FromFull = 0
),
- globals__lookup_bool_option(Globals, trace_decl, TraceDecl),
- ( TraceDecl = yes ->
+ ( trace_level_needs_decl_debug_slots(TraceLevel) = yes ->
DeclDebug = 2
;
DeclDebug = 0
@@ -300,7 +294,6 @@
trace__setup(Globals, TraceSlotInfo, TraceInfo) -->
code_info__get_proc_model(CodeModel),
- { globals__lookup_bool_option(Globals, trace_decl, TraceDecl) },
{ globals__lookup_bool_option(Globals, trace_redo, TraceRedo) },
(
{ TraceRedo = yes },
@@ -313,29 +306,40 @@
{ MaybeRedoLayout = no },
{ NextSlotAfterRedoLayout = 4 }
),
- { globals__get_trace_level(Globals, deep) ->
- TraceType = deep_trace,
+ { globals__get_trace_level(Globals, TraceLevel) },
+ { trace_level_needs_from_full_slot(TraceLevel) = FromFullSlot },
+ {
+ FromFullSlot = no,
MaybeFromFullSlot = no,
- NextSlotAfterFromFull = NextSlotAfterRedoLayout,
- globals__lookup_bool_option(Globals, trace_internal,
- TraceInternal)
+ MaybeFromFullSlotLval = no,
+ NextSlotAfterFromFull = NextSlotAfterRedoLayout
;
- % Trace level must be shallow.
+ FromFullSlot = yes,
MaybeFromFullSlot = yes(NextSlotAfterRedoLayout),
( CodeModel = model_non ->
CallFromFullSlot = framevar(NextSlotAfterRedoLayout)
;
CallFromFullSlot = stackvar(NextSlotAfterRedoLayout)
),
- TraceType = shallow_trace(CallFromFullSlot),
- NextSlotAfterFromFull is NextSlotAfterRedoLayout + 1,
- % Shallow traced procs never generate internal events.
+ MaybeFromFullSlotLval = yes(CallFromFullSlot),
+ NextSlotAfterFromFull is NextSlotAfterRedoLayout + 1
+ },
+ { trace_level_needs_internal_events(TraceLevel) = TraceInternal0 },
+ {
+ TraceInternal0 = no,
TraceInternal = no
+ ;
+ TraceInternal0 = yes,
+ globals__lookup_bool_option(Globals, trace_internal,
+ TraceInternal)
},
- { globals__lookup_bool_option(Globals, trace_decl, yes) ->
+ { trace_level_needs_decl_debug_slots(TraceLevel) = DeclDebugSlots },
+ {
+ DeclDebugSlots = yes,
MaybeDeclSlots = yes(NextSlotAfterFromFull),
NextSlotAfterDecl = NextSlotAfterFromFull + 2
;
+ DeclDebugSlots = no,
MaybeDeclSlots = no,
NextSlotAfterDecl = NextSlotAfterFromFull
},
@@ -355,13 +359,13 @@
},
{ TraceSlotInfo = trace_slot_info(MaybeFromFullSlot,
MaybeDeclSlots, MaybeTrailSlot) },
- { init_trace_info(TraceType, TraceInternal, TraceDecl, MaybeTrailLvals,
- MaybeRedoLayout, TraceInfo) }.
+ { init_trace_info(TraceLevel, TraceInternal, MaybeFromFullSlotLval,
+ MaybeTrailLvals, MaybeRedoLayout, TraceInfo) }.
trace__generate_slot_fill_code(TraceInfo, TraceCode) -->
code_info__get_proc_model(CodeModel),
{
- trace_info_get_trace_type(TraceInfo, TraceType),
+ trace_info_get_maybe_from_full_slot(TraceInfo, MaybeFromFullSlot),
trace_info_get_maybe_redo_layout_slot(TraceInfo, MaybeRedoLayoutSlot),
trace_info_get_maybe_trail_slots(TraceInfo, MaybeTrailLvals),
trace__event_num_slot(CodeModel, EventNumLval),
@@ -408,7 +412,7 @@
FillAllSlots = FillFourSlots
),
(
- TraceType = shallow_trace(CallFromFullSlot),
+ MaybeFromFullSlot = yes(CallFromFullSlot),
trace__stackref_to_string(CallFromFullSlot,
CallFromFullSlotStr),
string__append_list([
@@ -420,7 +424,7 @@
"\t\t}"
], TraceStmt)
;
- TraceType = deep_trace,
+ MaybeFromFullSlot = no,
TraceStmt = FillAllSlots
),
TraceCode = node([
@@ -436,17 +440,18 @@
{
MaybeTraceInfo = yes(TraceInfo)
->
- trace_info_get_trace_type(TraceInfo, TraceType),
+ trace_info_get_maybe_from_full_slot(TraceInfo,
+ MaybeFromFullSlot),
trace__call_depth_slot(CodeModel, CallDepthLval),
trace__stackref_to_string(CallDepthLval, CallDepthStr),
string__append_list([
"MR_trace_reset_depth(", CallDepthStr, ");\n"
], ResetDepthStmt),
(
- TraceType = shallow_trace(_),
+ MaybeFromFullSlot = yes(_),
ResetFromFullStmt = "MR_trace_from_full = FALSE;\n"
;
- TraceType = deep_trace,
+ MaybeFromFullSlot = no,
ResetFromFullStmt = "MR_trace_from_full = TRUE;\n"
),
TraceCode = node([
@@ -493,7 +498,9 @@
},
(
{ ( Port = ite_cond ; Port = neg_enter ) },
- { trace_info_get_trace_decl(TraceInfo, no) }
+ { trace_info_get_trace_level(TraceInfo, TraceLevel) },
+ { trace_level_needs_neg_context_events(TraceLevel)
+ = no }
->
{ Code = empty }
;
@@ -512,7 +519,8 @@
(
{ MaybeTraceInfo = yes(TraceInfo) },
{ trace_info_get_trace_internal(TraceInfo, yes) },
- { trace_info_get_trace_decl(TraceInfo, yes) }
+ { trace_info_get_trace_level(TraceInfo, TraceLevel) },
+ { trace_level_needs_neg_context_events(TraceLevel) = yes }
->
{
NegPort = neg_failure,
@@ -659,9 +667,10 @@
trace__maybe_setup_redo_event(TraceInfo, Code) :-
trace_info_get_maybe_redo_layout_slot(TraceInfo, TraceRedoLayout),
( TraceRedoLayout = yes(_) ->
- trace_info_get_trace_type(TraceInfo, TraceType),
+ trace_info_get_maybe_from_full_slot(TraceInfo,
+ MaybeFromFullSlot),
(
- TraceType = shallow_trace(Lval),
+ MaybeFromFullSlot = yes(Lval),
% The code in the runtime looks for the from-full
% flag in framevar 5; see the comment before
% trace__reserved_slots.
@@ -673,7 +682,7 @@
- "set up shallow redo event"
])
;
- TraceType = deep_trace,
+ MaybeFromFullSlot = no,
Code = node([
mkframe(temp_frame(nondet_stack_proc),
do_trace_redo_fail_deep)
@@ -844,12 +853,11 @@
% of a procedure.
:- type trace_info
---> trace_info(
- trace_type, % The trace level (which cannot be
- % none), and if it is shallow, the
- % lval of the slot that holds the
+ trace_level, % The trace level.
+ bool, % Whether we generate internal events.
+ maybe(lval), % If the trace level is shallow,
+ % the lval of the slot that holds the
% from-full flag.
- bool, % The value of --trace-internal.
- bool, % The value of --trace-decl.
maybe(pair(lval)),
% If trailing is enabled, the lvals
% of the slots that hold the value
@@ -865,26 +873,28 @@
% two events have identical layouts).
).
-:- pred init_trace_info(trace_type::in, bool::in, bool::in,
+:- pred init_trace_info(trace_level::in, bool::in, maybe(lval)::in,
maybe(pair(lval))::in, maybe(label)::in, trace_info::out) is det.
-:- pred trace_info_get_trace_type(trace_info::in, trace_type::out) is det.
+:- pred trace_info_get_trace_level(trace_info::in, trace_level::out) is det.
:- pred trace_info_get_trace_internal(trace_info::in, bool::out) is det.
-:- pred trace_info_get_trace_decl(trace_info::in, bool::out) is det.
+:- pred trace_info_get_maybe_from_full_slot(trace_info::in, maybe(lval)::out)
+ is det.
:- pred trace_info_get_maybe_trail_slots(trace_info::in,
maybe(pair(lval))::out) is det.
:- pred trace_info_get_maybe_redo_layout_slot(trace_info::in,
maybe(label)::out) is det.
-init_trace_info(TraceType, TraceInternal, TraceDecl,
+init_trace_info(TraceLevel, TraceInternal, MaybeFromFullSlot,
MaybeTrailSlot, MaybeRedoLayoutSlot,
- trace_info(TraceType, TraceInternal, TraceDecl,
+ trace_info(TraceLevel, TraceInternal, MaybeFromFullSlot,
MaybeTrailSlot, MaybeRedoLayoutSlot)).
-trace_info_get_trace_type(trace_info(TraceType, _, _, _, _), TraceType).
+trace_info_get_trace_level(trace_info(TraceLevel, _, _, _, _), TraceLevel).
+trace_info_get_maybe_from_full_slot(trace_info(_, _, MaybeFromFullSlot, _, _),
+ MaybeFromFullSlot).
trace_info_get_trace_internal(trace_info(_, TraceInternal, _, _, _),
TraceInternal).
-trace_info_get_trace_decl(trace_info(_, _, TraceDecl, _, _), TraceDecl).
trace_info_get_maybe_trail_slots(trace_info(_, _, _, MaybesTrailSlot, _),
MaybesTrailSlot).
trace_info_get_maybe_redo_layout_slot(trace_info(_, _, _, _,
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/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/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 extras/xml
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.18
diff -u -r1.18 Mmakefile
--- tests/debugger/declarative/Mmakefile 2000/08/10 05:51:14 1.18
+++ tests/debugger/declarative/Mmakefile 2000/09/25 09:41:06
@@ -46,7 +46,7 @@
ite_2 \
solutions
-MCFLAGS = --trace deep --trace-decl
+MCFLAGS = --trace decl
MLFLAGS = --trace
C2INITFLAGS = --trace
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/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/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trax
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