Commit Graph

218 Commits

Author SHA1 Message Date
Zoltan Somogyi
ea2c2ebeee Add an mdb command to save a term from the program being debugged to a file.
Estimated hours taken: 3
Branches: main

Add an mdb command to save a term from the program being debugged to a file.

browser/browse.m:
	Provide mechanisms to create browser terms from their components,
	and to save browser terms to a named file.

trace/mercury_trace_browse.[ch]:
	Provide access to these predicates from C code.

trace/mercury_trace_internal.c:
	Implement a new mdb command, save_to_file, which saves a goal,
	exception, procedure body or specified variable to a file.

doc/user_guide.texi:
doc/mdb_categories:
	Document the new mdb command.

trace/mercury_trace_vars.[ch]:
	Factor out the code for constructing the (components of) browser terms
	from goals and variables from the code for browsing the resulting
	terms, to allow them to be used also for saving those terms to a file.

tests/debugger/mdb_command_test.inp:
	Test the documentation of the new command.

tests/debugger/completion.exp:
	Update this test case both for the new command and for the previous one
	I added (var_name_stats).

tests/debugger/browser_test.{m,inp,exp}:
	Extend this test case to also test the behavior of the new command.
2004-05-13 08:50:34 +00:00
Julien Fischer
9c07df178a Have CVS ignore the shell scripts generated by the compiler
browser/.cvsignore:
library/.cvsignore:
	Have CVS ignore the shell scripts generated by the compiler
	when using the Java backend.
2004-04-16 05:15:39 +00:00
Zoltan Somogyi
0942716fe7 Fix a bug that caused a runtime abort if you called the library
Estimated hours taken: 3
Branches: main

runtime/mercury_ml_expand_body.h:
	Fix a bug that caused a runtime abort if you called the library
	function named_argument (which is implemented in this file) on
	a value of a type which has no field name information at all.

browser/browse.m:
	Generate better error messages when an attempt to change to a subterm
	fails: say which step failed, and which ones succeeded.

tests/debugger/field_names.{m,inp,exp}:
	Strengthen the test case to cover types with no field names at all:
	a regression test to check for the bug in mercury_ml_expand_body.h.

	Strengthen the test case using several unsuccessful commands, to test
	the improved error messsages.

tests/debugger/polymorphic_output.exp*:
	Update the expected outputs of this test case to account for the new
	error messages.
2004-04-05 07:18:58 +00:00
Zoltan Somogyi
ff60134ee9 Bring these modules up to our current coding standards.
Estimated hours taken: 8
Branches: main

analysis/analysis.m:
browser/browse.m:
compiler/accumulator.m:
compiler/assertion.m:
compiler/atsort.m:
compiler/c_util.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/code_gen.m:
compiler/code_model.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/dead_proc_elim.m:
compiler/delay_construct.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/export.m:
compiler/fact_table.m:
compiler/follow_code.m:
compiler/graph_colour.m:
compiler/hlds_module.m:
compiler/inlining.m:
compiler/llds.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/ml_tailcall.m:
compiler/ml_unify_gen.m:
compiler/mmc_analysis.m:
compiler/mode_errors.m:
compiler/passes_aux.m:
compiler/post_typecheck.m:
compiler/size_prof.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_errors.m:
compiler/transform_llds.m:
compiler/type_util.m:
compiler/unify_gen.m:
compiler/unneeded_code.m:
compiler/unused_args.m:
	Bring these modules up to our current coding standards. Use predmode
	declarations and state variable syntax where relevant. Reorder
	arguments where this is needed for the use state variables. Make the
	orders of predicate definitions correspond to the order of their
	declarations. Replace some overly large lambda expressions with named
	predicates. Convert some predicates to functions where this makes
	their use more convenient. Use field access notation where convenient.
	Fix any inconsistent indentation. Remove module prefixes on predicate
	names where this is necessary to allow sane indentation.

	In several places, use predicates from error_util.m to print error
	messages. Apart from this, there are no changes in algorithms.

	In some places, conform to the changes below.

compiler/error_util.m:
compiler/hlds_error_util.m:
	Add new variants of existing predicates for use in some of the
	changed modules above.

compiler/hlds_out.m:
	Add some functions to convert values of some HLDS types as strings,
	for use in preparing the arguments of the new calls to predicates in
	error_util.m. Change the implementations of the predicates that print
	values of those types to call those functions instead of allowing
	code duplication.

compiler/llds.m:
	Add some field names to allow use of field updates where relevant.

tests/invalid/assert_in_interface.err_exp:
tests/invalid/multisoln_func.err_exp:
tests/invalid/tricky_assert1.err_exp:
	Update the expected outputs of these test cases to allow for them being
	generated by error_util.m, and hence being better formatted than
	before.
2004-04-05 05:07:49 +00:00
Julien Fischer
87165a6b87 Have CVS ignore various files generated by the java grade and
Estimated hours taken: 0.1
Branches: main

Have CVS ignore various files generated by the java grade and
some other bits and pieces in the browser directory.

browser/.cvsignore:
library/.cvsignore:
java/runtime/.cvsignore:
	Update these files.
2004-02-27 14:19:06 +00:00
Fergus Henderson
f81fd43151 Add yet more missing dependencies, which caused problems when
Estimated hours taken: 0.5
Branches: main

browser/Mmakefile:
	Add yet more missing dependencies, which caused problems when
	bootstrapping with intermodule optimization enabled.
2004-02-17 23:44:52 +00:00
Fergus Henderson
ade1a43631 Add some more missing dependencies, which caused problems when building
Estimated hours taken: 0.25
Branches: main

browser/Mmakefile:
	Add some more missing dependencies, which caused problems when building
	with intermodule optimization enabled.
2004-02-09 12:05:17 +00:00
Fergus Henderson
e324ed42ba Add a missing dependency, which caused problems when building
Estimated hours taken: 0.5
Branches: main

browser/Mmakefile:
	Add a missing dependency, which caused problems when building
	with intermodule optimization enabled.
2004-02-05 15:30:14 +00:00
Fergus Henderson
899353ce88 Fix a bug in Zoltan's recent change: it was depending on
Estimated hours taken: 0.5
Branches: main

browser/Mmakefile:
	Fix a bug in Zoltan's recent change: it was depending on
	"libmer_browser.int" instead of "libmer_browser.ints"
	(and likewise for libmdbcomp).                     ^
2003-12-15 15:14:18 +00:00
Fergus Henderson
9b087fcc36 Ensure that we create libmer_mdbcomp.so before trying to build
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Ensure that we create libmer_mdbcomp.so before trying to build
	libmer_browser.so.
2003-12-11 00:02:39 +00:00
Fergus Henderson
3f7c562053 Work around a problem where the mdbcomp library was being
Estimated hours taken: 1
Branches: main

browser/Mmakefile:
	Work around a problem where the mdbcomp library was being
	included in the mer_browser library, rather than just being
	referenced from it.
2003-12-10 23:56:35 +00:00
Fergus Henderson
b5644bb1ee Ensure that libmer_browser.so and libmer_trace.so link with
Estimated hours taken: 0.25
Branches: main

