[m-rev.] for review: printing higher order values and typeinfos in the debugger
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Feb 22 03:27:37 AEDT 2002
For review by anyone, but I would like Mark to check whether I missed any
places where the browser uses io__write or io__write_univ to print terms
from the program.
The .exp2 files are being computed now. I also haven't yet updated the NEWS
file, because I don't know whether we should announce the new print_optionals
debugger command.
Zoltan.
Estimated hours taken: 48
Branches: main
Allow the debugger to print higher order values and typeinfos, mainly by
making the committed choice modes of the predicates in deconstruct.m to
deconstruct higher order values and typeinfos. (The non committed choice
versions will continue to return only placeholders.)
Having the debugger print typeinfos is occasionally useful but more often
it is just distracting. This change therefore adds a new debugger command,
"print_optionals", that toggles the printing of optional values. For now,
the only optional values are typeinfos.
browser/browser_info.m:
Use the predicates in the deconstruct.m instead of std_util,
to make the choice of noncanonical term method handling explicit.
browser/browse.m:
When writing small terms using io__write_univ, explicitly use
the same noncanonical term handling method as browser_info.m
library/io.m:
Add predicates to retrieve the current input and output streams.
Add versions of io__write_univ that specify the stream and maybe
the method of handling noncanonical terms.
Add a mode to io__write_list that allows the closure that prints the
list elements to be cc_multi.
All of these are for the new functionality in the browser.
runtime/mercury_ml_expand_body.h:
In committed choice contexts, deconstruct closures as if they were
ordinary terms, with the function symbol being the name of the
predicate/function and the arguments being the terms stored in
the closure.
In committed choice contexts, deconstruct typeinfos as if they were
ordinary terms, with the function symbol being the name of the type
constructor and the arguments being the type constructor's arguments.
library/deconstruct.m:
Document the changes in the behavior of the predicates defined in this
module as a result of the change to mercury_ml_expand_body.h.
runtime/mercury_ho_call.h:
runtime/mercury_stack_layout.h:
Add prefixes on structure field names that did not have them.
browser/dl.m:
Add prefixes where needed by the changes to mercury_ho_call.h.
runtime/mercury_layout_util.[ch]:
Remove the first argument of MR_materialize_closure_typeinfos, since
its correct value is always the same part of the second argument.
runtime/mercury_deep_copy_body.h:
Do not pass the first argument of MR_materialize_closure_typeinfos.
Add field name prefixes where necessary.
compiler/modules.m:
The mercury_builtin module is no longer part of the library.
compiler/pd_debug.m:
compiler/rl_analyze.m:
Minor updates to avoid trying to take the address of io__write_list,
since it now has more than one mode.
runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
trace/mercury_trace_vars.[ch]:
Add a parameter to MR_trace_browse_all_on_level that specifies
whether we should print values of type type_info.
trace/mercury_trace_vars.c:
Do not ignore predicates and functions anymore.
runtime/mercury_stack_trace.c:
trace/mercury_trace.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
Pass the new parameter of MR_trace_browse_all_on_level.
trace/mercury_trace_internal.c:
Implement the "print_optionals" command.
doc/user_guide.texi:
Document the "print_optionals" command.
tests/debugger/higher_order.{m,inp,exp,exp2}:
A new test case to exercise the ability to print higher order values.
Note that the format of the predicate names in the output should be
improved, but that is a separate change since doing it the right way
requires bootstrapping.
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/nondet_stack.exp*:
Update the expected output to reflect the fact that nondet stack dumps,
being intended for debugging, include type_infos.
tests/debugger/tabled_read_decl.exp*:
Update the expected output to reflect the fact that for maximum
usefulness, the printing of I/O action atoms prints meaningful
type_infos.
tests/hard_coded/deconstruct_arg.*:
tests/hard_coded/write_reg1.*:
Expand these tests to check that we handle higher order values
correctly not just when canonicalizing but also in committed choice
modes.
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/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
Index: browser/browse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browse.m,v
retrieving revision 1.26
diff -u -b -r1.26 browse.m
--- browser/browse.m 28 Jan 2002 07:20:09 -0000 1.26
+++ browser/browse.m 21 Feb 2002 12:57:00 -0000
@@ -118,7 +118,8 @@
:- implementation.
:- import_module mdb__parse, mdb__util, mdb__frame, mdb__sized_pretty.
-:- import_module string, parser, require, std_util, int, char, pprint.
+:- import_module string, int, char, std_util.
+:- import_module parser, require, pprint, deconstruct.
%---------------------------------------------------------------------------%
%
@@ -520,23 +521,28 @@
).
:- pred portray_flat_write_browser_term(browser_term::in,
- io__state::di, io__state::uo) is det.
+ io__state::di, io__state::uo) is cc_multi.
portray_flat_write_browser_term(plain_term(Univ)) -->
- io__write_univ(Univ).
+ io__current_output_stream(Stream),
+ io__write_univ(Stream, include_details_cc, Univ).
portray_flat_write_browser_term(synthetic_term(Functor, Args, MaybeReturn)) -->
io__write_string(Functor),
+ io__current_output_stream(Stream),
( { Args = [] } ->
[]
;
io__write_string("("),
- io__write_list(Args, ", ", io__write_univ),
+ io__write_list(Args, ", ",
+ pred(U::in, S0::di, S::uo) is cc_multi :-
+ io__write_univ(Stream, include_details_cc, U,
+ S0, S)),
io__write_string(")")
),
(
{ MaybeReturn = yes(Return) },
io__write_string(" = "),
- io__write_univ(Return)
+ io__write_univ(Stream, include_details_cc, Return)
;
{ MaybeReturn = no }
).
Index: browser/browser_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browser_info.m,v
retrieving revision 1.7
diff -u -b -r1.7 browser_info.m
--- browser/browser_info.m 28 Jan 2002 07:20:09 -0000 1.7
+++ browser/browser_info.m 21 Feb 2002 07:14:06 -0000
@@ -140,12 +140,13 @@
%---------------------------------------------------------------------------%
-% These three predicates are like the deconstruct_cc, limited_deconstruct_cc
-% and functor_cc procedures in std_util, except they work on browser_terms.
-% This requires them to have an extra argument (the last). For deconstruct
-% and limited_deconstruct, this returns the return value if the browser term
-% represents a function call. For functor, it says whether the browser term
-% represents a function call.
+% These three predicates are like the deconstruct, limited_deconstruct
+% and functor procedures in deconstruct, except they implicitly specify
+% include_details_cc and they work on browser_terms instead of plain terms.
+% The latter difference requires them to have an extra argument (the last).
+% For deconstruct and limited_deconstruct, this returns the return value
+% if the browser term represents a function call. For functor, it says
+% whether the browser term represents a function call.
:- pred deconstruct_browser_term_cc(browser_term::in,
string::out, int::out, list(univ)::out, maybe(univ)::out) is cc_multi.
@@ -159,7 +160,7 @@
%---------------------------------------------------------------------------%
:- implementation.
-:- import_module require.
+:- import_module deconstruct, require.
:- pragma export(browser_info__init_persistent_state(out),
"ML_BROWSE_init_persistent_state").
@@ -451,7 +452,8 @@
deconstruct_browser_term_cc(BrowserTerm, Functor, Arity, Args, MaybeReturn) :-
(
BrowserTerm = plain_term(Univ),
- deconstruct_cc(univ_value(Univ), Functor, Arity, Args),
+ deconstruct(univ_value(Univ), include_details_cc,
+ Functor, Arity, Args),
MaybeReturn = no
;
BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
@@ -462,8 +464,8 @@
MaybeReturn) :-
(
BrowserTerm = plain_term(Univ),
- limited_deconstruct_cc(univ_value(Univ), Limit,
- Functor, Arity, Args),
+ limited_deconstruct(univ_value(Univ), include_details_cc,
+ Limit, Functor, Arity, Args),
MaybeReturn = no
;
BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
@@ -473,7 +475,7 @@
functor_browser_term_cc(BrowserTerm, Functor, Arity, IsFunc) :-
(
BrowserTerm = plain_term(Univ),
- functor_cc(univ_value(Univ), Functor, Arity),
+ functor(univ_value(Univ), include_details_cc, Functor, Arity),
IsFunc = no
;
BrowserTerm = synthetic_term(Functor, Args, MaybeReturn),
Index: browser/dl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/dl.m,v
retrieving revision 1.16
diff -u -b -r1.16 dl.m
--- browser/dl.m 18 Feb 2002 07:00:48 -0000 1.16
+++ browser/dl.m 18 Feb 2002 08:50:19 -0000
@@ -216,21 +216,24 @@
*/
MR_incr_hp_type(closure_id, MR_Closure_Id);
- closure_id->proc_id.MR_proc_user.MR_user_pred_or_func = MR_PREDICATE;
- closure_id->proc_id.MR_proc_user.MR_user_decl_module = ""unknown"";
- closure_id->proc_id.MR_proc_user.MR_user_def_module = ""unknown"";
- closure_id->proc_id.MR_proc_user.MR_user_name = ""unknown"";
- closure_id->proc_id.MR_proc_user.MR_user_arity = -1;
- closure_id->proc_id.MR_proc_user.MR_user_mode = -1;
- closure_id->module_name = ""dl"";
- closure_id->file_name = __FILE__;
- closure_id->line_number = __LINE__;
- MR_make_aligned_string_copy(closure_id->goal_path, buf);
+ closure_id->MR_closure_proc_id.MR_proc_user.MR_user_pred_or_func =
+ MR_PREDICATE;
+ closure_id->MR_closure_proc_id.MR_proc_user.MR_user_decl_module =
+ ""unknown"";
+ closure_id->MR_closure_proc_id.MR_proc_user.MR_user_def_module =
+ ""unknown"";
+ closure_id->MR_closure_proc_id.MR_proc_user.MR_user_name = ""unknown"";
+ closure_id->MR_closure_proc_id.MR_proc_user.MR_user_arity = -1;
+ closure_id->MR_closure_proc_id.MR_proc_user.MR_user_mode = -1;
+ closure_id->MR_closure_module_name = ""dl"";
+ closure_id->MR_closure_file_name = __FILE__;
+ closure_id->MR_closure_line_number = __LINE__;
+ MR_make_aligned_string_copy(closure_id->MR_closure_goal_path, buf);
MR_incr_hp_type(closure_layout, MR_Closure_Dyn_Link_Layout);
- closure_layout->closure_id = closure_id;
- closure_layout->type_params = NULL;
- closure_layout->num_all_args = 0;
+ closure_layout->MR_closure_dl_id = closure_id;
+ closure_layout->MR_closure_dl_type_params = NULL;
+ closure_layout->MR_closure_dl_num_all_args = 0;
ClosureLayout = (MR_Word) closure_layout;
}").
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.219
diff -u -b -r1.219 modules.m
--- compiler/modules.m 19 Feb 2002 10:56:16 -0000 1.219
+++ compiler/modules.m 20 Feb 2002 03:52:40 -0000
@@ -661,7 +661,6 @@
mercury_std_library_module("list").
mercury_std_library_module("map").
mercury_std_library_module("math").
-mercury_std_library_module("mercury_builtin").
mercury_std_library_module("multi_map").
mercury_std_library_module("ops").
mercury_std_library_module("parser").
Index: compiler/pd_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_debug.m,v
retrieving revision 1.4
diff -u -b -r1.4 pd_debug.m
--- compiler/pd_debug.m 11 Aug 2001 14:09:50 -0000 1.4
+++ compiler/pd_debug.m 21 Feb 2002 13:26:28 -0000
@@ -162,8 +162,10 @@
pd_debug__write_pred_proc_id_list(PredProcIds) -->
pd_info_get_module_info(ModuleInfo),
pd_debug__do_io(
+ pred(S0::di, S::uo) is det :-
io__write_list(PredProcIds, ", ",
- pd_debug__write_pred_proc_id(ModuleInfo))
+ pd_debug__write_pred_proc_id(ModuleInfo),
+ S0, S)
).
:- pred pd_debug__write_pred_proc_id(module_info::in, pred_proc_id::in,
Index: compiler/rl_analyse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_analyse.m,v
retrieving revision 1.1
diff -u -b -r1.1 rl_analyse.m
--- compiler/rl_analyse.m 6 Dec 1998 23:44:42 -0000 1.1
+++ compiler/rl_analyse.m 21 Feb 2002 13:29:12 -0000
@@ -242,10 +242,11 @@
rl_analyse__dump_block_data_map(Analysis, Blocks, BlockDataMap, Globals) -->
rl_analyse__do_io(
+ pred(S0::di, S::uo) is det :-
io__write_list(Blocks, "\n",
rl_analyse__dump_block_data(Analysis,
- BlockDataMap, Globals)
- )
+ BlockDataMap, Globals),
+ S0, S)
).
:- pred rl_analyse__dump_block_data(rl_analysis(T, U, V)::rl_analysis,
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.292
diff -u -b -r1.292 user_guide.texi
--- doc/user_guide.texi 12 Feb 2002 16:36:10 -0000 1.292
+++ doc/user_guide.texi 21 Feb 2002 16:24:21 -0000
@@ -2853,6 +2853,25 @@
@item label_stats @var{filename}
Prints statistics about label layout structures in the program
to the file @var{filename}.
+ at sp 1
+ at item proc_stats
+ at kindex proc_stats (mdb command)
+Prints statistics about procedure layout structures in the program.
+ at sp 1
+ at item proc_stats @var{filename}
+Prints statistics about procedure layout structures in the program
+to the file @var{filename}.
+ at sp 1
+ at item print_optionals
+ at kindex print_optionals (mdb command)
+Reports whether optionally-printed values such as typeinfos
+that are usually of interest only to implementors are being printed or not.
+ at sp 1
+ at item print_optionals on
+Tells the debugger to print optionally-printed values.
+ at sp 1
+ at item print_optionals off
+Tells the debugger not to print optionally-printed values.
@end table
@node Miscellaneous commands
@subsection Miscellaneous commands
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/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/lex
cvs diff: Diffing extras/lex/samples
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/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/deconstruct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/deconstruct.m,v
retrieving revision 1.4
diff -u -b -r1.4 deconstruct.m
--- library/deconstruct.m 18 Feb 2002 07:01:03 -0000 1.4
+++ library/deconstruct.m 21 Feb 2002 15:36:46 -0000
@@ -49,34 +49,36 @@
% The string representation of the functor that these predicates
% return is:
%
- % - for user defined types, the functor that is given
- % in the type definition. For lists, this
- % means the functors [|]/2 and []/0 are used, even if
- % the list uses the [....] shorthand.
- % For types with user-defined equality, the functor will be
- % a constant of the form <<module:type/arity>>/0 except
+ % - for user defined types with standard equality, the functor
+ % that is given in the type definition. For lists, this means
+ % the functors [|]/2 and []/0 are used, even if the list uses
+ % the [....] shorthand.
+ % - for user-defined types with user-defined equality, the
+ % functor will be of the form <<module:type/arity>>/0, except
% with include_details_cc.
- % - for integers, the string is a base 10 number,
+ % - for integers, the string is a base 10 number;
% positive integers have no sign.
- % - for floats, the string is a floating point,
- % base 10 number, positive floating point numbers have
- % no sign.
+ % - for floats, the string is a floating point, base 10 number;
+ % positive floating point numbers have no sign.
% - for strings, the string, inside double quotation marks
% - for characters, the character inside single quotation marks
- % - for predicates, the string <<predicate>>
- % - for functions, the string <<function>>
- % - for tuples, the string {}
- % - for arrays, the string <<array>>
+ % - for predicates, the string <<predicate>>, and for functions,
+ % the string <<function>>, except with include_details_cc.
+ % - for tuples, the string {}.
+ % - for arrays, the string <<array>>.
%
% The arity that these predicates return is:
%
- % - for user defined types, the arity of the functor.
+ % - for user defined types with standard equality, the arity
+ % of the functor.
+ % - for user defined types with user-defined equality, zero,
+ % except with include_details_cc.
% - for integers, zero.
% - for floats, zero.
% - for strings, zero.
% - for characters, zero.
- % - for predicates and functions, zero; we do not return the
- % number of arguments expected by the predicate or function.
+ % - for predicates and functions, zero, except with
+ % include_details_cc.
% - for tuples, the number of elements in the tuple.
% - for arrays, the number of elements in the array.
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.243
diff -u -b -r1.243 io.m
--- library/io.m 18 Feb 2002 07:01:04 -0000 1.243
+++ library/io.m 21 Feb 2002 12:38:12 -0000
@@ -461,6 +461,8 @@
:- pred io__write_list(list(T), string, pred(T, io__state, io__state),
io__state, io__state).
:- mode io__write_list(in, in, pred(in, di, uo) is det, di, uo) is det.
+:- mode io__write_list(in, in, pred(in, di, uo) is cc_multi, di, uo)
+ is cc_multi.
% io__write_list(List, Separator, OutputPred, IO0, IO)
% applies OutputPred to each element of List, printing Separator
% between each element. Outputs to the current output stream.
@@ -529,6 +531,12 @@
% Retrieves the standard input stream.
% Does not modify the IO state.
+:- pred io__current_input_stream(io__input_stream, io__state, io__state).
+:- mode io__current_input_stream(out, di, uo) is det.
+% io__current_input_stream(CurrentStream, IO0, IO1)
+% Returns the current input stream in CurrentStream.
+% Does not modify the IO state.
+
:- pred io__input_stream_name(string, io__state, io__state).
:- mode io__input_stream_name(out, di, uo) is det.
% Retrieves the human-readable name associated with the current input
@@ -626,6 +634,12 @@
% Retrieves the standard error stream.
% Does not modify the IO state.
+:- pred io__current_output_stream(io__output_stream, io__state, io__state).
+:- mode io__current_output_stream(out, di, uo) is det.
+% io__current_output_stream(CurrentStream, IO0, IO1)
+% Returns the current output stream in CurrentStream.
+% Does not modify the IO state.
+
:- pred io__output_stream_name(string, io__state, io__state).
:- mode io__output_stream_name(out, di, uo) is det.
% Retrieves the human-readable name associated with the current
@@ -834,6 +848,13 @@
% Retrieves the standard binary input stream.
% Does not modify the IO state.
+:- pred io__current_binary_input_stream(io__binary_input_stream,
+ io__state, io__state).
+:- mode io__current_binary_input_stream(out, di, uo) is det.
+% io__current_binary_input_stream(CurrentStream, IO0, IO1)
+% Returns the current binary input stream in CurrentStream.
+% Does not modify the IO state.
+
:- pred io__binary_input_stream_name(string, io__state, io__state).
:- mode io__binary_input_stream_name(out, di, uo) is det.
% Retrieves the human-readable name associated with the current binary
@@ -909,6 +930,13 @@
% Changes the current binary output stream to the stream
% specified. Returns the previous stream.
+:- pred io__current_binary_output_stream(io__binary_output_stream,
+ io__state, io__state).
+:- mode io__current_binary_output_stream(out, di, uo) is det.
+% io__current_binary_output_stream(CurrentStream, IO0, IO1)
+% Returns the current binary output stream in CurrentStream.
+% Does not modify the IO state.
+
:- pred io__binary_output_stream_name(string, io__state, io__state).
:- mode io__binary_output_stream_name(out, di, uo) is det.
% Retrieves the human-readable name associated with the current
@@ -1185,6 +1213,16 @@
:- pred io__write_univ(univ, io__state, io__state).
:- mode io__write_univ(in, di, uo) is det.
+:- pred io__write_univ(io__output_stream, univ, io__state, io__state).
+:- mode io__write_univ(in, in, di, uo) is det.
+
+:- pred io__write_univ(io__output_stream, deconstruct__noncanon_handling, univ,
+ io__state, io__state).
+:- mode io__write_univ(in, in(do_not_allow), in, di, uo) is det.
+:- mode io__write_univ(in, in(canonicalize), in, di, uo) is det.
+:- mode io__write_univ(in, in(include_details_cc), in, di, uo) is cc_multi.
+:- mode io__write_univ(in, in, in, di, uo) is cc_multi.
+
% This is the same as io__read_from_string, except that an integer
% is allowed where a character is expected. This is needed by
% extras/aditi/aditi.m because Aditi does not have a builtin
@@ -2295,6 +2333,18 @@
io__get_op_table(OpTable),
io__do_write_univ(canonicalize, Univ, ops__max_priority(OpTable) + 1).
+io__write_univ(Stream, Univ) -->
+ io__set_output_stream(Stream, OrigStream),
+ io__get_op_table(OpTable),
+ io__do_write_univ(canonicalize, Univ, ops__max_priority(OpTable) + 1),
+ io__set_output_stream(OrigStream, _Stream).
+
+io__write_univ(Stream, NonCanon, Univ) -->
+ io__set_output_stream(Stream, OrigStream),
+ io__get_op_table(OpTable),
+ io__do_write_univ(NonCanon, Univ, ops__max_priority(OpTable) + 1),
+ io__set_output_stream(OrigStream, _Stream).
+
:- pred io__do_write_univ(deconstruct__noncanon_handling, univ,
io__state, io__state).
:- mode io__do_write_univ(in(do_not_allow), in, di, uo) is det.
@@ -4432,6 +4482,38 @@
update_io(IO0, IO);
}").
+:- pragma foreign_proc("C",
+ io__current_input_stream(OutStream::out, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure, tabled_for_io],
+"
+ OutStream = (MR_Word) mercury_current_text_input;
+ update_io(IO0, IO);
+").
+
+:- pragma foreign_proc("C",
+ io__current_output_stream(OutStream::out, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure, tabled_for_io],
+"
+ OutStream = (MR_Word) mercury_current_text_output;
+ update_io(IO0, IO);
+").
+
+:- pragma foreign_proc("C",
+ io__current_binary_input_stream(OutStream::out, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure, tabled_for_io],
+"
+ OutStream = (MR_Word) mercury_current_binary_input;
+ update_io(IO0, IO);
+").
+
+:- pragma foreign_proc("C",
+ io__current_binary_output_stream(OutStream::out, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure, tabled_for_io],
+"
+ OutStream = (MR_Word) mercury_current_binary_output;
+ update_io(IO0, IO);
+").
+
% io__set_input_stream(NewStream, OldStream, IO0, IO1)
% Changes the current input stream to the stream specified.
% Returns the previous stream.
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.46
diff -u -b -r1.46 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h 18 Feb 2002 07:01:14 -0000 1.46
+++ runtime/mercury_deep_copy_body.h 18 Feb 2002 08:50:34 -0000
@@ -504,7 +504,7 @@
** with the values from the closure.
*/
type_info_arg_vector = MR_materialize_closure_typeinfos(
- closure_layout->type_params, old_closure);
+ old_closure);
/* copy the arguments */
for (i = 0; i < args; i++) {
@@ -515,7 +515,7 @@
MR_fatal_error("Sorry, not implemented: copying closures");
#endif
arg_pseudo_type_info =
- closure_layout->arg_pseudo_type_info[i];
+ closure_layout->MR_closure_arg_pseudo_type_info[i];
new_closure->MR_closure_hidden_args_0[i] =
copy_arg(NULL,
&old_closure->MR_closure_hidden_args_0[i], NULL,
Index: runtime/mercury_ho_call.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.h,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_ho_call.h
--- runtime/mercury_ho_call.h 19 Dec 2001 06:58:54 -0000 1.5
+++ runtime/mercury_ho_call.h 19 Dec 2001 06:59:10 -0000
@@ -73,16 +73,17 @@
*/
typedef struct MR_Closure_Layout_Struct {
- MR_Closure_Id *closure_id;
- MR_Type_Param_Locns *type_params;
- MR_Integer num_all_args;
- MR_PseudoTypeInfo arg_pseudo_type_info[MR_VARIABLE_SIZED];
+ MR_Closure_Id *MR_closure_id;
+ MR_Type_Param_Locns *MR_closure_type_params;
+ MR_Integer MR_closure_num_all_args;
+ MR_PseudoTypeInfo MR_closure_arg_pseudo_type_info
+ [MR_VARIABLE_SIZED];
} MR_Closure_Layout;
typedef struct MR_Closure_Dyn_Link_Layout_Struct {
- MR_Closure_Id *closure_id;
- MR_Type_Param_Locns *type_params;
- MR_Integer num_all_args;
+ MR_Closure_Id *MR_closure_dl_id;
+ MR_Type_Param_Locns *MR_closure_dl_type_params;
+ MR_Integer MR_closure_dl_num_all_args;
} MR_Closure_Dyn_Link_Layout;
/*
Index: runtime/mercury_init.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.33
diff -u -b -r1.33 mercury_init.h
--- runtime/mercury_init.h 18 Feb 2002 07:01:17 -0000 1.33
+++ runtime/mercury_init.h 20 Feb 2002 06:38:06 -0000
@@ -126,7 +126,8 @@
/* in trace/mercury_trace_vars.h */
extern const char *MR_trace_browse_all_on_level(FILE *,
- const MR_Label_Layout *, MR_Word *, MR_Word *, int);
+ const MR_Label_Layout *, MR_Word *, MR_Word *,
+ int, MR_bool);
/* in trace/mercury_trace_external.h */
extern void MR_trace_init_external(void);
Index: runtime/mercury_layout_util.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_layout_util.c,v
retrieving revision 1.26
diff -u -b -r1.26 mercury_layout_util.c
--- runtime/mercury_layout_util.c 20 Feb 2002 03:14:42 -0000 1.26
+++ runtime/mercury_layout_util.c 21 Feb 2002 15:19:50 -0000
@@ -18,7 +18,7 @@
static MR_Word MR_lookup_closure_long_lval(MR_Long_Lval locn,
MR_Closure *closure, MR_bool *succeeded);
static MR_Word MR_lookup_answer_block_long_lval(MR_Long_Lval locn,
- MR_Word *answer_block, int block_size, bool *succeeded);
+ MR_Word *answer_block, int block_size, MR_bool *succeeded);
void
MR_copy_regs_to_saved_regs(int max_mr_num, MR_Word *saved_regs)
@@ -117,9 +117,11 @@
}
MR_TypeInfoParams
-MR_materialize_closure_typeinfos(const MR_Type_Param_Locns *tvar_locns,
- MR_Closure *closure)
+MR_materialize_closure_typeinfos(MR_Closure *closure)
{
+ const MR_Type_Param_Locns *tvar_locns;
+
+ tvar_locns = closure->MR_closure_layout->MR_closure_type_params;
if (tvar_locns != NULL) {
MR_TypeInfoParams type_params;
MR_bool succeeded;
@@ -157,7 +159,7 @@
{
if (tvar_locns != NULL) {
MR_TypeInfoParams type_params;
- bool succeeded;
+ MR_bool succeeded;
MR_Integer count;
int i;
@@ -328,7 +330,7 @@
static MR_Word
MR_lookup_answer_block_long_lval(MR_Long_Lval locn, MR_Word *answer_block,
- int block_size, bool *succeeded)
+ int block_size, MR_bool *succeeded)
{
int locn_num;
int offset;
Index: runtime/mercury_layout_util.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_layout_util.h,v
retrieving revision 1.17
diff -u -b -r1.17 mercury_layout_util.h
--- runtime/mercury_layout_util.h 20 Feb 2002 03:14:42 -0000 1.17
+++ runtime/mercury_layout_util.h 20 Feb 2002 03:52:45 -0000
@@ -62,7 +62,6 @@
MR_Word *saved_regs,
MR_Word *base_sp, MR_Word *base_curfr);
extern MR_TypeInfoParams MR_materialize_closure_typeinfos(
- const MR_Type_Param_Locns *tvar_locns,
MR_Closure *closure);
extern MR_TypeInfoParams MR_materialize_answer_block_typeinfos(
const MR_Type_Param_Locns *tvar_locns,
Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h 18 Feb 2002 07:01:18 -0000 1.14
+++ runtime/mercury_ml_expand_body.h 21 Feb 2002 06:36:21 -0000
@@ -118,6 +118,8 @@
#include <stdio.h>
#include "mercury_library_types.h" /* for MR_ArrayType */
+#include "mercury_layout_util.h" /* for MR_materialize_closure_typeinfos */
+#include "mercury_ho_call.h" /* for MR_Closure_Id etc */
#ifdef MR_DEEP_PROFILING
#include "mercury_deep_profiling.h"
@@ -685,11 +687,13 @@
MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
": attempt to deconstruct noncanonical term");
break;
- }
-
+ } else if (noncanon == MR_NONCANON_ALLOW) {
handle_functor_name("<<function>>");
handle_zero_arity_args();
break;
+ } else {
+ goto predfunc;
+ }
case MR_TYPECTOR_REP_PRED:
if (noncanon == MR_NONCANON_ABORT) {
@@ -697,11 +701,102 @@
MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
": attempt to deconstruct noncanonical term");
break;
- }
-
+ } else if (noncanon == MR_NONCANON_ALLOW) {
handle_functor_name("<<predicate>>");
handle_zero_arity_args();
break;
+ } else {
+ goto predfunc;
+ }
+
+ /*
+ ** This label handles the MR_NONCANON_CC case of both predicates
+ ** and functions.
+ */
+ predfunc:
+ {
+ MR_Closure *closure;
+ MR_Closure_Layout *closure_layout;
+ MR_Proc_Id *proc_id;
+ MR_User_Proc_Id *user_proc_id;
+ MR_Compiler_Proc_Id *comp_proc_id;
+ MR_ConstString name;
+ int num_args;
+ int i;
+
+ closure = (MR_Closure *) *data_word_ptr;
+ closure_layout = closure->MR_closure_layout;
+ num_args = closure->MR_closure_num_hidden_args;
+ expand_info->arity = num_args;
+
+#ifdef EXPAND_FUNCTOR_FIELD
+ proc_id = &closure_layout->MR_closure_id->MR_closure_proc_id;
+ if (proc_id->MR_proc_user.MR_user_arity < 0) {
+ name = "dynlink_proc"; /* XXX */
+ } else if (MR_PROC_ID_COMPILER_GENERATED(*proc_id)) {
+ name = proc_id->MR_proc_comp.MR_comp_pred_name;
+ } else {
+ name = proc_id->MR_proc_user.MR_user_name;
+ }
+ handle_functor_name(name);
+#endif /* EXPAND_FUNCTOR_FIELD */
+
+#ifdef EXPAND_ARGS_FIELD
+ #ifdef EXPAND_APPLY_LIMIT
+ if (num_args > max_arity) {
+ expand_info->limit_reached = MR_TRUE;
+ } else
+ #endif /* EXPAND_APPLY_LIMIT */
+ {
+ MR_TypeInfo *type_params;
+
+ type_params =
+ MR_materialize_closure_typeinfos(closure);
+ expand_info->EXPAND_ARGS_FIELD.num_extra_args = 0;
+ expand_info->EXPAND_ARGS_FIELD.arg_values = &closure->
+ MR_closure_hidden_args_0[0];
+ expand_info->EXPAND_ARGS_FIELD.arg_type_infos =
+ MR_GC_NEW_ARRAY(MR_TypeInfo, num_args);
+ expand_info->EXPAND_ARGS_FIELD.can_free_arg_type_infos =
+ MR_TRUE;
+ for (i = 0; i < num_args ; i++) {
+ expand_info->EXPAND_ARGS_FIELD.arg_type_infos[i] =
+ MR_create_type_info(type_params,
+ closure_layout->
+ MR_closure_arg_pseudo_type_info[i]);
+ }
+ if (type_params != NULL) {
+ MR_free(type_params);
+ }
+ }
+#endif /* EXPAND_ARGS_FIELD */
+
+#ifdef EXPAND_CHOSEN_ARG
+ if (0 <= chosen && chosen < num_args) {
+ MR_TypeInfo *type_params;
+
+ expand_info->chosen_index_exists = MR_TRUE;
+ expand_info->chosen_value_ptr =
+ &closure->MR_closure_hidden_args_0[chosen];
+ /* the following code could be improved */
+ type_params = MR_materialize_closure_typeinfos(closure);
+ expand_info->chosen_type_info =
+ MR_create_type_info(type_params,
+ closure_layout->
+ MR_closure_arg_pseudo_type_info[chosen]);
+ if (type_params != NULL) {
+ MR_free(type_params);
+ }
+ } else {
+ expand_info->chosen_index_exists = MR_FALSE;
+ }
+#endif /* EXPAND_CHOSEN_ARG */
+#ifdef EXPAND_NAMED_ARG
+ expand_info->chosen_index_exists = MR_FALSE;
+#endif /* EXPAND_NAMED_ARG */
+ }
+
+ break;
case MR_TYPECTOR_REP_TUPLE:
expand_info->arity = MR_TYPEINFO_GET_TUPLE_ARITY(type_info);
@@ -783,11 +878,79 @@
/* XXX should throw an exception */
MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
": attempt to deconstruct noncanonical term");
- break;
- }
-
+ } else if (noncanon == MR_NONCANON_ALLOW) {
handle_functor_name("<<typeinfo>>");
handle_zero_arity_args();
+ } else {
+ /* the noncanonicality is due to type equivalences */
+
+ MR_TypeInfo data_type_info;
+ MR_TypeCtorInfo data_type_ctor_info;
+ MR_Word *arg_type_infos;
+ int num_args;
+
+ data_type_info = (MR_TypeInfo) *data_word_ptr;
+ data_type_ctor_info =
+ MR_TYPEINFO_GET_TYPE_CTOR_INFO(data_type_info);
+ handle_functor_name(MR_type_ctor_name(data_type_ctor_info));
+
+ if (MR_type_ctor_rep_is_variable_arity(
+ MR_type_ctor_rep(data_type_ctor_info)))
+ {
+ num_args =
+ MR_TYPEINFO_GET_HIGHER_ORDER_ARITY(data_type_info);
+ arg_type_infos = (MR_Word *)
+ MR_TYPEINFO_GET_HIGHER_ORDER_ARG_VECTOR(data_type_info);
+ } else {
+ num_args = data_type_ctor_info->MR_type_ctor_arity;
+ arg_type_infos = (MR_Word *)
+ MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(data_type_info);
+ }
+ expand_info->arity = num_args;
+ /* switch from 1-based to 0-based array indexing */
+ arg_type_infos++;
+
+#ifdef EXPAND_ARGS_FIELD
+ #ifdef EXPAND_APPLY_LIMIT
+ if (num_args > max_arity) {
+ expand_info->limit_reached = MR_TRUE;
+ } else
+ #endif /* EXPAND_APPLY_LIMIT */
+ {
+ int i;
+
+ expand_info->EXPAND_ARGS_FIELD.num_extra_args = 0;
+ expand_info->EXPAND_ARGS_FIELD.arg_values = arg_type_infos;
+
+ expand_info->EXPAND_ARGS_FIELD.arg_type_infos =
+ MR_GC_NEW_ARRAY(MR_TypeInfo, num_args);
+ expand_info->EXPAND_ARGS_FIELD.can_free_arg_type_infos =
+ MR_TRUE;
+ for (i = 0; i < num_args ; i++) {
+ /*
+ ** The arguments of a typeinfo are themselves of type
+ ** ``typeinfo''.
+ */
+ expand_info->EXPAND_ARGS_FIELD.arg_type_infos[i] =
+ type_info;
+ }
+ }
+#endif /* EXPAND_ARGS_FIELD */
+
+#ifdef EXPAND_ONE_ARG
+ if (0 <= chosen && chosen < expand_info->arity) {
+ MR_Word *arg_vector;
+
+ arg_vector = (MR_Word *) *data_word_ptr;
+ expand_info->chosen_index_exists = MR_TRUE;
+ expand_info->chosen_value_ptr = &arg_type_infos[chosen];
+ expand_info->chosen_type_info = type_info;
+ } else {
+ expand_info->chosen_index_exists = MR_FALSE;
+ }
+#endif /* EXPAND_ONE_ARG */
+ }
+
break;
case MR_TYPECTOR_REP_TYPECTORINFO:
@@ -795,11 +958,17 @@
/* XXX should throw an exception */
MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
": attempt to deconstruct noncanonical term");
- break;
- }
-
+ } else if (noncanon == MR_NONCANON_ALLOW) {
handle_functor_name("<<typectorinfo>>");
handle_zero_arity_args();
+ } else {
+ MR_TypeCtorInfo data_type_ctor_info;
+
+ data_type_ctor_info = (MR_TypeCtorInfo) *data_word_ptr;
+ handle_functor_name(MR_type_ctor_name(data_type_ctor_info));
+ handle_zero_arity_args();
+ }
+
break;
case MR_TYPECTOR_REP_TYPECLASSINFO:
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.55
diff -u -b -r1.55 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h 20 Feb 2002 03:14:42 -0000 1.55
+++ runtime/mercury_stack_layout.h 20 Feb 2002 03:52:45 -0000
@@ -924,27 +924,27 @@
*/
typedef struct MR_Closure_Id_Struct {
- MR_Proc_Id proc_id;
- MR_ConstString module_name;
- MR_ConstString file_name;
- MR_Integer line_number;
- MR_ConstString goal_path;
+ MR_Proc_Id MR_closure_proc_id;
+ MR_ConstString MR_closure_module_name;
+ MR_ConstString MR_closure_file_name;
+ MR_Integer MR_closure_line_number;
+ MR_ConstString MR_closure_goal_path;
} MR_Closure_Id;
typedef struct MR_User_Closure_Id_Struct {
- MR_User_Proc_Id proc_id;
- MR_ConstString module_name;
- MR_ConstString file_name;
- MR_Integer line_number;
- MR_ConstString goal_path;
+ MR_User_Proc_Id MR_user_closure_proc_id;
+ MR_ConstString MR_user_closure_module_name;
+ MR_ConstString MR_user_closure_file_name;
+ MR_Integer MR_user_closure_line_number;
+ MR_ConstString MR_user_closure_goal_path;
} MR_User_Closure_Id;
typedef struct MR_Compiler_Closure_Id_Struct {
- MR_Compiler_Proc_Id proc_id;
- MR_ConstString module_name;
- MR_ConstString file_name;
- MR_Integer line_number;
- MR_ConstString goal_path;
+ MR_Compiler_Proc_Id MR_comp_closure_proc_id;
+ MR_ConstString MR_comp_closure_module_name;
+ MR_ConstString MR_comp_closure_file_name;
+ MR_Integer MR_comp_closure_line_number;
+ MR_ConstString MR_comp_closure_goal_path;
} MR_Compiler_Closure_Id;
#endif /* not MERCURY_STACK_LAYOUT_H */
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.46
diff -u -b -r1.46 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c 18 Feb 2002 07:01:19 -0000 1.46
+++ runtime/mercury_stack_trace.c 21 Feb 2002 16:19:31 -0000
@@ -446,8 +446,8 @@
MR_printnondstackptr(topfr);
fprintf(fp, "\n");
}
- (*MR_address_of_trace_browse_all_on_level)(fp,
- label_layout, base_sp, base_curfr, level_number);
+ (*MR_address_of_trace_browse_all_on_level)(fp, label_layout,
+ base_sp, base_curfr, level_number, MR_TRUE);
MR_erase_temp_redoip(fr);
proc_layout = label_layout->MR_sll_entry;
@@ -515,8 +515,8 @@
fprintf(fp, " top frame of a nondet side branch ");
MR_printnondstackptr(fr);
fprintf(fp, "\n");
- (*MR_address_of_trace_browse_all_on_level)(fp,
- label_layout, NULL, fr, level_number);
+ (*MR_address_of_trace_browse_all_on_level)(fp, label_layout,
+ NULL, fr, level_number, MR_TRUE);
MR_erase_temp_redoip(fr);
/*
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.101
diff -u -b -r1.101 mercury_wrapper.c
--- runtime/mercury_wrapper.c 18 Feb 2002 07:01:23 -0000 1.101
+++ runtime/mercury_wrapper.c 20 Feb 2002 06:14:31 -0000
@@ -209,7 +209,7 @@
char *(*MR_address_of_trace_get_command)(const char *, FILE *, FILE *);
const char *
(*MR_address_of_trace_browse_all_on_level)(FILE *,
- const MR_Label_Layout *, MR_Word *, MR_Word *, int);
+ const MR_Label_Layout *, MR_Word *, MR_Word *, int, MR_bool);
#ifdef MR_USE_EXTERNAL_DEBUGGER
void (*MR_address_of_trace_init_external)(void);
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.50
diff -u -b -r1.50 mercury_wrapper.h
--- runtime/mercury_wrapper.h 18 Feb 2002 07:01:24 -0000 1.50
+++ runtime/mercury_wrapper.h 20 Feb 2002 06:14:20 -0000
@@ -126,7 +126,7 @@
extern const char * (*MR_address_of_trace_browse_all_on_level)(FILE *,
const MR_Label_Layout *, MR_Word *, MR_Word *,
- int);
+ int, MR_bool);
/*
** MR_trace_init_external() and MR_trace_final_external() are defined
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.62
diff -u -b -r1.62 Mmakefile
--- tests/debugger/Mmakefile 20 Feb 2002 03:14:44 -0000 1.62
+++ tests/debugger/Mmakefile 20 Feb 2002 03:52:47 -0000
@@ -33,6 +33,7 @@
exception_vars \
existential_type_classes \
field_names \
+ higher_order \
implied_instance \
interpreter \
loopcheck \
@@ -207,6 +208,9 @@
field_names.out: field_names field_names.inp
$(MDB) ./field_names < field_names.inp > field_names.out 2>&1
+
+higher_order.out: higher_order higher_order.inp
+ $(MDB) ./higher_order < higher_order.inp > higher_order.out 2>&1
implied_instance.out: implied_instance implied_instance.inp
$(MDB) ./implied_instance < implied_instance.inp \
Index: tests/debugger/higher_order.exp
===================================================================
RCS file: tests/debugger/higher_order.exp
diff -N tests/debugger/higher_order.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/higher_order.exp 17 Dec 2001 17:06:17 -0000
@@ -0,0 +1,69 @@
+ 1: 1 1 CALL pred higher_order:main/2-0 (det) higher_order.m:12
+mdb> echo on
+Command echo enabled.
+mdb> context none
+Contexts will not be printed.
+mdb> set size 100
+mdb> set depth 100
+mdb> set format flat
+mdb> step
+ 2: 2 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_add2(3.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+mdb> finish
+ 29: 2 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_add2(3.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+ HeadVar__3 [|](4.00000000000000, [|](5.00000000000000, [|](6.00000000000000, [|](7.00000000000000, [|](8.00000000000000, [])))))
+mdb> step
+ 30: 13 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_op3(4.00000000000000, 5.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+mdb> finish
+ 57: 13 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_op3(4.00000000000000, 5.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+ HeadVar__3 [|](9.00000000000000, [|](14.0000000000000, [|](19.0000000000000, [|](24.0000000000000, [|](29.0000000000000, [])))))
+mdb> step
+ 58: 24 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 max(3)
+ HeadVar__2 [1, 2, 3, 4, 5]
+mdb> finish
+ 75: 24 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 max(3)
+ HeadVar__2 [1, 2, 3, 4, 5]
+ HeadVar__3 [3, 3, 3, 4, 5]
+mdb> step
+ 76: 30 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__21__1'([6])
+ HeadVar__2 [[1, 2], [3, 4, 5]]
+mdb> finish
+ 92: 30 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__21__1'([6])
+ HeadVar__2 [[1, 2], [3, 4, 5]]
+ HeadVar__3 [|]([|](6, [|](1, [|](2, []))), [|]([|](6, [|](3, [|](4, [|](5, [])))), []))
+mdb> step
+ 93: 37 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__22__2'(["a"])
+ HeadVar__2 [|]([|]("one", [|]("two", [])), [|]([|]("three", [|]("four", [|]("five", []))), []))
+mdb> finish
+ 109: 37 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__22__2'(["a"])
+ HeadVar__2 [|]([|]("one", [|]("two", [])), [|]([|]("three", [|]("four", [|]("five", []))), []))
+ HeadVar__3 [|]([|]("a", [|]("one", [|]("two", []))), [|]([|]("a", [|]("three", [|]("four", [|]("five", [])))), []))
+mdb> continue -S
+[4.00000000000000, 5.00000000000000, 6.00000000000000, 7.00000000000000, 8.00000000000000]
+[9.00000000000000, 14.0000000000000, 19.0000000000000, 24.0000000000000, 29.0000000000000]
+[3, 3, 3, 4, 5]
+[[6, 1, 2], [6, 3, 4, 5]]
+[["a", "one", "two"], ["a", "three", "four", "five"]]
Index: tests/debugger/higher_order.exp2
===================================================================
RCS file: tests/debugger/higher_order.exp2
diff -N tests/debugger/higher_order.exp2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/higher_order.exp2 18 Dec 2001 13:37:20 -0000
@@ -0,0 +1,69 @@
+ 1: 1 1 CALL pred higher_order:main/2-0 (det) higher_order.m:12
+mdb> echo on
+Command echo enabled.
+mdb> context none
+Contexts will not be printed.
+mdb> set size 100
+mdb> set depth 100
+mdb> set format flat
+mdb> step
+ 2: 2 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_add2(3.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+mdb> finish
+ 29: 2 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_add2(3.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+ HeadVar__3 [|](4.00000000000000, [|](5.00000000000000, [|](6.00000000000000, [|](7.00000000000000, [|](8.00000000000000, [])))))
+mdb> step
+ 30: 13 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_op3(4.00000000000000, 5.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+mdb> finish
+ 57: 13 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 float_op3(4.00000000000000, 5.00000000000000)
+ HeadVar__2 [|](1.00000000000000, [|](2.00000000000000, [|](3.00000000000000, [|](4.00000000000000, [|](5.00000000000000, [])))))
+ HeadVar__3 [|](9.00000000000000, [|](14.0000000000000, [|](19.0000000000000, [|](24.0000000000000, [|](29.0000000000000, [])))))
+mdb> step
+ 58: 24 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 max(3)
+ HeadVar__2 [1, 2, 3, 4, 5]
+mdb> finish
+ 85: 24 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 max(3)
+ HeadVar__2 [1, 2, 3, 4, 5]
+ HeadVar__3 [3, 3, 3, 4, 5]
+mdb> step
+ 86: 35 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__21__1'([6])
+ HeadVar__2 [[1, 2], [3, 4, 5]]
+mdb> finish
+ 106: 35 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__21__1'([6])
+ HeadVar__2 [[1, 2], [3, 4, 5]]
+ HeadVar__3 [|]([|](6, [|](1, [|](2, []))), [|]([|](6, [|](3, [|](4, [|](5, [])))), []))
+mdb> step
+ 107: 44 2 CALL pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__22__2'(["a"])
+ HeadVar__2 [|]([|]("one", [|]("two", [])), [|]([|]("three", [|]("four", [|]("five", []))), []))
+mdb> finish
+ 127: 44 2 EXIT pred higher_order:domap/3-0 (det)
+mdb> print *
+ HeadVar__1 'IntroducedFrom__pred__main__22__2'(["a"])
+ HeadVar__2 [|]([|]("one", [|]("two", [])), [|]([|]("three", [|]("four", [|]("five", []))), []))
+ HeadVar__3 [|]([|]("a", [|]("one", [|]("two", []))), [|]([|]("a", [|]("three", [|]("four", [|]("five", [])))), []))
+mdb> continue -S
+[4.00000000000000, 5.00000000000000, 6.00000000000000, 7.00000000000000, 8.00000000000000]
+[9.00000000000000, 14.0000000000000, 19.0000000000000, 24.0000000000000, 29.0000000000000]
+[3, 3, 3, 4, 5]
+[[6, 1, 2], [6, 3, 4, 5]]
+[["a", "one", "two"], ["a", "three", "four", "five"]]
Index: tests/debugger/higher_order.inp
===================================================================
RCS file: tests/debugger/higher_order.inp
diff -N tests/debugger/higher_order.inp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/higher_order.inp 17 Dec 2001 17:04:09 -0000
@@ -0,0 +1,26 @@
+echo on
+context none
+set size 100
+set depth 100
+set format flat
+step
+print *
+finish
+print *
+step
+print *
+finish
+print *
+step
+print *
+finish
+print *
+step
+print *
+finish
+print *
+step
+print *
+finish
+print *
+continue -S
Index: tests/debugger/higher_order.m
===================================================================
RCS file: tests/debugger/higher_order.m
diff -N tests/debugger/higher_order.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/debugger/higher_order.m 17 Dec 2001 17:05:17 -0000
@@ -0,0 +1,49 @@
+:- module higher_order.
+
+:- interface.
+:- import_module io.
+
+:- pred main(io__state::di, state::uo) is det.
+
+:- implementation.
+
+:- import_module int, float, list.
+
+main -->
+ { IntIn = [1, 2, 3, 4, 5] },
+ { FloatIn = [1.0, 2.0, 3.0, 4.0, 5.0] },
+ { IntListIn = [[1, 2], [3, 4, 5]] },
+ { StringListIn = [["one", "two"], ["three", "four", "five"]] },
+
+ { domap(float_add2(3.0), FloatIn, FloatAdd2Out) },
+ { domap(float_op3(4.0, 5.0), FloatIn, FloatOp3Out) },
+ { domap(int__max(3), IntIn, IntMaxOut) },
+ { domap(do_append([6]), IntListIn, IntAppendOut) },
+ { domap(do_append(["a"]), StringListIn, StringAppendOut) },
+
+ io__write(FloatAdd2Out), nl,
+ io__write(FloatOp3Out), nl,
+ io__write(IntMaxOut), nl,
+ io__write(IntAppendOut), nl,
+ io__write(StringAppendOut), nl.
+
+:- pred domap(pred(X, Y), list(X), list(Y)).
+:- mode domap(pred(in, out) is det, in, out) is det.
+
+domap(_, [], []).
+domap(P, [H0 | T0], [H | T]) :-
+ P(H0, H),
+ domap(P, T0, T).
+
+:- pred float_add2(float::in, float::in, float::out) is det.
+
+float_add2(A, B, A + B).
+
+:- pred float_op3(float::in, float::in, float::in, float::out) is det.
+
+float_op3(A, B, C, A + B * C).
+
+:- pred do_append(list(T)::in, list(T)::in, list(T)::out) is det.
+
+do_append(A, B, C) :-
+ list__append(A, B, C).
Index: tests/debugger/nondet_stack.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/nondet_stack.exp,v
retrieving revision 1.1
diff -u -b -r1.1 nondet_stack.exp
--- tests/debugger/nondet_stack.exp 4 Dec 2001 00:44:37 -0000 1.1
+++ tests/debugger/nondet_stack.exp 21 Feb 2002 07:01:34 -0000
@@ -86,6 +86,7 @@
succfr: non 103
on main nondet branch non 135
HeadVar__1 [4, 5]
+ TypeInfo_for_T int
non 122: temp
redoip: label UNKNOWN
redofr: non 116
@@ -99,6 +100,7 @@
succfr: non 103
top frame of a nondet side branch non 116
HeadVar__2 [3, 4, 5]
+ TypeInfo_for_T int
non 103: ordinary, 13 words
redoip: unnamed label
redofr: non 103
@@ -106,6 +108,7 @@
succfr: non 71
on main nondet branch non 135
HeadVar__1 [3, 4, 5]
+ TypeInfo_for_T int
U 3
Z [4, 5]
non 90: temp
@@ -121,6 +124,7 @@
succfr: non 71
top frame of a nondet side branch non 84
HeadVar__2 [2, 3, 4, 5]
+ TypeInfo_for_T int
non 71: ordinary, 13 words
redoip: unnamed label
redofr: non 71
@@ -128,6 +132,7 @@
succfr: non 39
on main nondet branch non 135
HeadVar__1 [2, 3, 4, 5]
+ TypeInfo_for_T int
U 2
Z [3, 4, 5]
non 58: temp
@@ -143,6 +148,7 @@
succfr: non 39
top frame of a nondet side branch non 52
HeadVar__2 [1, 2, 3, 4, 5]
+ TypeInfo_for_T int
non 39: ordinary, 13 words
redoip: unnamed label
redofr: non 39
@@ -150,6 +156,7 @@
succfr: non 26
on main nondet branch non 135
HeadVar__1 [1, 2, 3, 4, 5]
+ TypeInfo_for_T int
U 1
Z [2, 3, 4, 5]
non 26: ordinary, 12 words
@@ -159,6 +166,7 @@
succfr: non 10
on main nondet branch non 135
HeadVar__1 [1, 2, 3, 4, 5]
+ TypeInfo_5 int
non 14: temp
redoip: label UNKNOWN
redofr: non 10
@@ -318,6 +326,7 @@
succfr: non 167
top frame of a nondet side branch non 199
HeadVar__1 []
+ TypeInfo_for_T int
non 186: temp
redoip: label UNKNOWN
redofr: non 180
@@ -331,6 +340,7 @@
succfr: non 167
top frame of a nondet side branch non 180
HeadVar__2 [5]
+ TypeInfo_for_T int
non 167: ordinary, 13 words
redoip: unnamed label
redofr: non 167
@@ -338,6 +348,7 @@
succfr: non 135
internal frame on nondet side branch non 199
HeadVar__1 [5]
+ TypeInfo_for_T int
U 5
Z []
non 154: temp
@@ -353,6 +364,7 @@
succfr: non 135
top frame of a nondet side branch non 148
HeadVar__2 [4, 5]
+ TypeInfo_for_T int
non 135: ordinary, 13 words
redoip: unnamed label
redofr: non 135
@@ -360,6 +372,7 @@
succfr: non 103
internal frame on nondet side branch non 199
HeadVar__1 [4, 5]
+ TypeInfo_for_T int
U 4
Z [5]
non 122: temp
@@ -375,6 +388,7 @@
succfr: non 103
top frame of a nondet side branch non 116
HeadVar__2 [3, 4, 5]
+ TypeInfo_for_T int
non 103: ordinary, 13 words
redoip: unnamed label
redofr: non 103
@@ -382,6 +396,7 @@
succfr: non 71
internal frame on nondet side branch non 199
HeadVar__1 [3, 4, 5]
+ TypeInfo_for_T int
U 3
Z [4, 5]
non 90: temp
@@ -397,6 +412,7 @@
succfr: non 71
top frame of a nondet side branch non 84
HeadVar__2 [2, 3, 4, 5]
+ TypeInfo_for_T int
non 71: ordinary, 13 words
redoip: unnamed label
redofr: non 71
@@ -404,6 +420,7 @@
succfr: non 39
internal frame on nondet side branch non 199
HeadVar__1 [2, 3, 4, 5]
+ TypeInfo_for_T int
U 2
Z [3, 4, 5]
non 58: temp
@@ -419,6 +436,7 @@
succfr: non 39
top frame of a nondet side branch non 52
HeadVar__2 [1, 2, 3, 4, 5]
+ TypeInfo_for_T int
non 39: ordinary, 13 words
redoip: unnamed label
redofr: non 39
@@ -426,6 +444,7 @@
succfr: non 26
internal frame on nondet side branch non 199
HeadVar__1 [1, 2, 3, 4, 5]
+ TypeInfo_for_T int
U 1
Z [2, 3, 4, 5]
non 26: ordinary, 12 words
@@ -646,6 +665,7 @@
succfr: non 215
top frame of a nondet side branch non 247
HeadVar__1 []
+ TypeInfo_for_T int
non 234: temp
redoip: label UNKNOWN
redofr: non 228
@@ -659,6 +679,7 @@
succfr: non 215
top frame of a nondet side branch non 228
HeadVar__2 [4]
+ TypeInfo_for_T int
non 215: ordinary, 13 words
redoip: unnamed label
redofr: non 215
@@ -666,6 +687,7 @@
succfr: non 183
internal frame on nondet side branch non 247
HeadVar__1 [4]
+ TypeInfo_for_T int
U 4
Z []
non 202: temp
@@ -681,6 +703,7 @@
succfr: non 183
top frame of a nondet side branch non 196
HeadVar__2 [2, 4]
+ TypeInfo_for_T int
non 183: ordinary, 13 words
redoip: unnamed label
redofr: non 183
@@ -688,6 +711,7 @@
succfr: non 119
internal frame on nondet side branch non 247
HeadVar__1 [2, 4]
+ TypeInfo_for_T int
U 2
Z [4]
non 170: temp
@@ -709,6 +733,7 @@
succfr: non 145
top frame of a nondet side branch non 158
HeadVar__2 [5]
+ TypeInfo_for_T int
non 145: ordinary, 13 words
redoip: unnamed label
redofr: non 145
@@ -716,6 +741,7 @@
succfr: non 132
internal frame on nondet side branch non 158
HeadVar__2 [4, 5]
+ TypeInfo_for_T int
non 132: ordinary, 13 words
redoip: unnamed label
redofr: non 132
@@ -723,6 +749,7 @@
succfr: non 119
internal frame on nondet side branch non 158
HeadVar__2 [2, 4, 5]
+ TypeInfo_for_T int
non 119: ordinary, 13 words
redoip: unnamed label
redofr: non 119
@@ -730,6 +757,7 @@
succfr: non 71
internal frame on nondet side branch non 247
HeadVar__1 [2, 4, 5]
+ TypeInfo_for_T int
U 5
Z [2, 4]
non 106: temp
@@ -748,6 +776,7 @@
succfr: non 84
top frame of a nondet side branch non 97
HeadVar__2 [3, 4, 5]
+ TypeInfo_for_T int
non 84: ordinary, 13 words
redoip: unnamed label
redofr: non 84
@@ -755,6 +784,7 @@
succfr: non 71
internal frame on nondet side branch non 97
HeadVar__2 [2, 3, 4, 5]
+ TypeInfo_for_T int
non 71: ordinary, 13 words
redoip: unnamed label
redofr: non 71
@@ -762,6 +792,7 @@
succfr: non 39
internal frame on nondet side branch non 247
HeadVar__1 [2, 3, 4, 5]
+ TypeInfo_for_T int
U 3
Z [2, 4, 5]
non 58: temp
@@ -777,6 +808,7 @@
succfr: non 39
top frame of a nondet side branch non 52
HeadVar__2 [1, 2, 3, 4, 5]
+ TypeInfo_for_T int
non 39: ordinary, 13 words
redoip: unnamed label
redofr: non 39
@@ -784,6 +816,7 @@
succfr: non 26
internal frame on nondet side branch non 247
HeadVar__1 [1, 2, 3, 4, 5]
+ TypeInfo_for_T int
U 1
Z [2, 3, 4, 5]
non 26: ordinary, 12 words
@@ -793,6 +826,7 @@
succfr: non 10
internal frame on nondet side branch non 247
HeadVar__1 [1, 2, 3, 4, 5]
+ TypeInfo_5 int
non 14: temp
redoip: label UNKNOWN
redofr: non 10
Index: tests/debugger/tabled_read_decl.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/tabled_read_decl.exp,v
retrieving revision 1.1
diff -u -b -r1.1 tabled_read_decl.exp
--- tests/debugger/tabled_read_decl.exp 20 Feb 2002 03:14:46 -0000 1.1
+++ tests/debugger/tabled_read_decl.exp 21 Feb 2002 07:02:16 -0000
@@ -87,13 +87,13 @@
mdb> print action 4
read_char_code('<<c_pointer>>', 10)
mdb> print action 5
-poly_read_char_code(<<typeinfo>>, <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 52)
+poly_read_char_code(list(character), <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 52)
mdb> print action 6
-poly_read_char_code(<<typeinfo>>, <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 53)
+poly_read_char_code(list(character), <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 53)
mdb> print action 7
-poly_read_char_code(<<typeinfo>>, <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 54)
+poly_read_char_code(list(character), <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 54)
mdb> print action 8
-poly_read_char_code(<<typeinfo>>, <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 10)
+poly_read_char_code(list(character), <<c_pointer>>, [|]('a', [|]('b', [|]/2)), 10)
mdb> print action 9
mdb: I/O action number not in range.
mdb> continue -S
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
Index: tests/hard_coded/deconstruct_arg.exp
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/deconstruct_arg.exp,v
retrieving revision 1.2
diff -u -b -r1.2 deconstruct_arg.exp
--- tests/hard_coded/deconstruct_arg.exp 4 Feb 2002 05:23:06 -0000 1.2
+++ tests/hard_coded/deconstruct_arg.exp 21 Feb 2002 07:06:41 -0000
@@ -203,7 +203,7 @@
functor set_rep arity 1 [[1, 2, 3, 3]]
std_util functor: <<predicate>>/0
-deconstruct functor: <<predicate>>/0
+deconstruct functor: newline/0
std_util argument 0 of '<<predicate>>' doesn't exist
deconstruct argument 0 of '<<predicate>>' doesn't exist
std_util argument 1 of '<<predicate>>' doesn't exist
@@ -212,12 +212,29 @@
deconstruct argument 2 of '<<predicate>>' doesn't exist
std_util deconstruct: functor <<predicate>> arity 0
[]
-deconstruct deconstruct: functor <<predicate>> arity 0
+deconstruct deconstruct: functor newline arity 0
[]
std_util limited deconstruct 3 of '<<predicate>>'
functor <<predicate>> arity 0 []
deconstruct limited deconstruct 3 of '<<predicate>>'
+functor newline arity 0 []
+
+std_util functor: <<predicate>>/0
+deconstruct functor: IntroducedFrom__pred__main__85__1/1
+std_util argument 0 of '<<predicate>>' doesn't exist
+deconstruct argument 0 of '<<predicate>>' is [1, 2]
+std_util argument 1 of '<<predicate>>' doesn't exist
+deconstruct argument 1 of '<<predicate>>' doesn't exist
+std_util argument 2 of '<<predicate>>' doesn't exist
+deconstruct argument 2 of '<<predicate>>' doesn't exist
+std_util deconstruct: functor <<predicate>> arity 0
+[]
+deconstruct deconstruct: functor IntroducedFrom__pred__main__85__1 arity 1
+[[1, 2]]
+std_util limited deconstruct 3 of '<<predicate>>'
functor <<predicate>> arity 0 []
+deconstruct limited deconstruct 3 of '<<predicate>>'
+functor IntroducedFrom__pred__main__85__1 arity 1 [[1, 2]]
std_util functor: {}/2
deconstruct functor: {}/2
Index: tests/hard_coded/deconstruct_arg.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/deconstruct_arg.m,v
retrieving revision 1.2
diff -u -b -r1.2 deconstruct_arg.m
--- tests/hard_coded/deconstruct_arg.m 4 Feb 2002 05:23:07 -0000 1.2
+++ tests/hard_coded/deconstruct_arg.m 21 Feb 2002 07:06:16 -0000
@@ -82,6 +82,7 @@
test_all(set([1,2,3,3])), newline,
% test predicates
test_all(newline), newline,
+ test_all(test_all([1, 2])), newline,
% test tuples
test_all({1, 'b'}), newline,
test_all({1, 'b', "third"}), newline,
Index: tests/hard_coded/write_reg1.exp
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/write_reg1.exp,v
retrieving revision 1.6
diff -u -b -r1.6 write_reg1.exp
--- tests/hard_coded/write_reg1.exp 13 Jan 2001 02:30:31 -0000 1.6
+++ tests/hard_coded/write_reg1.exp 21 Feb 2002 06:57:16 -0000
@@ -29,6 +29,7 @@
4
univ_cons(["hi! I\'m a univ!"])
'<<predicate>>'
+newline
TESTING OTHER TYPES
var(1)
Index: tests/hard_coded/write_reg1.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/write_reg1.m,v
retrieving revision 1.1
diff -u -b -r1.1 write_reg1.m
--- tests/hard_coded/write_reg1.m 14 Jan 1997 01:36:24 -0000 1.1
+++ tests/hard_coded/write_reg1.m 21 Feb 2002 06:18:59 -0000
@@ -15,19 +15,19 @@
:- interface.
:- import_module io.
-:- pred main(io__state::di, io__state::uo) is det.
+:- pred main(io__state::di, io__state::uo) is cc_multi.
:- implementation.
-:- import_module list, int, std_util, term, map.
+:- import_module list, int, std_util, term, map, deconstruct.
-:- pred test_builtins(io__state::di, io__state::uo) is det.
+:- pred test_builtins(io__output_stream::in, io__state::di, io__state::uo)
+ is cc_multi.
:- pred test_discriminated(io__state::di, io__state::uo) is det.
:- pred test_polymorphism(io__state::di, io__state::uo) is det.
:- pred test_other(io__state::di, io__state::uo) is det.
:- pred newline(io__state::di, io__state::uo) is det.
-
:- type enum ---> one ; two ; three.
:- type fruit ---> apple(list(int))
@@ -48,10 +48,9 @@
io__set_output_stream(StdErr, _StdOut),
test_discriminated,
test_polymorphism,
- test_builtins,
+ test_builtins(StdErr),
test_other.
-
test_discriminated -->
io__write_string("TESTING DISCRIMINATED UNIONS\n"),
@@ -83,8 +82,7 @@
newline.
-
-test_builtins -->
+test_builtins(StdErr) -->
io__write_string("TESTING BUILTINS\n"),
% test strings
@@ -112,10 +110,10 @@
% test predicates
io__write(newline), newline,
+ io__write(StdErr, include_details_cc, newline), newline,
newline.
-
% Note: testing abstract types is always going to have results
% that are dependent on the implementation. If someone changes
% the implementation, the results of this test can change.
@@ -140,5 +138,4 @@
newline -->
io__write_char('\n').
-
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/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.48
diff -u -b -r1.48 mercury_trace.c
--- trace/mercury_trace.c 20 Feb 2002 03:14:48 -0000 1.48
+++ trace/mercury_trace.c 21 Feb 2002 16:20:18 -0000
@@ -193,12 +193,14 @@
->MR_ml_string_table + layout->MR_sll_goal_path;
MR_copy_regs_to_saved_regs(event_info.MR_max_mr_num,
saved_regs);
- MR_trace_init_point_vars(layout, saved_regs, port);
+ MR_trace_init_point_vars(layout, saved_regs, port,
+ MR_FALSE);
lineno = MR_get_line_number(saved_regs, layout, port);
MR_COLLECT_filter(MR_trace_ctrl.MR_filter_ptr, seqno,
- depth, port, layout, path, lineno, &stop_collecting);
+ depth, port, layout, path, lineno,
+ &stop_collecting);
MR_copy_saved_regs_to_regs(event_info.MR_max_mr_num,
saved_regs);
if (stop_collecting) {
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.46
diff -u -b -r1.46 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c 18 Feb 2002 07:01:29 -0000 1.46
+++ trace/mercury_trace_declarative.c 21 Feb 2002 16:20:45 -0000
@@ -1052,7 +1052,7 @@
MR_TypeInfoParams type_params;
const MR_Proc_Layout *entry = layout->MR_sll_entry;
- MR_trace_init_point_vars(layout, saved_regs, port);
+ MR_trace_init_point_vars(layout, saved_regs, port, MR_FALSE);
name = MR_decl_atom_name(entry);
if (MR_PROC_LAYOUT_COMPILER_GENERATED(layout->MR_sll_entry)) {
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.63
diff -u -b -r1.63 mercury_trace_external.c
--- trace/mercury_trace_external.c 18 Feb 2002 07:01:29 -0000 1.63
+++ trace/mercury_trace_external.c 21 Feb 2002 16:20:53 -0000
@@ -523,7 +523,8 @@
event_details.MR_event_number = MR_trace_event_number;
MR_trace_init_point_vars(event_info->MR_event_sll,
- event_info->MR_saved_regs, event_info->MR_trace_port);
+ event_info->MR_saved_regs, event_info->MR_trace_port,
+ MR_FALSE);
switch(external_debugger_mode) {
case MR_searching:
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.116
diff -u -b -r1.116 mercury_trace_internal.c
--- trace/mercury_trace_internal.c 21 Feb 2002 01:53:29 -0000 1.116
+++ trace/mercury_trace_internal.c 21 Feb 2002 16:22:34 -0000
@@ -255,7 +255,7 @@
static void MR_trace_do_noop(void);
static void MR_trace_set_level_and_report(int ancestor_level,
- MR_bool detailed);
+ MR_bool detailed, MR_bool print_optionals);
static void MR_trace_browse_internal(MR_Word type_info, MR_Word value,
MR_Browse_Caller_Type caller, MR_Browse_Format format);
static void MR_trace_browse_goal_internal(MR_ConstString name,
@@ -285,6 +285,8 @@
MR_bool MR_saved_io_tabling_enabled;
+MR_bool MR_print_optionals = MR_FALSE;
+
MR_Code *
MR_trace_event_internal(MR_Trace_Cmd_Info *cmd, MR_bool interactive,
MR_Event_Info *event_info)
@@ -336,7 +338,8 @@
event_details.MR_event_number = MR_trace_event_number;
MR_trace_init_point_vars(event_info->MR_event_sll,
- event_info->MR_saved_regs, event_info->MR_trace_port);
+ event_info->MR_saved_regs, event_info->MR_trace_port,
+ MR_print_optionals);
/* by default, return where we came from */
jumpaddr = NULL;
@@ -731,7 +734,8 @@
}
static void
-MR_trace_set_level_and_report(int ancestor_level, MR_bool detailed)
+MR_trace_set_level_and_report(int ancestor_level, MR_bool detailed,
+ MR_bool print_optionals)
{
const char *problem;
const MR_Proc_Layout *entry;
@@ -741,7 +745,7 @@
int lineno;
int indent;
- problem = MR_trace_set_level(ancestor_level);
+ problem = MR_trace_set_level(ancestor_level, print_optionals);
if (problem == NULL) {
fprintf(MR_mdb_out, "Ancestor level set to %d:\n",
ancestor_level);
@@ -1297,7 +1301,8 @@
} else if (word_count == 2 &&
MR_trace_is_number(words[1], &n))
{
- MR_trace_set_level_and_report(n, detailed);
+ MR_trace_set_level_and_report(n, detailed,
+ MR_print_optionals);
} else {
MR_trace_usage("browsing", "level");
}
@@ -1314,10 +1319,12 @@
MR_trace_is_number(words[1], &n))
{
MR_trace_set_level_and_report(
- MR_trace_current_level() + n, detailed);
+ MR_trace_current_level() + n, detailed,
+ MR_print_optionals);
} else if (word_count == 1) {
MR_trace_set_level_and_report(
- MR_trace_current_level() + 1, detailed);
+ MR_trace_current_level() + 1, detailed,
+ MR_print_optionals);
} else {
MR_trace_usage("browsing", "up");
}
@@ -1334,10 +1341,12 @@
MR_trace_is_number(words[1], &n))
{
MR_trace_set_level_and_report(
- MR_trace_current_level() - n, detailed);
+ MR_trace_current_level() - n, detailed,
+ MR_print_optionals);
} else if (word_count == 1) {
MR_trace_set_level_and_report(
- MR_trace_current_level() - 1, detailed);
+ MR_trace_current_level() - 1, detailed,
+ MR_print_optionals);
} else {
MR_trace_usage("browsing", "down");
}
@@ -2406,7 +2415,8 @@
layout,
MR_saved_sp(saved_regs),
MR_saved_curfr(saved_regs));
- MR_trace_set_level(saved_level);
+ MR_trace_set_level(saved_level,
+ MR_print_optionals);
} else {
MR_dump_nondet_stack(MR_mdb_out,
MR_saved_maxfr(saved_regs));
@@ -2553,8 +2563,20 @@
MR_proc_layout_stats(fp);
(void) fclose(fp);
} else {
- MR_trace_usage("developer", "label_stats");
+ MR_trace_usage("developer", "proc_stats");
+ }
+ } else if (MR_streq(words[0], "print_optionals")) {
+ if (word_count == 2 && streq(words[1], "off")) {
+ MR_print_optionals = MR_FALSE;
+ } else if (word_count == 2 && streq(words[1], "on")) {
+ MR_print_optionals = MR_TRUE;
+ } else if (word_count != 1)
+ MR_trace_usage("developer", "print_optionals");
}
+
+ fprintf(MR_mdb_out,
+ "optional values are %s being printed\n",
+ MR_print_optionals? "" : "not");
} else if (MR_streq(words[0], "source")) {
MR_bool ignore_errors;
@@ -4032,6 +4054,8 @@
{ "developer", "table_io" },
{ "developer", "proc_stats" },
{ "developer", "label_stats" },
+ { "developer", "proc_stats" },
+ { "developer", "print_optionals" },
{ "misc", "source" },
{ "misc", "save" },
{ "misc", "quit" },
Index: trace/mercury_trace_vars.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.36
diff -u -b -r1.36 mercury_trace_vars.c
--- trace/mercury_trace_vars.c 20 Feb 2002 03:14:50 -0000 1.36
+++ trace/mercury_trace_vars.c 21 Feb 2002 16:16:17 -0000
@@ -108,7 +108,8 @@
} MR_Point;
static MR_bool MR_trace_type_is_ignored(
- MR_PseudoTypeInfo pseudo_type_info);
+ MR_PseudoTypeInfo pseudo_type_info,
+ MR_bool print_optionals);
static int MR_trace_compare_var_details(const void *arg1,
const void *arg2);
static void MR_generate_proc_name_from_layout(const MR_Proc_Layout
@@ -180,22 +181,14 @@
#endif
static MR_TypeCtorInfo
-MR_trace_ignored_type_ctors[] =
+MR_trace_always_ignored_type_ctors[] =
{
- /* we ignore these until the debugger can handle their varying arity */
#ifndef MR_HIGHLEVEL_CODE
- &mercury_data_private_builtin__type_ctor_info_type_info_1,
- &mercury_data_private_builtin__type_ctor_info_type_ctor_info_1,
- &mercury_data_private_builtin__type_ctor_info_typeclass_info_1,
- &mercury_data_private_builtin__type_ctor_info_base_typeclass_info_1,
- &mercury_data_std_util__type_ctor_info_type_desc_0,
- &mercury_data_std_util__type_ctor_info_type_ctor_desc_0,
+ /* we ignore these until the debugger can handle their varying arity */
&mercury_data_type_desc__type_ctor_info_type_desc_0,
&mercury_data_type_desc__type_ctor_info_type_ctor_desc_0,
-
- /* we ignore these until the debugger can print higher-order terms */
- &mercury_data___type_ctor_info_func_0,
- &mercury_data___type_ctor_info_pred_0,
+ &mercury_data_private_builtin__type_ctor_info_typeclass_info_1,
+ &mercury_data_private_builtin__type_ctor_info_base_typeclass_info_1,
/* we ignore these because they should never be needed */
&mercury_data___type_ctor_info_void_0,
@@ -214,11 +207,28 @@
NULL
};
+static MR_TypeCtorInfo
+MR_trace_maybe_ignored_type_ctors[] =
+{
+#ifndef MR_HIGHLEVEL_CODE
+ /*
+ ** We can print values of these types (after a fashion),
+ ** but users are usually not interested in their values.
+ */
+ &mercury_data_private_builtin__type_ctor_info_type_info_1,
+ &mercury_data_private_builtin__type_ctor_info_type_ctor_info_1,
+#endif
+ /* dummy member */
+ NULL
+};
+
static MR_bool
-MR_trace_type_is_ignored(MR_PseudoTypeInfo pseudo_type_info)
+MR_trace_type_is_ignored(MR_PseudoTypeInfo pseudo_type_info,
+ MR_bool print_optionals)
{
MR_TypeCtorInfo type_ctor_info;
- int ignore_type_ctor_count;
+ int always_ignore_type_ctor_count;
+ int maybe_ignore_type_ctor_count;
int i;
if (MR_PSEUDO_TYPEINFO_IS_VARIABLE(pseudo_type_info)) {
@@ -227,11 +237,24 @@
type_ctor_info =
MR_PSEUDO_TYPEINFO_GET_TYPE_CTOR_INFO(pseudo_type_info);
- ignore_type_ctor_count =
- sizeof(MR_trace_ignored_type_ctors) / sizeof(MR_Word *);
+ always_ignore_type_ctor_count =
+ sizeof(MR_trace_always_ignored_type_ctors) / sizeof(MR_Word *);
- for (i = 0; i < ignore_type_ctor_count; i++) {
- if (type_ctor_info == MR_trace_ignored_type_ctors[i]) {
+ for (i = 0; i < always_ignore_type_ctor_count; i++) {
+ if (type_ctor_info == MR_trace_always_ignored_type_ctors[i]) {
+ return MR_TRUE;
+ }
+ }
+
+ if (print_optionals) {
+ return MR_FALSE;
+ }
+
+ maybe_ignore_type_ctor_count =
+ sizeof(MR_trace_maybe_ignored_type_ctors) / sizeof(MR_Word *);
+
+ for (i = 0; i < maybe_ignore_type_ctor_count; i++) {
+ if (type_ctor_info == MR_trace_maybe_ignored_type_ctors[i]) {
return MR_TRUE;
}
}
@@ -241,17 +264,17 @@
void
MR_trace_init_point_vars(const MR_Label_Layout *top_layout,
- MR_Word *saved_regs, MR_Trace_Port port)
+ MR_Word *saved_regs, MR_Trace_Port port, MR_bool print_optionals)
{
MR_point.MR_point_top_layout = top_layout;
MR_point.MR_point_top_saved_regs = saved_regs;
MR_point.MR_point_top_port = port;
MR_point.MR_point_level = 0;
- MR_point.MR_point_problem = MR_trace_set_level(0);
+ MR_point.MR_point_problem = MR_trace_set_level(0, print_optionals);
}
const char *
-MR_trace_set_level(int ancestor_level)
+MR_trace_set_level(int ancestor_level, MR_bool print_optionals)
{
const char *problem;
MR_Word *base_sp;
@@ -268,7 +291,7 @@
if (level_layout != NULL) {
return MR_trace_set_level_from_layout(level_layout,
- base_sp, base_curfr, ancestor_level);
+ base_sp, base_curfr, ancestor_level, print_optionals);
} else {
if (problem == NULL) {
MR_fatal_error("MR_find_nth_ancestor failed "
@@ -281,7 +304,8 @@
const char *
MR_trace_set_level_from_layout(const MR_Label_Layout *level_layout,
- MR_Word *base_sp, MR_Word *base_curfr, int ancestor_level)
+ MR_Word *base_sp, MR_Word *base_curfr, int ancestor_level,
+ MR_bool print_optionals)
{
const MR_Proc_Layout *entry;
MR_Word *valid_saved_regs;
@@ -407,7 +431,9 @@
}
pseudo_type_info = MR_var_pti(level_layout, i);
- if (MR_trace_type_is_ignored(pseudo_type_info)) {
+ if (MR_trace_type_is_ignored(pseudo_type_info,
+ print_optionals))
+ {
continue;
}
@@ -1018,12 +1044,13 @@
const char *
MR_trace_browse_all_on_level(FILE *out, const MR_Label_Layout *level_layout,
- MR_Word *base_sp, MR_Word *base_curfr, int ancestor_level)
+ MR_Word *base_sp, MR_Word *base_curfr, int ancestor_level,
+ MR_bool print_optionals)
{
const char *problem;
problem = MR_trace_set_level_from_layout(level_layout,
- base_sp, base_curfr, ancestor_level);
+ base_sp, base_curfr, ancestor_level, print_optionals);
if (problem != NULL) {
return problem;
}
Index: trace/mercury_trace_vars.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.h,v
retrieving revision 1.16
diff -u -b -r1.16 mercury_trace_vars.h
--- trace/mercury_trace_vars.h 20 Feb 2002 03:14:51 -0000 1.16
+++ trace/mercury_trace_vars.h 21 Feb 2002 16:17:36 -0000
@@ -18,6 +18,13 @@
** MR_trace_current_level returns this information, while enquiry function
** MR_trace_current_level_details returns information about this level.
**
+** The debugger partitions the variables at a program point into three sets
+** based on their type: those which are always printed, those which are always
+** ignored (saved succips, void variables etc), and those which are optionally
+** printed (typeinfos and typeclassinfos). The print_optionals argument of
+** the following functions should be MR_TRUE iff you wish to print variables
+** in the third set.
+**
** The functions MR_trace_var_count, MR_trace_list_vars,
** MR_trace_return_var_info, MR_trace_headvar_num, MR_trace_parse_browse_one,
** MR_trace_browse_one and MR_trace_browse_all all work in the context
@@ -50,7 +57,6 @@
MR_Word is_func, MR_Browse_Caller_Type caller,
MR_Browse_Format format);
-
typedef enum {
MR_VAR_SPEC_NUMBER,
MR_VAR_SPEC_NAME
@@ -64,12 +70,14 @@
extern void MR_trace_init_point_vars(
const MR_Label_Layout *top_layout,
- MR_Word *saved_regs, MR_Trace_Port port);
-extern const char *MR_trace_set_level(int ancestor_level);
+ MR_Word *saved_regs, MR_Trace_Port port,
+ MR_bool print_optionals);
+extern const char *MR_trace_set_level(int ancestor_level,
+ MR_bool print_optionals);
extern const char *MR_trace_set_level_from_layout(
const MR_Label_Layout *level_layout,
MR_Word *base_sp, MR_Word *base_curfr,
- int ancestor_level);
+ int ancestor_level, MR_bool print_optionals);
extern int MR_trace_current_level(void);
extern void MR_trace_current_level_details(
const MR_Proc_Layout **entry_ptr,
@@ -182,6 +190,6 @@
extern const char *MR_trace_browse_all_on_level(FILE *out,
const MR_Label_Layout *level_layout,
MR_Word *base_sp, MR_Word *base_curfr,
- int ancestor_level);
+ int ancestor_level, MR_bool print_optionals);
#endif /* MERCURY_TRACE_VARS_H */
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list