browser/Mercury.options:
trace/Mmakefile:
	Ensure that libmer_browser.so and libmer_trace.so link with
	the mer_mdbcomp library.  This is needed after my recent fix
	to ensure that the mer_mdbcomp library is referenced from the
	mer_browser library, rather than being included in it.

compiler/Mmakefile:
	Add a missing dependency on libmer_mdbcomp.$A.
2003-12-10 07:04:24 +00:00
Fergus Henderson
8020bfed3c Some Mmakefile tweaks for grade java.
Estimated hours taken: 0.5
Branches: main

Some Mmakefile tweaks for grade java.

boehm_gc/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
	Don't try to build the boehm_gc, browser, or trace directories
	in grade java.

compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	Avoid dependencies on *.$A files in grade java.
2003-12-09 14:57:57 +00:00
Fergus Henderson
4a76e32c47 Fix a typo: s/MDCOMP/MDBCOMP/g
Estimated hours taken: 0.25
Branches: main

browser/Mmakefile:
	Fix a typo: s/MDCOMP/MDBCOMP/g
2003-11-05 08:05:55 +00:00
Zoltan Somogyi
a2bf36e49a This diff contains no changes in algorithms whatsoever.
Estimated hours taken: 4
Branches: main

This diff contains no changes in algorithms whatsoever.

browser/*.m:
compiler/*.m:
library/*.m:
	Replace old-style lambdas with new-style lambdas or with named
	procedures.
2003-11-05 03:17:49 +00:00
Zoltan Somogyi
e7c86a2342 Conform to the convention of importing only one browser module per
Estimated hours taken: 0.2
Branches: main

browser/debugger_interface.m:
browser/declarative_oracle.m:
browser/interactive_query.m:
browser/parse.m:
	Conform to the convention of importing only one browser module per
	line, and of importing browser modules before standard library modules.
2003-10-27 06:24:43 +00:00
Zoltan Somogyi
9045968ade Conform to the convention of importing only one browser module
Estimated hours taken: 0.2
Branches: main

browser/browse.m:
browser/declarative_test.m:
browser/set_cc.m:
	Conform to the convention of importing only one browser module
	per line.
2003-10-27 06:19:09 +00:00
Zoltan Somogyi
ecdc285bc7 Split the existing browser library into two libraries, by making the
Estimated hours taken: 10
Branches: main

Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).

The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.

Mmake.common.in:
	Allow MDB_COMP_ as a prefix for symbol names in the browser directory.

Mmake.workspace:
	Add a make variable holding for the name of the new library, and
	add the name to the relevant lists of libraries.

	Avoid duplicating the lists of filenames that need to be updated
	when adding new libraries or changing their names.

Mmakefile:
	Use make variables to refer to library names.

browser/mdbcomp.m:
browser/mer_mdbcomp.m:
	Add these files as the top modules of the new library.

browser/program_representation.m:
	Make program_representation.m a submodule of mdbcomp, not mdb.

browser/program_representation.m:
browser/browser_info.m:
	Move a predicate from program_representation.m to browser_info.m
	to avoid the mdbcomp library depend on the browser library, since
	this would negate the point of the exercise.

browser/mdb.m:
	Delete program_representation.m from the list of submodules.

browser/Mmakefile:
	Update this file to handle the new module.

browser/Mercury.options:
	Mention the new module.

browser/*.m:
	Update the lists of imported modules. Import only one browser module
	per line.

compiler/notes/overall_design.html:
	Document the new library.

compiler/compile_target_code.m:
	Add the mdbcomp library to the list of libraries we need to link with.

compiler/prog_rep.m:
trace/mercury_trace_internal.c:
	Import program_representation.m by its new name.

scripts/c2init.in:
	Centralize knowledge about which files need to be updated when the list
	of libraries changes here.

scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
	Update the list of libraries programs are linked with.
2003-10-27 06:00:50 +00:00
Zoltan Somogyi
f007b45df8 Implement the infrastructure for term size profiling.
Estimated hours taken: 400
Branches: main

Implement the infrastructure for term size profiling. This means adding two
new grade components, tsw and tsc, and implementing them in the LLDS code
generator. In grades including tsw (term size words), each term is augmented
with an extra word giving the number of heap words it contains; in grades
including tsc (term size cells), each term is augmented with an extra word
giving the number of heap cells it contains. The extra word is at the start,
at offset -1, to leave almost all of the machinery for accessing the heap
unchanged.

For now, the only way to access term sizes is with a new mdb command,
"term_size <varspec>". Later, we will use term sizes in conjunction with
deep profiling to do experimental complexity analysis, but that requires
a lot more research. This diff is a necessary first step.

The implementation of term size profiling consists of three main parts:

- a source-to-source transform that computes the size of each heap cell
  when it is constructed (and increments it in the rare cases when a free
  argument of an existing heap cell is bound),

- a relatively small change to the code generator that reserves the extra
  slot in new heap cells, and

- extensions to the facilities for creating cells from C code to record
  the extra information we now need.

The diff overhauls polymorphism.m to make the source-to-source transform
possible. This overhaul includes separating type_ctor_infos and type_infos
as strictly as possible from each other, converting type_ctor_infos into
type_infos only as necessary. It also includes separating type_ctor_infos,
type_infos, base_typeclass_infos and typeclass_infos (as well as voids,
for clarity) from plain user-defined type constructors in type categorizations.
This change needs this separation because values of those four types do not
have size slots, but they ought to be treated specially in other situations
as well (e.g. by tabling).

The diff adds a new mdb command, term_size. It also replaces the proc_body
mdb command with new ways of using the existing print and browse commands
("print proc_body" and "browse proc_body") in order to make looking at
procedure bodies more controllable. This was useful in debugging the effect
of term size profiling on some test case outputs. It is not strictly tied
to term size profiling, but turns out to be difficult to disentangle.

compiler/size_prof.m:
	A new module implementing the source-to-source transform.

compiler/notes/compiler_design.html:
	Mention the new module.

compiler/transform_hlds.m:
	Include size_prof as a submodule of transform_hlds.

compiler/mercury_compile.m:
	If term size profiling is enabled, invoke its source-to-source
	transform.

compiler/hlds_goal.m:
	Extend construction unifications with an optional slot for recording
	the size of the term if the size is a constant, or the identity of the
	variable holding the size, if the size is not constant. This is
	needed by the source-to-source transform.

compiler/quantification.m:
	Treat the variable reference that may be in this slot as a nonlocal
	variable of construction unifications, since the code generator needs
	this.

compiler/compile_target_code.m:
	Handle the new grade components.

compiler/options.m:
	Implement the options that control term size profiling.

doc/user_guide.texi:
	Document the options and grade components that control term size
	profiling, and the term_size mdb command. The documentation is
	commented out for now.

	Modify the wording of the 'u' HLDS dump flag to include other details
	of unifications (e.g. term size info) rather than just unification
	categories.

	Document the new alternatives of the print and browse commands. Since
	they are for developers only, the documentation is commented out.

compiler/handle_options.m:
	Handle the implications of term size profiling grades.

	Add a -D flag value to print HLDS components relevant to HLDS
	transformations.

compiler/modules.m:
	Import the new builtin library module that implements the operations
	needed by term size profiling automatically in term size profiling
	grades.

	Switch the predicate involved to use state var syntax.

compiler/prog_util.m:
	Add predicates and functions that return the sym_names of the modules
	needed by term size profiling.

compiler/code_info.m:
compiler/unify_gen.m:
compiler/var_locn.m:
 	Reserve an extra slot in heap cells and fill them in in unifications
	marked by size_prof.

compiler/builtin_ops.m:
	Add term_size_prof_builtin.term_size_plus as a builtin, with the same
	implementation as int.+.

compiler/make_hlds.m:
	Disable warnings about clauses for builtins while the change to
	builtin_ops is bootstrapped.

compiler/polymorphism.m:
	Export predicates that generate goals to create type_infos and
	type_ctor_infos to add_to_construct.m. Rewrite their documentation
	to make it more detailed.

	Make orders of arguments amenable to the use of state variable syntax.

	Consolidate knowledge of which type categories have builtin unify and
	compare predicates in one place.

	Add code to leave the types of type_ctor_infos alone: instead of
	changing their types to type_info when used as arguments of other
	type_infos, create a new variable of type type_info instead, and
	use an unsafe_cast. This would make the HLDS closer to being type
	correct, but this new code is currently commented out, for two
	reasons. First, common.m is currently not smart enough to figure out
	that if X and Y are equal, then similar unsafe_casts of X and Y
	are also equal, and this causes the compiler do not detect some
	duplicate calls it used to detect. Second, the code generators
	are also not smart enough to know that if Z is an unsafe_cast of X,
	then X and Z do not need separate stack slots, but can use the same
	slot.

compiler/type_util.m:
	Add utility predicates for returning the types of type_infos and
	type_ctor_infos, for use by new code in polymorphism.m.

	Move some utility predicates here from other modules, since they
	are now used by more than one module.

	Rename the type `builtin_type' as `type_category', to better reflect
	what it does. Extend it to put the type_info, type_ctor_info,
	typeclass_info, base_typeclass_info and void types into categories
	of their own: treating these types as if they were a user-defined
	type (which is how they used to be classified) is not always correct.
	Rename the functor polymorphic_type to variable_type, since types
	such as list(T) are polymorphic, but they fall into the user-defined
	category. Rename user_type as user_ctor_type, since list(int) is not
	wholly user-defined but falls into this category. Rename pred_type
	as higher_order_type, since it also encompasses functions.

	Replace code that used to check for a few of the alternatives
	of this type with code that does a full switch on the type,
	to ensure that they are updated if the type definition ever
	changes again.

compiler/pseudo_type_info.m:
	Delete a predicate whose updated implementation is now in type_util.m.

compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
	Still treat type_infos, type_ctor_infos, typeclass_infos and
	base_typeclass_infos as user-defined types, but prepare for when
	they won't be.

compiler/hlds_pred.m:
	Require interface typeinfo liveness when term size profiling is
	enabled.

	Add term_size_profiling_builtin.increase_size as a
	no_type_info_builtin.

compiler/hlds_out.m:
	Print the size annotations on unifications if HLDS dump flags call
	for unification details. (The flag test is in the caller of the
	modified predicate.)

compiler/llds.m:
	Extend incr_hp instructions and data_addr_consts with optional fields
	that allow the code generator to refer to N words past the start of
	a static or dynamic cell. Term size profiling uses this with N=1.

compiler/llds_out.m:
	When allocating memory on the heap, use the macro variants that
	specify an optional offset, and specify the offset when required.

compiler/bytecode_gen.m:
compiler/dense_switch.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/goal_form.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/inst_match.m:
compiler/intermod.m:
compiler/jumpopt.m:
compiler/lambda.m:
compiler/livemap.m:
compiler/ll_pseudo_type_info.m:
compiler/lookup_switch.m:
compiler/magic_util.m:
compiler/middle_rec.m:
compiler/ml_code_util.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/modecheck_unify.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_conj_gen.m:
compiler/post_typecheck.m:
compiler/reassign.m:
compiler/rl.m:
compiler/rl_key.m:
compiler/special_pred.m:
compiler/stack_layout.m:
compiler/static_term.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unused_args.m:
compiler/use_local_vars.m:
	Minor updates to conform to the changes above.

library/term_size_prof_builtin.m:
	New module containing helper predicates for term size profiling.
	size_prof.m generates call to these predicates.

library/library.m:
	Include the new module in the library.

doc/Mmakefile:
	Do not include the term_size_prof_builtin module in the library
	documentation.

library/array.m:
library/benchmarking.m:
library/construct.m:
library/deconstruct.m:
library/io.m:
library/sparse_bitset.m:
library/store.m:
library/string.m:
	Replace all uses of MR_incr_hp with MR_offset_incr_hp, to ensure
	that we haven't overlooked any places where offsets may need to be
	specified.

	Fix formatting of foreign_procs.

	Use new macros defined by the runtime system when constructing
	terms (which all happen to be lists) in C code. These new macros
	specify the types of the cell arguments, allowing the implementation
	to figure out the size of the new cell based on the sizes of its
	fields.

library/private_builtin.m:
	Define some constant type_info structures for use by these macros.
	They cannot be defined in the runtime, since they refer to types
	defined in the library (list.list and std_util.univ).

util/mkinit.c:
	Make the addresses of these type_info structures available to the
	runtime.

runtime/mercury_init.h:
	Declare these type_info structures, for use in mkinit-generated
	*_init.c files.

runtime/mercury_wrapper.[ch]:
	Declare and define the variables that hold these addresses, for use
	in the new macros for constructing typed lists.

	Since term size profiling can refer to a memory cell by a pointer
	that is offset by one word, register the extra offsets with the Boehm
	collector if is being used.

	Document the incompatibility of MR_HIGHTAGS and the Boehm collector.

runtime/mercury_tags.h:
	Define new macros for constructing typed lists.

	Provide macros for preserving the old interface presented by this file
	to the extent possible. Uses of the old MR_list_cons macro will
	continue to work in grades without term size profiling. In term
	size profiling grades, their use will get a C compiler error.

	Fix a bug caused by a missing backslash.

runtime/mercury_heap.h:
	Change the basic macros for allocating new heap cells to take
	an optional offset argument. If this is nonzero, the macros
	increment the returned address by the given number of words.
	Term size profiling specifies offset=1, reserving the extra
	word at the start (which is ignored by all components of the
	system except term size profiling) for holding the size of the term.

	Provide macros for preserving the old interface presented by this file
	to the extent possible. Since the old MR_create[123] and MR_list_cons
	macros did not specify type information, they had to be changed
	to take additional arguments. This affects only hand-written C code.

	Call new diagnostic macros that can help debug heap allocations.

	Document why the macros in this files must expand to expressions
	instead of statements, evn though the latter would be preferable
	(e.g. by allowing them to declare and use local variables without
	depending on gcc extensions).

runtime/mercury_debug.[ch]:
	Add diagnostic macros to debug heap allocations, and the functions
	behind them if MR_DEBUG_HEAP_ALLOC is defined.

	Update the debugging routines for hand-allocated cells to print the
	values of the term size slot as well as the other slots in the relevant
	grades.

runtime/mercury_string.h:
	Provide some needed variants of the macro for copying strings.

runtime/mercury_deconstruct_macros.h:
runtime/mercury_type_info.c:
	Supply type information when constructing terms.

runtime/mercury_deep_copy_body.h:
	Preserve the term size slot when copying terms.

runtime/mercury_deep_copy_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_ml_expand_body.h:
	Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
	that allocate cells also allocate space for the term size slot if
	necessary.

	Reduce code duplication by using a now standard macro for copying
	strings.

runtime/mercury_grade.h:
	Handle the two new grade components.

runtime/mercury_conf_param.h:
	Document the C macros used to control the two new grade components,
	as well as MR_DEBUG_HEAP_ALLOC.

	Detect incompatibilities between high level code and profiling.

runtime/mercury_term_size.[ch]:
	A new module to house a function to find and return term sizes
	stored in heap cells.

runtime/mercury_proc_id.h:
runtime/mercury_univ.h:
	New header files. mercury_proc_id.h contains the (unchanged)
	definition of MR_Proc_Id, while mercury_univ.h contains the
	definitions of the macros for manipulating univs that used to be
	in mercury_type_info.h, updated to use the new macros for allocating
	memory.

	In the absence of these header files, the following circularity
	would ensue:

	mercury_deep_profiling.h includes mercury_stack_layout.h
		- needs definition of MR_Proc_Id
	mercury_stack_layout.h needs mercury_type_info.h
		- needs definition of MR_PseudoTypeInfo
	mercury_type_info.h needs mercury_heap.h
		- needs heap allocation macros for MR_new_univ_on_hp
	mercury_heap.h includes mercury_deep_profiling.h
		- needs MR_current_call_site_dynamic for recording allocations

	Breaking the circular dependency in two places, not just one, is to
	minimize similar problems in the future.

runtime/mercury_stack_layout.h:
	Delete the definition of MR_Proc_Id, which is now in mercury_proc_id.h.

runtime/mercury_type_info.h:
	Delete the macros for manipulating univs, which are now in
	mercury_univ.h.

runtime/Mmakefile:
	Mention the new files.

runtime/mercury_imp.h:
runtime/mercury.h:
runtime/mercury_construct.c:
runtime/mercury_deep_profiling.h:
	Include the new files at appropriate points.

runtime/mercury.c:
	Change the names of the functions that create heap cells for
	hand-written code, since the interface to hand-written code has
	changed to include type information.

runtime/mercury_tabling.h:
	Delete some unused macros.

runtime/mercury_trace_base.c:
runtime/mercury_type_info.c:
	Use the new macros supplying type information when constructing lists.

scripts/canonical_grade_options.sh-subr:
	Fix an undefined sh variable bug that could cause error messages
	to come out without identifying the program they were from.

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade_options.sh-subr:
scripts/mgnuc.in:
	Handle the new grade components and the options controlling them.

trace/mercury_trace_internal.c:
	Implement the mdb command "term_size <varspec>", which is like
	"print <varspec>", but prints the size of a term instead of its value.
	In non-term-size-profiling grades, it prints an error message.

	Replace the "proc_body" command with optional arguments to the "print"
	and "browse" commands.

doc/user_guide.tex:
	Add documentation of the term_size mdb command. Since the command is
	for implementors only, and works only in grades that are not yet ready
	for public consumption, the documentation is commented out.

	Add documentation of the new arguments of the print and browse mdb
	commands. Since they are for implementors only, the documentation
	is commented out.

trace/mercury_trace_vars.[ch]:
	Add the functions needed to implement the term_size command, and
	factor out the code common to the "size" and "print"/"browse" commands.

	Decide whether to print the name of a variable before invoking the
	supplied print or browse predicate on it based on a flag design for
	this purpose, instead of overloading the meaning of the output FILE *
	variable. This arrangement is much clearer.

trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
	Supply type information when constructing terms.

browser/program_representation.m:
	Since the new library module term_size_prof_builtin never generates
	any events, mark it as such, so that the declarative debugger doesn't
	expect it to generate any.

	Do the same for the deep profiling builtin module.

tests/debugger/term_size_words.{m,inp,exp}:
tests/debugger/term_size_cells.{m,inp,exp}:
	Two new test cases, each testing one of the new grades.

tests/debugger/Mmakefile:
	Enable the two new test cases in their grades.

	Disable the tests sensitive to stack frame sizes in term size profiling
	grades.

tests/debugger/completion.exp:
	Add the new "term_size" mdb command to the list of command completions,
	and delete "proc_body".

tests/debugger/declarative/dependency.{inp,exp}:
	Use "print proc_body" instead of "proc_body".

tests/hard_coded/nondet_c.m:
tests/hard_coded/pragma_inline.m:
	Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
	that allocate cells also allocate space for the term size slot if
	necessary.

tests/valid/Mmakefile:
	Disable the IL tests in term size profiling grades, since the term size
	profiling primitives haven't been (and probably won't be) implemented
	for the MLDS backends, and handle_options causes a compiler abort
	for grades that combine term size profiling and any one of IL, Java
	and high level C.
2003-10-20 07:29:59 +00:00
Zoltan Somogyi
bed904e722 Make browsing in the debugger more flexible by adding options to the "ls",
Estimated hours taken: 8
Branches: main

Make browsing in the debugger more flexible by adding options to the "ls",
"print" and "set" commands of the browser. Make browsing in the debugger less
confusing by making the "set" command by default set the parameters used
not just by the "ls" command but also by the "print" command, both inside and
outside the browser. This is done by making "ls" and "print" synonyms inside
the term browser.

browser/parse.m:
	Replace the commands ls/0, ls/1 and print/1 with a single command,
	print/2. The arguments of print/2 specify

	- the presence or absence of options controlling which formatter to
	  use, and
	- the path to the subterm to look at (which the "ls" command had,
	  but not the "print" command).

	Change the set/1 command into the set/2 command, adding a field
	specifying the presence or absence of options controlling which
	caller type and/or which formatter parameters to set. The set/2
	command within the browser prompt now functions the same as the "set"
	command from the mdb prompt, because they now call the same code
	to update the parameter sets.

	Change the parsing infrastructure to allow the use of getopt to
	process the options, by keeping around the word structure even after
	tokenization.

	Comment out code that isn't called, but may be needed later
	for debugging.

	Update the block comment documenting the command syntax.

browser/browse.m:
	Conform to the change in the type of commands.

	Change the implementation of the "set" command. Instead of the default
	being to change only the parameter set used by the "ls" command, make
	the default the application of the change to all the parameter sets.
	If users want to restrict the change to apply only to the "ls" command,
	they can specify the -B option.

	Change the implementation of the set/0 command to report not just one
	set of parameters, but all of them, since they can now all be changed
	by the set/2 command.

	Update the help message, to show the new options and to group related
	commands together.

browser/browser_info.m:
	Provide variants of the predicates for changing settings that are
	specialized for the requirements of mdb and of the term browser.

	Change the default format for the browser to "flat", to match the
	default for the mdb "print" command. This was the default for the
	browser's print command as well. This changes the default behavior
	of the browser's "ls" command. Since "print" and "ls" had different
	defaults but are now synonyms, we had to break backward compatibility
	for one or the other. (Preserving different defaults for these two
	browser commands would create an unnecessarily complicated user
	interface with respect to the meaning of their options.)

browser/declarative_user.m:
	Make it possible to switch the parameter set used to by the declarative
	debugger to print atoms quickly yet consistently.

trace/mercury_trace_browse.c:
	Call the C versions of the parameter setting predicates. (The versions
	for use from within the term browser specify the parameters a different
	way).

tests/debugger/browser_test.exp:
tests/debugger/exception_value.exp:
tests/debugger/polymorphic_output.exp:
tests/debugger/declarative/browse_arg.exp:
	Update the expected outputs to comply with the changes above.
2003-10-13 08:02:18 +00:00
Simon Taylor
1de86c7f9c Move the code in dl.m to create closures into the runtime.
Estimated hours taken: 2
Branches: main

browser/dl.m:
runtime/mercury_ho_call.{c,h}:
	Move the code in dl.m to create closures into the runtime.
	The code is actually clarified by implementing it entirely
	in C, rather than a mish-mash of C and Mercury.

	The rationale for this change is that Aditi needs to be able
	to create closures for dynamically linked procedures.  Just
	copying browser/dl.m as it was into the Aditi sources would
	create an undesirable dependency on Mercury runtime
	implementation details.
2003-09-24 06:33:28 +00:00
Zoltan Somogyi
3e766fcd11 Print streams sensibly in the debugger.
Estimated hours taken: 6
Branches: main

Print streams sensibly in the debugger.

runtime/mercury_library_types.h:
	Define MercuryFilePtr as a shorthand for MercuryFile *.

library/io.m:
	Define a user-friendly representation for streams that includes not
	just the stream's name but all the info about the stream that user
	using mdb may wish to know about the stream, as well as a unique stream
	id.

	Make the changes required to maintain this improved stream database.
	If the program is being executed under mdb, then do not ever delete
	items from the stream database, since e.g. the declarative debugger
	may need to print the stream's representation even after the stream
	is closed. (If executing outside mdb, then we delete a stream's entry
	from the stream database when the stream is closed, as before.)

	To allow the debugger to detect which variables are I/O streams,
	change the stream types from being equivalent to c_pointer (and thus
	indistinguishable from other c_pointers) to their own type. Implement
	this type as MercuryFilePtr in the C backend. In the IL backend, we
	represent it as Object[], the minimum representation change possible.

	Use the C type definition to get rid of many casts.

	When writing streams, write the user-friendly representation, not
	a meaningless <<c_pointer>>.

runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
runtime/mercury_layout_util.c:
	The change in stream's representation changes the types of some of the
	arguments of functions exported to C from io.m; conform to those
	changes.

browser/browse.m:
browser/sized_pretty.m:
	In each of the mechanisms that the debugger can use to display terms,
	pass along the stream name database.

browser/browser_info.m:
	When deconstructing terms that are streams, return the stream's
	user-friendly id, not a c_pointer.

browser/browse_test.m:
	Update this test program to test the new way of printing streams.

runtime/mercury_trace_base.[ch]:
	Define the MR_trace_ever_enabled variable to let io.m know whether
	it is allowed to ever discard stream info.

runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
	Update the types of the functions dealing with streams to use
	MercuryFilePtr to refer to streams instead of MR_Word. These functions
	are implemented by Mercury predicates exported to C.

runtime/mercury_wrapper.c:
	Set MR_trace_ever_enabled to true when execution tracing is enabled.
	This is the only assigment to MR_trace_ever_enabled after
	initialization to the default (false).

tests/debugger/declarative/io_stream_test.{m,inp,exp,exp}:
	A new test case to test the debugger's printing of I/O streams.

tests/debugger/declarative/Mmakefile:
	Enable the new test case.
2003-09-14 22:24:41 +00:00
Zoltan Somogyi
ebfd6fb66b Fix spelling error in comment.
Estimated hours taken: 0.1
Branches: main

browser/declarative_tree.m:
	Fix spelling error in comment.
2003-09-01 01:16:11 +00:00
Zoltan Somogyi
98534c477a Import only one module per line. Fix the format of foreign_procs.
Estimated hours taken: 0.1
Branches: main

browser/mdb.m:
library/library.m:
	Import only one module per line. Fix the format of foreign_procs.
2003-06-10 10:03:31 +00:00
Zoltan Somogyi
4d5a3292b0 Fix a bug: treat unsafe casts as we treat assignment unifications.
Estimated hours taken: 1
Branches: main

browser/declarative_tree.m:
browser/program_representation.m:
compiler/prog_rep.m:
	Fix a bug: treat unsafe casts as we treat assignment unifications.
	We used to treat them as calls, which was wrong, because unlike calls,
	unsafe_casts do not generate trace events.

tests/debugging/declarative/unsafe_cast.{m,inp,exp}:
	A new regression test.

tests/debugging/declarative/Mercury_options.m:
	Set the parameters required for the new test.

tests/debugging/declarative/Mmakefile:
	Enable the new test.
2003-05-30 07:41:29 +00:00
Zoltan Somogyi
6554ef7daa Replace "is" with "=".
Estimated hours taken: 2
Branches: main

Replace "is" with "=".
Add field names where relevant.
Replace integers with counters where relevant.
2003-05-26 09:01:46 +00:00
Zoltan Somogyi
7c57ab785e Include Mmake.browser.params, if it exists.
Estimated hours taken: 0.1
Branches: main

browser/Mmakefile:
	Include Mmake.browser.params, if it exists.
2003-05-26 06:07:20 +00:00
Simon Taylor
9d14ec50e5 Add *.mih.
Estimated hours taken: 0.1
Branches: main

*/.cvsignore:
	Add *.mih.
2003-05-21 15:31:21 +00:00
Zoltan Somogyi
cf675a9ea9 Fix several bugs in namespace cleanliness.
Estimated hours taken: 0.5
Branches: main

Fix several bugs in namespace cleanliness. These caused error messages, but
they were generated by the shell, not make, and thus didn't have the ** prefix,
which meant they were only spotten when someone happened to really look at
the relevant part of bootcheck output.

tools/bootcheck:
	Link *all* the RESERVED_MACRO_NAMES files into the stage2 directory,
	not just the one in runtime. Without this, all the namespace tests
	silently failed everywhere except in the runtime directory.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	Add the macros defined by gcc and/or mgnuc to the permitted list,
	as was done for runtime/RESERVED_MACRO_NAMES a while ago.

trace/RESERVED_MACRO_NAMES:
	Add this file, which is a copy of the one in runtime, minus a macro
	that shouldn't be defined here. Without this file, one can't test
	namespace cleanliness of the trace directory even in stage 1.

library/io.m:
	Fix a namespace problem by adding an ML_ prefix.
2003-05-20 03:18:18 +00:00
Simon Taylor
ceaa856013 Move the setting of configuration options from mmc.in to
Estimated hours taken: 20
Branches: main

Move the setting of configuration options from mmc.in to
an options file Mercury.config. This has a few advantages:
- reduces the duplication between mmc and mercury.bat
- reduces the chance of running out of environment space
  on crappy operating systems (although we probably exceed
  the command line length limits on those systems anyway).
- makes it easier to bootstrap changes which add new
  configuration options.

Always read the options files, even without `--make',
to avoid inconsistent behaviour.

scripts/Mercury.config.in:
	New file containing the configuration code from mmc.in.

configure.in:
	Create scripts/Mercury.config.

bindist/Mmakefile:
	Make sure Mercury.config.in goes in the binary distribution.

Mmakefile:
bindist/Mmakefile:
Mmake.common.in:
	Make sure we get the correct setting of INSTALL_PREFIX
	when building the binary distribution.

scripts/Mmakefile:
scripts/mercury_config.in:
bindist/bindist.Mmakefile.in:
	Install Mercury.config.

compiler/options.m:
doc/user_guide.texi:
	Add documentation for the `--config-file' option, which gives
	the name of the configuration file to read.

	Add an option `read-config-file-2003-03-01' which will be
	used in configure.in to test whether the compiler is up
	to date after the configuration code is removed from mmc.in
	(after this change is installed everywhere).

	Add `--mercury-config-dir' as an abbreviation for
	`--mercury-configuration-directory'.

Mmake.workspace:
	Use the configuration file in scripts/Mercury.config.

browser/Mmakefile:
compiler/Mmakefile:
scripts/Mmake.vars.in:
	Always pass ALL_MCFLAGS to mmc so that mmc will
	use the configuration file specified in the options.

compiler/handle_options.m:
	Handle the default value of `--config-file'.

compiler/mercury_compile.m:
	Read the configuration file.

	Always read the options files, even without `--make',
	to avoid inconsistent behaviour.

compiler/make.m:
	Pass the variable settings from the configuration file
	to make__process_args.

	The options files have already been read in mercury_compile.m,
	so don't read them again here.

compiler/make.util.m:
	Add a version of build_with_module_options which doesn't
	need a make_info, for use by mercury_compile.m.

compiler/options_file.m:
	Export a predicate to read a single options file.

	Make the predicates to read options files add to an initial
	options_variables map, rather than always creating a new one.

	Allow MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR
	to be set in the options file or environment.

scripts/mmc.in:
	Set MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR in
	mercury_compile's environment.
2003-03-01 06:35:17 +00:00
Fergus Henderson
1ba1647088 Deprecate io__current_(binary_)?(input|output)_stream,
Estimated hours taken: 1
Branches: main

library/io.m:
	Deprecate io__current_(binary_)?(input|output)_stream,
	because these procedures were identical with the
	procedures named io__(binary_)?(input|output)_stream.

browser/browse.m:
	Use io__output_stream instead of io__current_output_stream.

deep_profiler/mdprof_cgi.m:
	Use io__binary_(in|out)put_stream instead of
	io__current_binary_(in|out)put_stream.

NEWS:
	Mention the changes to library/io.m.
2003-02-24 05:49:31 +00:00
Fergus Henderson
e132bebac7 Add `ils' target, for use by tools/bootcheck.
Estimated hours taken: 1
Branches: main

analysis/Mmakefile:
compiler/Mmakefile:
browser/Mmakefile:
profiler/Mmakefile:
	Add `ils' target, for use by tools/bootcheck.

library/Mmakefile:
	Add a missing dependency to ensure that we build all of the
	`.int*' files for the `il' grade (it was forgetting to build
	`library.int3').
	Also, add a target to build the library as an executable,
	so that you can run PEverify on it (PEverify doesn't
	work properly on multi-file assemblies unless they
	are executables).
2003-02-19 06:31:22 +00:00
Fergus Henderson
a18332a294 Various fixes for the .NET back-end.
Estimated hours taken: 3
Branches: main

Various fixes for the .NET back-end.

compiler/Mmakefile:
	For IL grades, use editbin to set the stack size to 100M,
	since the default (1M) is too small.
	Also, don't try to build mlds_to_gcc in IL grades -- gcc.m won't
	compile, because the IL grades don't support the C interface.

library/Mmakefile:
	Add some missing dependencies.

profiler/Mmakefile:
deep_profiler/Mmakefile:
	Conditionalize some dependencies that were bogus for IL grades.

library/.cvsignore:
compiler/.cvsignore:
profiler/.cvsignore:
deep_profiler/.cvsignore:
analysis/.cvsignore:
browser/.cvsignore:
samples/.cvsignore:
	Various minor updates to ignore files produced when building in
	IL grades.
2003-02-15 23:59:41 +00:00
Simon Taylor
9d88a8668a s/--link-flags --allow-undefined/--allow-undefined/
Estimated hours taken: 0.1
Branches: main

browser/interactive_query.m:
	s/--link-flags --allow-undefined/--allow-undefined/
	in the mmc command line. This is needed after my change
	to implement ml in the compiler.
2003-02-10 08:52:20 +00:00
Peter Ross
6f1f7f0083 Add Mercury versions of code which has been defined only as
Estimated hours taken: 1
Branches: main

browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/interactive_query.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
	Add Mercury versions of code which has been defined only as
	foreign procs so as to allow this directory to compile for
	the non-C backends.
	The Mercury versions just call private_builtin__sorry.
2003-02-06 13:37:08 +00:00
Simon Taylor
4b49b1f019 Implement the ml and c2init scripts in the compiler to
Estimated hours taken: 25
Branches: main

Implement the ml and c2init scripts in the compiler to
reduce dependencies on Cygwin.

compiler/compile_target_code.m:
	Implement the functionality of ml and c2init, rather than
	calling those scripts.

	Handle all compiler dependencies using options, rather than
	testing for particular compilers here.

compiler/options.m:
NEWS:
doc/user_guide.texi:
	Add options which implement functionality which is part
	of ml, c2init or mgnuc when using Mmake:
	--warn-target-code, --output-link-command,
	--output-shared-lib-link-command, --ansi-c,
	--no-strip, --no-demangle, --no-main,
	--allow-undefined, --use-readline, --runtime-flags,
	--extra-inits.

	Add options to describe the C compiler and linker, for
	use by configure/mmc.

	The `--ml-flags' (`--link-flags') option has been removed.

compiler/options_file.m:
	Remove the MLFLAGS variable.

compiler/handle_options.m:
	`--target-debug' implies `--no-strip'.

	Add the path to the GC libraries to the library search paths.

compiler/mercury_compile.m:
	Handle --output-link-command and --output-shared-lib-link-command.

compiler/passes_aux.m:
	Add a variant of invoke_shell_command which takes a second
	command to process the first command's output. This is used
	by compile_target_code.m to invoke the demangler.

configure.in:
scripts/mmc.in:
	Handle extra default options.

scripts/c2init.in:
scripts/ml.in:
	Document that the code here is duplicated in
	compiler/compile_target_code.m.

Mmake.workspace:
browser/Mmakefile:
compiler/Mercury.options:
compiler/Mmakefile:
library/Mmakefile:
	Pass `-R' options pointing to the installation directories
	to mmc, as we already do for ml.
2003-02-05 14:41:20 +00:00
Mark Brown
c9563335ef Allow users of the declarative debugger to revise answers that they
Estimated hours taken: 60
Branches: main

Allow users of the declarative debugger to revise answers that they
have given previously.  We do this by modifying the user interface
to allow a default answer to be shown as part of the question; the
default answer will always be some answer the user has given previously,
which they can choose to either change or accept as is.  Initially no
questions will be candidates for revision, but if the user ever rejects
a diagnosis, some or all of the questions leading directly to the bug in
question will be asked again.

Add an empty command to the user_command type, for when the user just
presses return.  If there is a default answer, the empty command is
interpreted as that answer.  If there is no default answer, the empty
command is interpreted as the skip command, which allows the user to
cycle through all the available questions by repeatedly pressing return.

browser/declarative_debugger.m:
	Define the type decl_evidence which represents the evidence
	collected against a particular suspect.

	Pass the evidence to the oracle as required.

	Ensure the analyser is updated after the user rejects a diagnosis.

browser/declarative_analyser.m:
	Collect the evidence against the prime suspect as the answers are
	processed, and include this evidence when the analyser response
	is a bug.

	Export the predicate revise_analysis/4 which updates the
	analyser state after the user has rejected a diagnosis.

	Pass the IO action map to prime_suspect_get_evidence so that
	edt_root_question can be called.

browser/declarative_oracle.m:
	When the user rejects a bug, retract from the oracle's knowledge
	base any of the evidence which implicated that bug.  Rather than
	throw this information away, we assert it in a secondary knowledge
	base which is consulted when we want to know if there should be
	a default answer provided to the user.

	Update the oracle_state to reflect the above change, and remove
	all the get_* and set_* predicates for the oracle state.  That
	functionality is provided by labelled fields, so maintaining the
	get_* and set_* predicates is no longer worth the trouble.

	Add the predicate retract_oracle_kb/3 to remove information from
	a knowledge base.

	Use the correct (equivalence) type for exceptions.

browser/declarative_user.m:
	Add the type user_question, which may be a plain decl_question or
	may be a decl_question with a default answer.  Use this type in
	query_user* instead of decl_question.

	Write the command handling switch as a separate predicate.  This
	makes it easier for one command to emulate others (e.g. the empty
	command).

	If the question has a default answer, print it as part of the
	prompt.

	Parse the empty command.

doc/user_guide.texi:
	Update the documentation to reflect the changes.

library/list.m:
	Add a cc_multi version of list__map.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/empty_command.exp:
tests/debugger/declarative/empty_command.inp:
tests/debugger/declarative/empty_command.m:
tests/debugger/declarative/revise.exp:
tests/debugger/declarative/revise.inp:
tests/debugger/declarative/revise.m:
tests/debugger/declarative/revise_2.exp:
tests/debugger/declarative/revise_2.inp:
tests/debugger/declarative/revise_2.m:
	Test cases for the new features.
2003-02-03 05:19:32 +00:00
Peter Ross
b177463322 Fix some problems where we were calling the incorrect predicates from
Estimated hours taken: 1
Branches: main

Fix some problems where we were calling the incorrect predicates from
deconstruct.m.

browser/browser_info.m:
    Change limited_deconstruct_browser_term_cc to use the
    std_util__limited_deconstruct_cc.
    Change deconstruct_browser_term_cc to use std_util__deconstruct_cc.

browser/browse.m:
browser/sized_pretty.m:
    Handle the changes to limited_deconstruct_browser_term_cc.
2002-12-03 10:21:17 +00:00
Peter Ross
138f778aca Update to use the new type signature and determinism of
Estimated hours taken: 0.5
Branches: main

browser/browse.m:
	Update to use the new type signature and determinism of
	limited_deconstruct_cc.
2002-12-02 16:27:50 +00:00
Zoltan Somogyi
2040556da6 Make it easier to print and browse I/O actions in the declarative debugger.
Estimated hours taken: 6
Branches: main

Make it easier to print and browse I/O actions in the declarative debugger.

browser/browser_info.m:
	Add a new component to the debugger's permanent state to record the
	user's preference as to how many I/O actions can be printed with each
	atom. If an atom has this many I/O actions or fewer, they are printed.
	If it has more, only a notice about too many I/O actions to show is
	printed, and the user has to look up the actions manually.

browser/browse.m:
	Update the help message and the printing of the current settings
	accordingly.

browser/parse.m:
	Add a new piece of functionality to the "set" browser command,
	"set num_io_actions <n>", that allows the user to set the value
	of this new parameter.

browser/declarative_user.m:
	Delete the old, undocumented command "io <action_num>". Replace with
	two new command forms, "print io <from_action_num>[-<to_action_num>]"
	and "browse io <action_num>". "browse io" does what the old "io"
	command did, but using this to print many I/O actions is clumsy;
	that's what "print io" is for.

	For symmetry, also add "print <from_arg_num>[-<to_arg_num>]".

	Respect the new, user-configurable limit on the number of I/O actions
	printed with each atom.

tests/debugger/declarative/tabled_read_decl.{inp,exp}:
	Add some tests of the new functionality.
2002-11-01 07:45:04 +00:00
Mark Brown
ff53936dbc Print list terms using list syntax when printing in "flat" format.
Estimated hours taken: 3
Branches: main

Print list terms using list syntax when printing in "flat" format.  As
well as the usual functor/arity style abbreviation, list elements can be
replaced by an ellipsis, "...", if beyond the depth or size limit.

browser/browse.m:
	Handle the functors [|]/2 and []/0 specially.

doc/user_guide.texi:
	Be more explicit with the meaning of "depth" and "size".  In
	particular, define what they mean for lists.

tests/debugger/*.exp:
tests/debugger/*.exp2:
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
	Update test outputs to reflect the change.
2002-10-31 08:21:20 +00:00
Mark Brown
2faeb0cf70 Address an XXX question by answering it in the affirmative.
Estimated hours taken: 0.1
Branches: main

browser/browse.m:
	Address an XXX question by answering it in the affirmative.
2002-10-22 16:06:35 +00:00
Fergus Henderson
83c7eea7e7 "Oops, missed one."
Estimated hours taken: 0.25
Branches: main

"Oops, missed one."
Apply the same change as for the other */Mmakefile
files in my 2002/10/18 patch to browser/Mmakefile.

browser/Mmakefile:
        Run $(RANLIB) on the installed libraries.
        This is needed on MacOS 10.1, where the linker checks the date
        stamp on the .a file, refusing to link if this date is greater
        than the date when ranlib was run.  Since installing the
        libraries with `cp' updates their timestamp, we need to rerun ranlib.
2002-10-20 11:59:41 +00:00
Mark Brown
2fe0dfa705 Change the declarative debugger so it always prints syntactically
Estimated hours taken: 1.5
Branches: main

Change the declarative debugger so it always prints syntactically
correct goals.

browser/declarative_user.m:
	Print atoms using browse__print_synthetic. This means that goals
	will always be syntactically correct, even if they are printed
	in the multi-line form.

	Make the predicates write_decl{_init,_final,}_atom take an argument
	of type browse_caller_type.  When printing a single goal use the
	caller type "print", and when printing a sequence of goals use
	"print_all".

browser/browse.m:
	When writing out a synthetic term using io__write_univ, check for
	arguments with type util__unbound.  Print such values as a single
	unquoted underscore (io__write_univ would print an underscore in
	single quotes, which means something different).

browser/util.m:
	Export functions is_predicate and is_function to convert values of
	type pred_or_func to values of type bool.

tests/debugger/print_goal.exp:
tests/debugger/queens_rep.exp:
	Update the output of these tests after the change to browse.m.

tests/debugger/declarative/app.exp:
tests/debugger/declarative/app.exp2:
tests/debugger/declarative/filter.exp:
tests/debugger/declarative/filter.exp2:
tests/debugger/declarative/input_term_dep.exp:
tests/debugger/declarative/input_term_dep.exp2:
tests/debugger/declarative/output_term_dep.exp:
tests/debugger/declarative/output_term_dep.exp2:
tests/debugger/declarative/queens.exp:
tests/debugger/declarative/tabled_read_decl.exp:
tests/debugger/declarative/tabled_read_decl.exp2:
	Update the output of these test cases.
2002-10-16 03:15:33 +00:00
Mark Brown
fb27d22a8f Implement a committed choice version of the 'set' module, and use this in
Estimated hours taken: 1.5
Branches: main

Implement a committed choice version of the 'set' module, and use this in
the declarative debugging oracle.  This implementation of sets avoids the
use of builtin comparison, which would otherwise cause problems for the
oracle.

This fixes a bug that was causing test case 'ho5' to fail.

browser/set_cc.m:
	The new module.  This is mostly a wrapper around tree234_cc.

browser/mdb.m:
	Make the new module a sub-module of mdb.

browser/declarative_oracle.m:
	Use the new module instead of sets from the standard library.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/ho5.exp:
tests/debugger/declarative/ho5.exp2:
tests/debugger/declarative/ho5.inp:
	Enable this test case, and provide input and expected output.
2002-10-15 07:40:48 +00:00
Mark Brown
596bf09f7e The "complete" and "incomplete" maps in the declarative debugging oracle
Estimated hours taken: 2
Branches: main

The "complete" and "incomplete" maps in the declarative debugging oracle
can cause a runtime abort if higher order terms are present in the debuggee,
because the maps use sets to represent the solutions to a goal, and sets make
use of builtin comparison.  This change fixes the problem by replacing the
two maps with a single map from initial atom to truth value.  The set of
solutions is no longer stored explicitly.

This change causes no loss of accuracy of the oracle, because we weren't
really using the explicit knowledge about solutions anyway.  The main
drawback of this change is that if in future we implement support for "edit
and continue" style debugging (e.g. by allowing previous answers to be
saved in/restored from a file), we will lose some of the information
pertaining to previous versions of the program, which will make the oracle
slightly less effective at deducing new answers from previous ones.  Since
runtime aborts are a much more serious problem, we will have to live with
this drawback for the moment.

Another solution to this problem may have been to implement a 'set_cc'
module, which would be to 'set' as 'tree234_cc' is to 'tree234'.
Unfortunately, we would need to implement 'set_cc__intersect' but it
appears not to be possible to implement a satisfactory committed choice
version of intersection.

browser/declarative_oracle.m:
	Replace the two maps with the new one, and update the code
	that accesses the knowledge base.

tests/debugger/declarative/Mmakefile:
	Enable tests 'ho3' and 'ho4', which now work.

tests/debugger/declarative/ho3.m:
	Fix a typo in the test case.  It wasn't testing precisely the thing
	it was supposed to test.

tests/debugger/declarative/ho3.exp:
tests/debugger/declarative/ho3.inp:
tests/debugger/declarative/ho4.exp:
tests/debugger/declarative/ho4.inp:
	Input and expected output for the enabled tests.
2002-10-10 19:44:00 +00:00
Mark Brown
5cbec33da5 Add the command 'pd' to the declarative debugger.
Estimated hours taken: 1
Branches: main

Add the command 'pd' to the declarative debugger.  This command returns
to the procedural debugger at the event corresponding to the current
question; it is notionally the inverse of the 'dd' command in the
procedural debugger.

browser/declarative_user.m:
	Handle the new command, and add a new alternative to the
	user_response type.

browser/declarative_oracle.m:
	Handle the new user response, and add a new alternative to the
	oracle_response type.

browser/declarative_debugger.m:
	Handle the new oracle response, and add a new alternative to the
	diagnoser_response type.

	Export some procedures to C so that the back end can interpret the
	new diagnoser response.

	Update an old comment.

trace/mercury_trace_declarative.c:
	Handle the new diagnoser response.  Rename the function
	MR_decl_handle_bug_found, since it now also handles the case
	where a symptom has been found.

	Interpret the diagnoser response using something like a switch,
	rather than something like an if-then-else.  This gives better
	error messages if the diagnoser response type is changed.

doc/user_guide.texi:
	Document the new command.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/pd.exp:
tests/debugger/declarative/pd.inp:
tests/debugger/declarative/pd.m:
	Test the new feature.
2002-10-03 07:34:43 +00:00
Zoltan Somogyi
0f2726ee1a Fix some test case failures.
Estimated hours taken: 0.5
Branches: main

Fix some test case failures.

browser/interactive_query.m:
	Flush the output stream before invoking the compiler, to ensure that
	the output appears in the desired order.

tests/debugger/interactive.{inp,exp}:
	Test only the interactive commands of mdb. The other commands are well
	exercised by the other test cases; duplicating them only leads to
	double maintenance of the expected outputs.
2002-09-27 03:11:10 +00:00
Zoltan Somogyi
b7e55aa8ad Enforce namespace cleanliness in the library and browser directories
Estimated hours taken: 6
Branches: main

Enforce namespace cleanliness in the library and browser directories
as well as in the runtime and trace directories.

Mmake.common.in:
	Move the rules check_namespace here (they used to be in the Mmakefiles
	of the runtime and trace directories), together with the variables they
	need. Generalize them to also handle the needs of the browser, library
	and bytecode directories. The former two in particular need the
	ability to check automatically generated .mh files.

	Make all the rules used by check_namespace conditional on a macro
	that is defined by the Makefiles in all the directories that are
	checked for namespace cleanliness.

trace/Mmakefile:
runtime/Mmakefile:
	Replace the old rules for check_namespace, which are now in
	../Mmake.common.in, with the macros needed to control their behavior.

bytecode/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

	Move the lists of files to the start, before the include of
	../Mmake.common.

browser/Mmakefile:
library/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

runtime/RESERVED_MACRO_NAMES:
	Update comments, and delete obsolete exceptions.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	New files to contain the exceptions from the naming scheme.

tools/bootcheck:
	Invoke "mmake check_namespace" in the library and browser directories
	as well as the runtime and the trace directories. Perform the
	invocation before we delete the object files we are checking for
	cleanliness.

	Clean up object files in all stage2 directories, not just the library,
	as soon as we can.

library/array.m:
library/builtin.m:
library/io.m:
library/time.m:
	Fix namespace violations.
2002-09-24 06:55:36 +00:00
Zoltan Somogyi
5691b9b58e Avoid a warning by adding IO = IO0 in a foreign_proc.
Estimated hours taken: 0.1
Branches: main

browser/util.m:
	Avoid a warning by adding IO = IO0 in a foreign_proc.
2002-09-16 02:26:15 +00:00