Commit Graph

718 Commits

Author SHA1 Message Date
Mark Brown
784dc26cab Fix bugs that were stopping *.res and *.out files being cleaned up properly.
Estimated hours taken: 0.5

Fix bugs that were stopping *.res and *.out files being cleaned up properly.

tests/Mmake.common:
tests/general/accumulator/Mmakefile:
tests/invalid/Mmakefile:
tests/misc_tests/Mmakefile:
tests/tabling/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
tests/warnings/Mmakefile:
	Make cleaning tasks depend on (real)clean_local rather than
	(real)clean.  This is because tests/startup and tests/shutdown
	use the *_local targets.

tests/general/Mmakefile:
	Fix bugs in the recursive mmake calls.
1999-07-14 17:04:41 +00:00
Fergus Henderson
d8cfbaf07a Fix the remaining bugs with the handling of partial qualifiers
Estimated hours taken: 10

Fix the remaining bugs with the handling of partial qualifiers
for nested modules.

compiler/module_qual.m:
	Define a new abstract type partial_qualifier_info, and a predicate
	mq_info_get_partial_qualifier_info to get this type from the mq_info.
	Define a new predicate get_partial_qualifiers/3 in module_qual.m
	which is like the old get_partial_qualifiers/2 predicate from
	modules.m except that it takes a partial_qualifier_info and
	uses the information in this to return only the partial qualifiers
	for modules which are visible, rather than returning all partial
	qualifier regardless of whether the modules that they refer to
	are in scope or not.

compiler/prog_util.m:
	Export the `insert_module_qualifier' predicate, for use in the
	definition of get_partial_qualifiers/3.

compiler/hlds_module.m:
compiler/make_hlds.m:
	Change the code for make_hlds__ctors_add and
	hlds_module__pred_table_insert/5 so that they handles partial
	qualifiers properly, computing the partial qualifiers by
	calling get_partial_qualifiers/3 rather than by checking the
	NeedQual variable and calling get_partial_qualifiers/2.

compiler/modules.m:
	Delete the old get_partial_qualifiers/2 predicate.

compiler/hlds_module.m:
	Add a new field to the HLDS containing the partial_qualifier_info.
	Add a partial_qualifier_info parameter to pred_table_insert/5.

compiler/check_typeclass.m:
compiler/make_hlds.m:
	When calling pred_table_insert/5, get the partial_qualifier_info
	from the HLDS and pass it as an extra argument.

tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/nested.exp:
tests/hard_coded/sub-modules/nested3.exp:
tests/hard_coded/sub-modules/parent.exp:
	Uncomment parts of these test cases which were previously
	commented out because they were not yet supported.

doc/reference_manual.texi:
	Delete the description of this bug.
1999-07-14 14:57:13 +00:00
Simon Taylor
2cf20500b5 The argument offset for higher-order calls was being set
Estimated hours taken: 0.25

compiler/unique_modes.m:
	The argument offset for higher-order calls was being set
	to 0, not 1 (the higher-order term is not included in
	the argument list). This resulted in the argument numbers
	in error messages for higher-order calls being one less
	than expected.

tests/invalid/Mmakefile:
tests/invalid/ho_unique_error.m:
tests/invalid/ho_unique_error.err_exp:
	Test case.
1999-07-14 07:15:37 +00:00
Simon Taylor
c6f349fae4 Fix a cut and paste error - `aditi_modify' goals were
Estimated hours taken: 0.1

compiler/post_typecheck.m:
	Fix a cut and paste error - `aditi_modify' goals were
	being transformed into `aditi_delete' goals.

tests/invalid/aditi_update_mode_errors.m:
	Fix the expected output.
1999-07-14 07:03:38 +00:00
Peter Ross
f897757c22 Update the .cvsignore file.
Estimated hours taken: 0.25

Update the .cvsignore file.
1999-07-14 00:56:21 +00:00
Simon Taylor
2725b1a331 Aditi update syntax, type and mode checking.
Estimated hours taken: 220

Aditi update syntax, type and mode checking.

Change the hlds_goal for constructions in preparation for
structure reuse to avoid making multiple conflicting changes.

compiler/hlds_goal.m:
	Merge `higher_order_call' and `class_method_call' into a single
	`generic_call' goal type. This also has alternatives for the
	various Aditi builtins for which type declarations can't
	be written.

	Remove the argument types field from higher-order/class method calls.
	It wasn't used often, and wasn't updated by optimizations
	such as inlining. The types can be obtained from the vartypes
	field of the proc_info.

	Add a `lambda_eval_method' field to lambda_goals.

	Add a field to constructions to identify which RL code fragment should
	be used for an top-down Aditi closure.

	Add fields to constructions to hold structure reuse information.
	This is currently ignored -- the changes to implement structure
	reuse will be committed to the alias branch.
	This is included here to avoid lots of CVS conflicts caused by
	changing the definition of `hlds_goal' twice.

	Add a field to `some' goals to specify whether the quantification
	can be removed. This is used to make it easier to ensure that
	indexes are used for updates.

	Add a field to lambda_goals to describe whether the modes were
	guessed by the compiler and may need fixing up after typechecking
	works out the argument types.

	Add predicate `hlds_goal__generic_call_id' to work out a call_id
	for a generic call for use in error messages.

compiler/purity.m:
compiler/post_typecheck.m:
	Fill in the modes of Aditi builtin calls and closure constructions.
	This needs to know which are the `aditi__state' arguments, so
	it must be done after typechecking.

compiler/prog_data.m:
	Added `:- type sym_name_and_arity ---> sym_name/arity'.

	Add a type `lambda_eval_method', which describes how a closure
	is to be executed. The alternatives are normal Mercury execution,
	bottom-up execution by Aditi and top-down execution by Aditi.

compiler/prog_out.m:
	Add predicate `prog_out__write_sym_name_and_arity', which
	replaces duplicated inline code in a few places.

compiler/hlds_data.m:
	Add a `lambda_eval_method' field to `pred_const' cons_ids and
	`pred_closure_tag' cons_tags.

compiler/hlds_pred.m:
	Remove type `pred_call_id', replace it with type `simple_call_id',
	which combines a `pred_or_func' and a `sym_name_and_arity'.

	Add a type `call_id' which describes all the different types of call,
	including normal calls, higher-order and class-method calls
	and Aditi builtins.

	Add `aditi_top_down' to the type `marker'.

	Remove `aditi_interface' from type `marker'. Interfacing to
	Aditi predicates is now handled by `generic_call' hlds_goals.

	Add a type `rl_exprn_id' which identifies a predicate to
	be executed top-down by Aditi.
	Add a `maybe(rl_exprn_id)'  field to type `proc_info'.

	Add predicate `adjust_func_arity' to convert between the arity
	of a function to its arity as a predicate.

	Add predicates `get_state_args' and `get_state_args_det' to
	extract the DCG state arguments from an argument list.

	Add predicate `pred_info_get_call_id' to get a `simple_call_id'
	for a predicate for use in error messages.

compiler/hlds_out.m:
	Write the new representation for call_ids.

	Add a predicate `hlds_out__write_call_arg_id' which
	replaces similar code in mode_errors.m and typecheck.m.

compiler/prog_io_goal.m:
	Add support for `aditi_bottom_up' and `aditi_top_down' annotations
	on pred expressions.

compiler/prog_io_util.m:
compiler/prog_io_pragma.m:
	Add predicates
	- `prog_io_util:parse_name_and_arity' to parse `SymName/Arity'
		(moved from prog_io_pragma.m).
	- `prog_io_util:parse_pred_or_func_name_and_arity to parse
		`pred SymName/Arity' or `func SymName/Arity'.
	- `prog_io_util:parse_pred_or_func_and_args' to parse terms resembling
		a clause head (moved from prog_io_pragma.m).

compiler/type_util.m:
	Add support for `aditi_bottom_up' and `aditi_top_down' annotations
	on higher-order types.

	Add predicates `construct_higher_order_type',
	`construct_higher_order_pred_type' and
	`construct_higher_order_func_type' to avoid some code duplication.

compiler/mode_util.m:
	Add predicate `unused_mode/1', which returns `builtin:unused'.
	Add functions `aditi_di_mode/0', `aditi_ui_mode/0' and
	`aditi_uo_mode/0' which return `in', `in', and `out', but will
	be changed to return `di', `ui' and `uo' when alias tracking
	is implemented.

compiler/goal_util.m:
	Add predicate `goal_util__generic_call_vars' which returns
	any arguments to a generic_call which are not in the argument list,
	for example the closure passed to a higher-order call or
	the typeclass_info for a class method call.

compiler/llds.m:
compiler/exprn_aux.m:
compiler/dupelim.m:
compiler/llds_out.m:
compiler/opt_debug.m:
	Add builtin labels for the Aditi update operations.

compiler/hlds_module.m:
	Add predicate predicate_table_search_pf_sym, used for finding
	possible matches for a call with the wrong number of arguments.

compiler/intermod.m:
	Don't write predicates which build `aditi_top_down' goals,
	because there is currently no way to tell importing modules
	which RL code fragment to use.

compiler/simplify.m:
	Obey the `cannot_remove' field of explicit quantification goals.

compiler/make_hlds.m:
	Parse Aditi updates.

	Don't typecheck clauses for which syntax errors in Aditi updates
	are found - this avoids spurious "undefined predicate `aditi_insert/3'"
	errors.

	Factor out some common code to handle terms of the form `Head :- Body'.
	Factor out common code in the handling of pred and func expressions.

compiler/typecheck.m:
	Typecheck Aditi builtins.

	Allow the argument types of matching predicates to be adjusted
	when typechecking the higher-order arguments of Aditi builtins.

	Change `typecheck__resolve_pred_overloading' to take a list of
	argument types rather than a `map(var, type)' and a list of
	arguments to allow a transformation to be performed on the
	argument types before passing them.

compiler/error_util.m:
	Move the part of `report_error_num_args' which writes
	"wrong number of arguments (<x>; expected <y>)" from
	typecheck.m for use by make_hlds.m when reporting errors
	for Aditi builtins.

compiler/modes.m:
compiler/unique_modes.m:
compiler/modecheck_call.m:
	Modecheck Aditi builtins.

compiler/lambda.m:
	Handle the markers for predicates introduced for
	`aditi_top_down' and `aditi_bottom_up' lambda expressions.

compiler/polymorphism.m:
	Add extra type_infos to `aditi_insert' calls
	describing the tuple to insert.

compiler/call_gen.m:
	Generate code for Aditi builtins.

compiler/unify_gen.m:
compiler/bytecode_gen.m:
	Abort on `aditi_top_down' and `aditi_bottom_up' lambda
	expressions - code generation for them is not yet implemented.

compiler/magic.m:
	Use the `aditi_call' generic_call rather than create
	a new procedure for each Aditi predicate called from C.

compiler/rl_out.pp:
compiler/rl_gen.m:
compiler/rl.m:
	Move some utility code used by magic.m and call_gen.m into rl.m.

	Remove an XXX comment about reference counting being not yet
	implemented - Evan has fixed that.

library/ops.m:
compiler/mercury_to_mercury.m:
doc/transition_guide.texi:
	Add unary prefix operators `aditi_bottom_up' and `aditi_top_down',
	used as qualifiers on lambda expressions.
	Add infix operator `==>' to separate the tuples in an
	`aditi_modify' call.

compiler/follow_vars.m:
	Thread a `map(prog_var, type)' through, needed because
	type information is no longer held in higher-order call goals.

compiler/table_gen.m:
	Use the `make_*_construction' predicates in hlds_goal.m
	to construct constants.

compiler/*.m:
	Trivial changes to add extra fields to hlds_goal structures.

doc/reference_manual.texi:
	Document Aditi updates.

	Use @samp{pragma base_relation} instead of
	@samp{:- pragma base_relation} throughout the Aditi documentation
	to be consistent with other parts of the reference manual.

tests/valid/Mmakefile:
tests/valid/aditi_update.m:
tests/valid/aditi.m:
	Test case.

tests/valid/Mmakefile:
	Remove some hard-coded --intermodule-optimization rules which are
	no longer needed because `mmake depend' is now run in this directory.

tests/invalid/*.err_exp:
	Fix expected output for changes in reporting of call_ids
	in typecheck.m.

tests/invalid/Mmakefile
tests/invalid/aditi_update_errors.{m,err_exp}:
tests/invalid/aditi_update_mode_errors.{m,err_exp}:
	Test error messages for Aditi updates.

tests/valid/aditi.m:
tests/invalid/aditi.m:
	Cut down version of extras/aditi/aditi.m to provide basic declarations
	for Aditi compilation such as `aditi__state' and the modes
	`aditi_di', `aditi_uo' and `aditi_ui'. Installing extras/aditi/aditi.m
	somewhere would remove the need for these.
1999-07-13 08:55:28 +00:00
Fergus Henderson
0705c72cf0 Fix some of the bugs with the handling of partial qualifiers
Estimated hours taken: 4

Fix some of the bugs with the handling of partial qualifiers
for nested modules.  With this change, we now handle partial
qualifiers correctly for types, insts, modes, and type classes,
which are handled by module_qual.m.  We still don't get it quite
right for constructors, functions, and predicates, for which
module qualification is handled by other modules (make_hlds.m,
hlds_module.m, typecheck.m, post_typecheck.m, and modecheck_unify.m).

compiler/module_qual.m:
	Keep track of which modules are visible.
	When looking up a qualified symbol, check that the specified module
	is visible.

tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
	Uncomment parts of these test cases which were previously
	commented out because they were not yet supported.
1999-07-12 15:14:31 +00:00
Mark Brown
55d0d482c6 Provide a more uniform interface to the test directories.
Estimated hours taken: 9

Provide a more uniform interface to the test directories.  Before this
change, the tests directory as well as direct descendents had `runtests'
scripts to execute the tests.  These would run `mmake', which in turn
would recursively run `mmake' in any subdirectories.  The subdirectories
did not have their own `runtests' scripts.

This change adds a `runtests' script to those subdirectories that did
not have them before.  The scripts have the same meaning as they did
previously---run all tests in the current directory and below, and
return a status of 0 only if all tests pass.

The rationale for this change is so that each directory in the tests
is treated the same, regardless of whether it is a top-level
directory or not.  This means, for example, that any test directory can
be used as an argument to the `--test-dir' option to tools/bootcheck.

This change also links tests/general/accumulator into the automated
testing suite.

tests/README:
	Update comments.

tests/Mmake.common:
	Introduce new target dependencies.  Targets of the form
	`foo' depend on the targets `foo_local' and `foo_subdirs'.

tests/subdir_runtests:
	New script to recursively call runtests scripts in subdirectories.
	Most of the code for this script originally came from
	tests/runtests.

tests/shutdown:
tests/startup:
	Use `realclean_local' as a target instead of `realclean', since
	the subdirectories will be handled by other runtests scripts.

tests/runtests:
tests/debugger/runtests:
tests/general/runtests:
tests/hard_coded/runtests:
	Use the new script to run tests in the subdirectories, rather
	than doing a recursive mmake.  Make sure that non-zero return
	values are propagated upwards where appropriate.

tests/debugger/declarative/runtests:
tests/hard_coded/typeclasses/runtests:
tests/hard_coded/sub-modules/runtests:
	New scripts to handle running tests in the subdirectories.

tests/debugger/Mmakefile:
tests/general/Mmakefile:
tests/hard_coded/Mmakefile:
	Add `*_subdirs' targets that do a recursive Mmake.  Change the
	existing targets to `*_local' ones.

tests/warnings/Mmakefile:
	Manually add the extra dependencies, since this Mmakefile does
	not include tests/Mmake.common.
1999-07-12 06:26:05 +00:00
David Jeffery
53ec1dcfb3 Set the head_type_params field of class methods properly. (ie. add
Estimated hours taken: 2

compiler/typecheck.m:
        Set the head_type_params field of class methods properly. (ie. add
        the existentially quantified tvars as well).

compiler/hard_coded/typeclasses/typeclass_exist_method.m:
        A test case for this.
compiler/hard_coded/typeclasses/Mmakefile:
        Turn this test case on.
1999-07-10 03:39:07 +00:00
Fergus Henderson
afa09e8073 Rename some things to avoid name clashes with functions recently
Estimated hours taken: 0.5

tests/hard_coded/boyer.m:
tests/hard_coded/curry.m:
tests/hard_coded/higher_order_func_test.m:
	Rename some things to avoid name clashes with functions recently
	added to the standard library.  The name clashes resulted in
	ambiguity errors during type checking.
1999-07-08 10:03:55 +00:00
Fergus Henderson
8c97633e71 Allow construction unifications for existentially typed functors,
Estimated hours taken: 6

Allow construction unifications for existentially typed functors,
using the syntax "X = 'new foo'(Y)" rather than the usual "X = foo(Y)".
We need to use a special syntax for exisentially typed constructions
because type analysis and polymorphism need to know which occurrences
of existentially typed functors are constructors and which are deconstructors.

Note that we still don't yet support RTTI for existentially typed data types.

compiler/typecheck.m:
	For existentially typed functors, allow the functor to have
	a "new " prefix, and if so, make the quantifiers and constraints
	universal rather than existential.

compiler/polymorphism.m:
	For unifications with existentially typed functors,
	check for a "new " prefix on the functor.
	If the functor has such a prefix, strip off the prefix,
	and treat the unification as a construction rather than
	treating it as a deconstruction.

compiler/type_util.m:
	Define a new predicate `remove_new_prefix', for use by typecheck.m
	and polymorphism.m.

compiler/modecheck_unify.m:
	For construction unifications, check that all the type_info
	and typeclass_info arguments introduced by polymorphism.m
	are ground.

tests/hard_coded/typeclasses/existential_data_types.m:
	Change the test case to use this new feature,
	rather than hacking it using the C interface.

doc/reference_manual.texi:
	Document the new features.
1999-07-08 08:15:29 +00:00
Tyson Dowd
7f1fe01b9a Add this file, I forgot to cvs add it earlier.
Estimated hours taken: 0.1

tests/hard_coded/deep_copy.exp:
	Add this file, I forgot to cvs add it earlier.
1999-07-06 06:34:03 +00:00
Tyson Dowd
eae3174a2c Add MR_TYPECTOR_REP_* to the type_ctor_info to describe the
Estimated hours taken: 30  (including debugging)

Add MR_TYPECTOR_REP_* to the type_ctor_info to describe the
representation of this type.

We want to do this because it allows us to check quickly to see
what kind of data representation is being used.  Previously this
information was spread throughout the type_ctor_layout and
type_ctor_functors data structures.  It was complex to interpret
and contained a lot of unnecessary duplication.

We can now omit data structures such as the type_ctor_layout in many
cases (it is only necessary for discriminated unions).  Because we rule
out some of the possible alternatives, the encodings used in the
type_ctor_layout can be simplified.  Also, the functors indicator in
type_ctor_functors can be removed, as it subsumed by this data
structure.

Use this representation in code that uses RTTI.

compiler/base_type_info.m:
	Add a missing alternative to the type_ctor_rep (this was a
	bug).

library/array.m:
library/builtin.m:
library/private_builtin.m:
runtime/mercury_bootstrap.c:
	Use MR_TYPECTOR_REP_* in the type_ctor_infos for builtin types.

library/std_util.m:
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
	Use MR_TYPECTOR_REP_* and MR_DISCUNION_TAG_* to dispatch on
	data representations.

	Also, fix a bug in deep_copy when copying floating point values.
	I'm not sure when this stopped working, or if this is exactly
	the right fix, but it is more correct than the previous code.

runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
	Update code to use MR_TYPECTOR_REP_*.
	Use a struct for type_ctor_info.

tests/hard_coded/Mmakefile:
tests/hard_coded/deep_copy.m:
tests/hard_coded/deep_copy.exp:
	Add a test case for deep_copy.
1999-07-06 06:32:33 +00:00
Mark Brown
204928ac9c Deep copy some data to the global heap, as it may need to be
Estimated hours taken: 6

trace/mercury_trace_declarative.c:
	Deep copy some data to the global heap, as it may need to be
	used after being backtracked over.

tests/debugger/declarative/Mmakefile:
	Re-enable the test that was failing due to this bug.
1999-07-05 04:17:48 +00:00
Fergus Henderson
064e6ffa1e Delete a line that I had accidentally added in my previous change.
Estimated hours taken: 0.1

tests/invalid/Mmakefile:
	Delete a line that I had accidentally added in my previous change.
1999-07-01 08:30:34 +00:00
Fergus Henderson
ec86c88404 Merge in the changes from the existential_types_2 branch.
Estimated hours taken: 4

Merge in the changes from the existential_types_2 branch.

This change adds support for mode re-ordering of code involving
existential types.  The change required modifying the order of the
compiler passes so that polymorphism comes before mode analysis,
so that mode analysis can check the modes of the `type_info' or
`typeclass_info' variables that polymorphism introduces, so that
it can thus re-order the code accordingly.

This change also includes some more steps towards making existential data
types work.  In particular, you should be able to declare existentially
typed data types, the compiler will generate appropriate unification
and compare/3 routines for them, and deconstruction unifications for them
should work OK.  However, currently there's no way to construct them
except via `pragam c_code', and we don't generate correct RTTI for them,
so you can't use `io__write' etc. on them.

library/private_builtin.m:
compiler/accumulator.m:
compiler/bytecode_gen.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/code_util.m:
compiler/common.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/follow_code.m:
compiler/follow_vars.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/magic.m:
compiler/make_hlds.m:
compiler/mercury_compile.m:
compiler/mercury_to_c.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_util.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/pd_cost.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/purity.m:
compiler/quantification.m:
compiler/rl_exprn.m:
compiler/rl_key.m:
compiler/simplify.m:
compiler/table_gen.m:
compiler/term_traversal.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unused_args.m:
compiler/notes/compiler_design.html:
doc/reference_manual.texi:
tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/existential_data_types.m:
tests/hard_coded/typeclasses/existential_data_types.exp:
tests/warnings/simple_code.exp:
tests/hard_coded/Mmakefile:
tests/term/arit_exp.trans_opt_exp:
tests/term/associative.trans_opt_exp:
tests/term/pl5_2_2.trans_opt_exp:
tests/term/vangelder.trans_opt_exp:
tests/term/arit_exp.trans_opt_exp:
tests/term/associative.trans_opt_exp:
tests/term/pl5_2_2.trans_opt_exp:
tests/term/vangelder.trans_opt_exp:
tests/invalid/errors2.err_exp2:
tests/invalid/prog_io_erroneous.err_exp2:
tests/invalid/type_inf_loop.err_exp2:
tests/invalid/types.err_exp2:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/Mmakefile:
tests/warnings/simple_code.exp:
tests/debugger/queens.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/existential_reordering.m:
tests/hard_coded/existential_reordering.exp:
	Merge in the changes from the existential_types_2 branch.
1999-06-30 17:13:53 +00:00
Fergus Henderson
0bf21c2c6c Update the expected output for these test cases to reflect the
Estimated hours taken: 0.1

tests/debugger/queens.exp:
tests/debugger/browser_test.exp:
tests/debugger/interpreter.exp:
tests/debugger/interpreter.exp2:
	Update the expected output for these test cases to reflect the
	renumbering of mdb variables starting from 1 rather than from 0.
1999-06-30 15:51:01 +00:00
Fergus Henderson
1c870062cf Update the expected output for these test cases to reflect the
Estimated hours taken: 0.1

tests/debugger/queens.exp:
tests/debugger/browser_test.exp:
tests/debugger/interpreter.exp:
tests/debugger/interpreter.exp2:
	Update the expected output for these test cases to reflect the
	renumbering of mdb variables starting from 1 rather than from 0.
1999-06-30 15:51:00 +00:00
Fergus Henderson
6ab3c8111a Update the input file to match the new variable numbering scheme
Estimated hours taken: 0.25

tests/debugger/browser_test.inp:
	Update the input file to match the new variable numbering scheme
	(variable numbers now start from 1 rather than from 0).
1999-06-26 17:01:56 +00:00
Peter Ross
9622ec3bbe Fix bug where unification of two variables with identical bound inst
Estimated hours taken: 5

Fix bug where unification of two variables with identical bound inst
lists were incorrectly being inferred det.

tests/warnings/Mmakefile:
tests/warnings/det_infer_warning.exp:
tests/warnings/det_infer_warning.m:
    Test case to exercise the bug.

mercury/compiler/inst_util.m:
    Handle bound inst lists of length > 1 correctly.
1999-06-23 04:17:57 +00:00
Peter Ross
71d5cac51c Test cases for accumulator introduction.
Estimated hours taken: 50

Test cases for accumulator introduction.


INTRODUCED:
    Special file which records which procedures should be optimised.

README:
    Explain what the INTRODUCED file is for.

runtests:
    Run the tests.

base.exp:
base.m:
call_in_base.exp:
call_in_base.m:
chain.exp:
chain.m:
construct.exp:
construct.m:
dcg.exp:
dcg.m:
deconstruct.exp:
deconstruct.m:
disj.exp:
disj.m:
heuristic.exp:
heuristic.m:
highorder.exp:
highorder.m:
identity.exp:
identity.m:
inter.exp:
inter.m:
nonrec.exp:
nonrec.m:
out_to_in.exp:
out_to_in.m:
qsort.exp:
qsort.m:
simple.exp:
simple.m:
split.exp:
split.m:
swap.exp:
swap.m:
    The actual tests.

Mmakefile:
    the usual.
1999-06-16 06:19:37 +00:00
Simon Taylor
47c8617b8e Added `set_goal_contexts', which sets all the contexts
Estimated hours taken: 1

compiler/hlds_goal.m:
	Added `set_goal_contexts', which sets all the contexts
	of the goal_infos of the sub-goals of a goal.

compiler/unify_proc.m:
	Use `set_goal_contexts' to ensure that error messages
	for automatically generated procedures have a useful context.

tests/invalid/partial_implied_mode.err_exp:
	Update the expected output.
1999-06-16 00:39:24 +00:00
Fergus Henderson
6f7e94e67d Undo previous change -- I had accidentally committed it on the
Estimated hours taken: 0.1

tests/warnings/simple_code.exp:
	Undo previous change -- I had accidentally committed it on the
	main branch rather than on the existential_types_2 branch.
1999-06-13 01:08:48 +00:00
Fergus Henderson
2c98328a0b Various changes to fix test case failures in the existential_types_2
Estimated hours taken: 8

Various changes to fix test case failures in the existential_types_2
branch.

compiler/simplify.m:
	Delete a bogus sanity check that I had added, since the check
	was failing even in cases which made perfect sense.
	(This one was stopping the compiler from bootstrapping.)

	Delete an obsolete XXX comment about something that has already
	been fixed.

	When converting polymorphic complicated unifications into
	calls to unification procedures, we need to insert the
	type_info variables into the goal_info non-locals set.

compiler/simplify.m:
compiler/det_report.m:
	Fix a couple of old XXXs: issue warnings when optimizing away
	goals with determinism failure or det goals that have no outputs.
	This is needed to ensure that we still issue a warning for several
	of the goals in tests/warnings/simple_code.m.  The previous
	warnings were no longer being issued because this optimization was
	optimization away the relevant code before it could be warned about.

tests/warnings/simple_code.exp:
	Update to reflect the new warnings.

compiler/dependency_graph.m:
	Don't include imported modes of pseudo_imported predicates
	(i.e. (in,in) modes of unification predicates) in the dependency
	graph.  The treatment of pseudo_imported predicates in
	dependency_graph.m needs to match the way they are treated
	by polymorphism.m and other parts of the compiler.

compiler/polymorphism.m:
	Update the headvars field of the proc_info for imported procedures
	to include the type_info variables.  This is necessary because
	some parts of the compiler (e.g. unused_args.m) depend on the
	headvars field being valid even for imported procedures.

	Also fix a bug introduced in my changes to polymorphism.m -- I was
	passing down the wrong HeadVars to polymorphism__produce_existq_tvars.

compiler/post_typecheck.m:
compiler/purity.m:
	Ensure that we always bind any unbound type variables to `void'
	before running polymorphism, even if there were type errors.
	This avoids some internal errors in polymorphism.m.

compiler/mercury_compile.m:
	Fix a formatting error in one of the progress messages.

compiler/modes.m:
compiler/unique_modes.m:
	Ensure that mode analysis always stops analysing things once the
	instmap becomes unreachable.  It already did this for conjunctions,
	most of the time, but there were several other cases
	(if-then-elses and switches) where it did not.
	The aim of this change is to stop mode inference from creating
	modes for procedures with initial insts `not_reached'.

compiler/modecheck_unify.m:
	Handle the case where an unification is initially inferred as
	a non-complicated unification, and then gets re-modechecked
	with the instmap being unreachable.  The code here was assuming
	that a non-complicated unification can never get turned into
	a complicated unification on re-modechecking, but `not_reached'
	unifications where being classified as complicated.
	The above change to modes.m and unique_modes.m should avoid this
	situation, but I thought it was safest to fix the code here too,
	just in case.

compiler/modes.m:
compiler/modecheck_call.m:
compiler/mode_util.m:
	Pass the type down to normalise_inst and ensure that for type_info
	types, it never return a unique inst.  The aim is to stop mode
	inference from inferring unique modes for the type_info arguments
	introduce by polymorphism.m, since unique modes are never useful
	for those arguments, and allowing mode inference to infer
	unique modes for them leads to it inferring unnecessarily many modes.

	(Without this change, the test case tests/valid/uniq_mode_inf_bug.m
	fails, due to a bug in the existing mode inference stuff unrelated
	to my polymorphism / existential types changes.  The bug is that
	modecheck_queued_procs needs to run ordinary mode analysis to a
	fixpoint before running determinism analysis, etc.)

tests/hard_coded/Mmakefile:
	Fix a bug: compile lp.m with the same options as bigtest.m.
	Without this, bigtest was getting link errors due to unsatisfied
	symbols in lp.m.  The problem was due to bigtest.m being compiled
	with intermodule optimization, and lp.m being compiled without
	intermodule optimization.  This lead to bigtest.o containing
	inlined references to local routines in lp.m, but lp.o not exporting
	those symbols because intermodule optimization had not been enabled
	when it was compiled.
1999-06-12 00:50:56 +00:00
Fergus Henderson
58eb75f18c Fix a quoting bug that caused the compiler to generate `.opt' files
Estimated hours taken: 1

Fix a quoting bug that caused the compiler to generate `.opt' files
containing syntax errors.

compiler/mercury_to_mercury.m:
compiler/hlds_out.m:
	Fix some more quoting problems: it was not properly quoting
	certain subterms when they occurred immediately before the final
	`.' at the end of a term.

tests/valid/intermod_quote2.m:
	Add some regression tests for the above bug fix.

tests/valid/Mmakefile:
	Fix a bug in the Mmakefile that meant that the intermod_quote
	test didn't work properly when --use-subdirs was enabled.
1999-06-09 16:39:47 +00:00
Mark Brown
00ed26d462 Disable a failing test, while a fix is being prepared.
Estimated hours taken: 0.1

Disable a failing test, while a fix is being prepared.

tests/debugger/declarative/Mmakefile:
	Disable the `app' test case.
1999-06-04 07:12:33 +00:00
Mark Brown
5db4b3befd Make declarative debugging enabled by default, and add test cases.
Estimated hours taken: 4

Make declarative debugging enabled by default, and add test cases.
The declarative debugger, while not complete, is fairly stable so
users will be able to experiment with it after this change without
having to re-configure the whole system.  However, the main motivation
for this change is so that developers who make changes to the system
will have access to these test cases.

configure.in:
	Turn the decl-debug feature on by default.

tests/debugger/declarative:
	New directory containing tests for the declarative debugger.

tests/debugger/declarative/*.m:
tests/debugger/declarative/*.inp:
tests/debugger/declarative/*.exp:
	Declarative debugger test cases.

tests/debugger/declarative/Mmakefile:
	Mmakefile to do the declarative debugger tests.

tests/debugger/Mmakefile:
	For each target, make the corresponding target in the
	'declarative' subdirectory.

WORK_IN_PROGRESS:
	Document the new (incomplete) feature.
1999-06-02 07:29:00 +00:00
Zoltan Somogyi
f143c3891f Get the debugger to sort variables better.
Estimated hours taken: 12

Get the debugger to sort variables better.

trace/mercury_trace_vars.[ch]:
	A new module to manage the debugger's information about the variables
	live at the current program point (which can be defined as the
	combination of a specific event and an ancestor level).

	This new module centralizes the management of the (sorted) list of
	current variables. This in turn allows us to use a better sorting
	method, one that orders VarName15 correctly wrt both VarName2 and
	VarName.

	The new module also uses the type, not the name, of a variable
	to decide whether to exclude it from the list of variables
	that may be presented to the user (e.g. if it is a typeinfo
	or a typeclassinfo).

trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
	Use the new module's facilities. This factors out some "mostly"
	common code.

trace/Mmakefile:
	Add the new module.

runtime/mercury_layout_util.[ch]:
	Remove the code recently moved here from trace/mercury_trace_internal,
	as well as the filtered versions of some functions, since they are
	not needed anymore.

	Move the code for MR_make_var_list to trace/mercury_trace_external,
	since that is the only place where it is used (or is at all likely
	to be used). Since its new home is next to several very similar
	functions, this should also reduce the probability that any required
	maintenance will be overlooked. Also alter its coding style to conform
	to its new neighbours.

	Move the definition of MR_Var_Spec to trace/mercury_trace_vars.h.

tests/debugger/*.exp:
	Update the expected output files. In most cases, this is just because
	the new module outputs different white space, but in some cases, it
	also reflects that the debugger now prints variables in a different
	order.
1999-05-27 01:01:33 +00:00
Simon Taylor
1d05aece38 Update the line numbers which changed after Zoltan's
Estimated hours taken: 0.1

tests/invalid/partial_implied_mode.err_exp:
	Update the line numbers which changed after Zoltan's
	change to stop putting #line directives in .int files.
1999-05-19 04:19:25 +00:00
Simon Taylor
5f7880aca3 Fix a code generator abort reported by Stephane Marie
Estimated hours taken: 10

Fix a code generator abort reported by Stephane Marie
<stephane.marie@detexis.thomson-csf.com>.

The bug was in the code to work out the instmap after a deconstruction
unification with complicated sub-unifications.
The instmap_delta for the unification contained only the bindings for
the first argument for which a new variable was created.

The test case now gives an error during mode analysis
rather than a code generator abort (for unification procedures
of imported types) or a mode error during unique mode analysis
(for local types).

compiler/modes.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
	Simplify the code to handle extra goals by not attempting
	to bodge together the instmap after the main goal.
	Instead, the code now creates the extra unifications and
	rechecks the goal with the unifications added.

compiler/mode_info.m:
	Add a field to say whether we are reprocessing a goal after
	adding extra goals. Abort if the reprocessing adds more extra goals.

	The `may_changed_called_proc' field is now separate from
	the `how_to_check_goal' field. This is used to avoid
	repeating the search for the best procedure when rerunning
	mode analysis after adding the extra goals.

compiler/modecheck_unify.m:
	Removed predicate unify_vars - it is no longer used.

compiler/unify_proc.m:
	Call module_info_remove_predid if there are mode errors
	in a unification procedure to avoid spurious determinism
	errors.

tests/hard_coded/Mmakefile:
tests/hard_coded/partial_implied_mode.m:
tests/hard_coded/partial_implied_mode.err_exp:
	Test case. It would be nicer if the error message pointed
	to the unification which caused the unification procedure
	to be created, rather than the type declaration in the
	interface file.
1999-05-18 03:09:21 +00:00
Mark Brown
2bbf02daaf Use the same method of input for the browser as for the internal
Estimated hours taken: 5

Use the same method of input for the browser as for the internal
tracer.  Previously, the browser did input via the Mercury library
and the internal tracer did input via readline (if available).  This
did not work properly if files were redirected into stdin, which meant
that test cases could not be written for the browser.  This change
also adds a test case.

browser/util.m:
	Add a predicate, util__trace_getline/4, which does input via
	the same method used by the internal debugger.

browser/parse.m:
	Call util__trace_getline/4 instead of io__read_line/3.

browser/browse.m:
	Pass the prompt to browser/parse.m as a string, rather than
	printing it before calling.

trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	Declare MR_trace_getline extern.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
	Make MR_trace_getline available to the browser via a function
	pointer.

tests/debugger/Mmakefile:
	Add the new test case.

tests/debugger/browser_test.m:
tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
	The new test case.

runtime/mercury_trace_base.c:
runtime/mercury_trace_base.h:
	Export MR_tracing_not_enabled() for use by browser/util.m.
1999-05-14 02:25:53 +00:00
Zoltan Somogyi
6d01e1fc39 Fix a backward test.
Estimated hours taken: 0.1

tests/tabling/Mmakefile:
	Fix a backward test.
1999-04-30 04:17:49 +00:00
Zoltan Somogyi
7459bfc88b Fix the misclassification of two tests that need to be executed
Estimated hours taken: 0.1

tests/tabling/Mmakefile:
	Fix the misclassification of two tests that need to be executed
	with minimal model tabling enabled.
1999-04-25 11:16:33 +00:00
Simon Taylor
79dcbbef15 User-guided type specialization.
Estimated hours taken: 60

User-guided type specialization.

compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/modules.m:
compiler/module_qual.m:
compiler/mercury_to_mercury.m:
	Handle `:- pragma type_spec'.

compiler/prog_io_pragma.m:
	Factor out some common code to parse predicate names with arguments.

compiler/hlds_module.m:
	Added a field to the module_sub_info to hold information about
	user-requested type specializations, filled in by make_hlds.m
	and not used by anything after higher_order.m.

compiler/make_hlds.m:
	For each `:- pragma type_spec' declaration, introduce a new predicate
	which just calls the predicate to be specialized with the
	specified argument types. This forces higher_order.m to produce
	the specialized versions.

compiler/higher_order.m:
	Process the user-requested type specializations first to ensure
	that they get the correct names.
	Allow partial matches against user-specified versions, e.g.
		map__lookup(map(int, list(int)), int, list(int)) matches
		map__lookup(map(int, V), int, V).
	Perform specialization where a typeclass constraint matches a
	known instance, but the construction of the typeclass_info is
	done in the calling module.
	Give slightly more informative progress messages.

compiler/dead_proc_elim.m:
	Remove specializations for dead procedures.

compiler/prog_io_util.m:
	Change the definition of the `maybe1' and `maybe_functor' types
	to avoid the need for copying to convert between `maybe1'
	and `maybe1(generic)'.
	Changed the interface of `make_pred_name_with_context' to allow
	creation of predicate names for type specializations which describe
	the type substitution.

compiler/make_hlds.m:
compiler/prog_io_pragma.m:
	Make the specification of pragma declarations in error
	messages consistent. (There are probably some more to
	be fixed elsewhere for termination and tabling).

compiler/intermod.m:
	Write type specialization pragmas for predicates declared
	in `.opt' files.

compiler/mercury_to_mercury.m:
	Export `mercury_output_item' for use by intermod.m.

compiler/options.m:
	Add an option `--user-guided-type-specialization' enabled
	with `-O2' or higher.

compiler/handle_options.m:
	`--type-specialization' implies `--user-guided-type-specialization'.

compiler/hlds_goal.m:
	Add predicates to construct constants. These are duplicated
	in several other places, I'll fix that as a separate change.

compiler/type_util.m:
	Added functions `int_type/0', `string_type/0', `float_type/0'
	and `char_type/0' which return the builtin types.
	These are duplicated in several other places,
	I'll fix that as a separate change.

library/private_builtin.m:
	Added `instance_constraint_from_typeclass_info/3' to extract
	the typeclass_infos for a constraint on an instance declaration.
	This is useful for specializing class method calls.
	Added `thread_safe' to various `:- pragma c_code's.
	Added `:- pragma inline' declarations for `builtin_compare_*', which
	are important for user-guided type specialization. (`builtin_unify_*'
	are simple enough to go in the `.opt' files automatically).

compiler/polymorphism.m:
	`instance_constraint_from_typeclass_info/3' does not need type_infos.
	Add `instance_constraint_from_typeclass_info/3' to the
	list of `typeclass_info_manipulator's which higher_order.m
	can interpret.

NEWS:
doc/reference_manual.texi:
doc/user_guide.texi
	Document the new pragma and option.

tests/invalid/Mmakefile:
tests/invalid/type_spec.m:
tests/invalid/type_spec.err_exp:
	Test error reporting for invalid type specializations.

tests/hard_coded/Mmakefile:
tests/invalid/type_spec.m:
tests/invalid/type_spec.exp:
	Test type specialization.
1999-04-23 01:03:51 +00:00
Zoltan Somogyi
b99cb7b77e Add the file tests/tabling/repeat.m, which I accidentally left out of my
Estimated hours taken: 0

Add the file tests/tabling/repeat.m, which I accidentally left out of my
recent changes.
1999-04-22 08:10:05 +00:00
Fergus Henderson
b852ffd462 Update the line numbers in the expected output;
Estimated hours taken: 0.1

tests/warnings/simple_code.exp:
	Update the line numbers in the expected output;
	my previous change to simple_code.m added a comment
	which caused the line numbers in the warnings to change.
1999-04-20 14:53:38 +00:00
Zoltan Somogyi
dc03496d06 Rewrite significant parts of minimal model tabling so that it works
Estimated hours taken: 130

Rewrite significant parts of minimal model tabling so that it works
in a much wider variety of situations, including coups. Also, clean up
the tabling implementation to make it more maintainable, and introduce
a new grade component, .mm, that enables minimal model tabling.
(Minimal model tabling requires distributed fat, and we don't want to
incur such costs unless necessary.)

compiler/options.m:
	Add a new option --use-minimal-model, which for now is documented
	as "not for general use". This option is a grade option, and is
	required if minimal model tabling is to work.

compiler/handle_options.m:
	When --use-minimal-model is given, do not allow nondet frame hijacks,
	since minimal model tabling cannot cope with hijacks.

	Make --use-minimal-model a grade component.

compiler/code_info.m:
	When --use-minimal-model is given, insert calls to MR_commit_{mark,cut}
	around goals being committed across. This is now necessary, so that we
	can detect and handle sitations where a goal being committed across
	starts but does not complete a tabled goal.

compiler/table_gen.m:
	Rename many of the tabling helper predicates, using a naming scheme
	that separates predicates used for model_non procedures from those
	used to implement simpler forms of tabling, while bringing out
	the parallels between these two sets of predicates.

	When calls to two tabling helper predicates always occur
	one after the other, merge the two into one.

	Generate and use more meaningful variable names; having all of the
	several variables inserted by this transformation named TableVar
	was quite confusing.

library/private_builtin.m:
	Reorganize this file, to separate out the different sections.
	The contents of the non-tabling sections were not modified, only
	moved around.

	Rename the predicates referred to by table_gen.m.

	Move most of the type declarations and complex code out of here,
	into runtime/mercury_tabling.c. This makes it easier to debug them,
	since (a) creating a new executable is quicker, since you don't have
	to wait for lots of mercury compiler invocations, and (b) gdb doesn't
	get confused by #line directives. It also makes it easier to write
	them, since you don't have to !&(*U&( remember to double all your
	double quotes and to backslash all your backslashes.

runtime/mercury_grade.h:
	Include a grade component reflecting whether MR_USE_MINIMAL_MODEL
	is defined.

runtime/mercury_conf_param.h:
	Document MR_USE_MINIMAL_MODEL.

runtime/mercury_stacks.[ch]:
	The changes to tabling require the addition of two new stacks,
	the generator stack and the cut stack. This module defines the
	structures of the frames of these stacks and provides the
	operations on these stacks.

	The header file also contains some additional macros that return
	the addresses of fixed nondet stack slots, not their contents,
	for use by tabling code.

runtime/mercury_context.[ch]:
runtime/mercury_memory.[ch]:
runtime/mercury_wrapper.[ch]:
	Declare and set up the two new stacks, both in saved contexts and in
	the active context, if MR_USE_MINIMAL_MODEL is defined.

runtime/mercury_regorder.h:
	Add four new global virtual machine registers to hold pointers
	to the memory areas of the two new stacks and the current offsets
	within them. These are defined whether MR_USE_MINIMAL_MODEL is defined
	or not, since the cost is minimal and the potential bugs we avoid
	would be hard to track down.

runtime/mercury_engine.h:
runtime/mercury_wrapper.c:
	Add support for a new debugging flag, -dS, which prints the contents
	of the nondet stack at several points during tabling.

runtime/mercury_tabling.[ch]:
	The implementation of the new tabling system. Much of the new code here
	is stuff moved from library/private_builtin.m, but in a significantly
	rewritten form. There is also substantial new code, e.g. to handle
	the extension of saved stack segments, and to manage dependencies
	between subgoals in general.

	Improve the documentation considerably.

	Replace lists stored as Mercury data structures with lists stored
	as linked structures in the usual C fashion. This allows us to use
	debuggers such as ddd on these data structures, whose complexity
	requires this.

	Ensure that global names start with MR_.

runtime/mercury_init.h:
	Explicitly include mercury_regs.h at the start. Without this,
	we get an error, because now mercury_wrappers.h, which mercury_init.h
	includes, also includes mercury_regs.h, but not before functions
	have been declared.

runtime/Mmakefile:
	Refer to the new file mercury_stacks.c (mercury_stacks.h already
	existed, but the module consisted entirely of macros.)

	Fix a sorting error.

scripts/{init,parse,final}_grade_options.sh-subr:
scripts/mgnuc.in:
	Handle the new grade component.

tests/tabling/*
	Add several new test cases that we now pass, most of which we couldn't
	pass before. Also add some new test cases that we don't pass yet,
	due to interactions between tabling and negated contexts.

trace/mercury_trace_internal.c:
	If MR_USE_MINIMAL_MODEL is defined, add a new command to print
	the generator stack. (The new command is deliberately not documented
	in doc/mdb_doc yet, since (a) it is intended for developers only,
	and (b) there is no way to test MR_USE_MINIMAL_MODEL in mdb_doc.)
1999-04-20 11:48:56 +00:00
Zoltan Somogyi
9a2a5e0d68 Explicitly specify --no-line-numbers for the pretty_print_test,
Estimated hours taken: 0.2

tests/misc_tests/Mmakefile:
	Explicitly specify --no-line-numbers for the pretty_print_test,
	since my recent change made --line-numbers the default.
1999-04-17 08:08:10 +00:00
Fergus Henderson
3018d7abb2 Perform some minor simplifications in mode analysis,
Estimated hours taken: 1.5

Perform some minor simplifications in mode analysis,
so as to provide more information to unique mode analysis.
Previously unique_modes.m was reporting spurious errors
for tests/hard_coded/bidirectional.m, because modes.m
produced output containing a subgoal of the form
`disj([Goal, conj([disj([])]])' instead of just `Goal',
and the presence of a disjunction then caused unique mode
analysis to make overly conservative assumptions.

compiler/modes.m:
	Ensure that we do not produce singleton conjunctions or disjunctions.
	Also, if the result of mode checking a disjunct is a (nested)
	disjunction, then merge it with the containing disjunction.
	If the nested disjunction is the empty disjunction (fail),
	then this means it will be deleted.

tests/hard_coded/Mmakefile:
	Re-enable the test case bidirectional.m, since the compiler now
	accepts it, due to the above change.

tests/warnings/simple_code.m:
tests/warnings/simple_code.exp:
	Update this test case, because the above change meant that the
	compiler no longer issues the warning about "this disjunct can
	never succeed" in cases like this -- mode analysis will already
	have optimized it away, before we even get to simplify.m (which
	handles those kinds of warnings).  This warning is not as
	important as allowing bidirectional code.
1999-04-16 08:08:08 +00:00
Fergus Henderson
9e7ab444be Fix a bug in unique mode checking.
Estimated hours taken: 4

Fix a bug in unique mode checking.

compiler/unique_modes.m:
	Fix a bug reported by Serge Varennes
	<serge.varennes@detexis.thomson-csf.com>:
	we need to mark variables as `mostly_unique' rather
	than `unique' at all disjunctions, not just at model_non
	disjunctions, because model_semi and even model_det
	disjunctions can still have backtracking from one failing
	disjunct into the next disjunct.

	Also add a couple of comments.

tests/invalid/Mmakefile:
tests/invalid/uniq_modes.m:
tests/invalid/uniq_modes.err_exp:
	Add a regression test for this change.

tests/hard_coded/purity.m:
tests/hard_coded/cc_nondet_disj.m:
	Fix code that the compiler now rejects, due to the above change.
	The compiler is being a bit conservative to reject these cases,
	because the code won't actually violate unique-mode-correctness,
	but the conservatism here with disjunctions is similar to unique
	mode analysis's already existing conservatism with regard to
	if-then-elses, and the work-around for cases like this is easy,
	so I don't consider that to be a significant problem.

	The conservatism in question is that if it sees
	`{ test }, io__write_string("blah")' in a model_det/model_semi
	disjunct or in the condition of an if-then-else, it will report
	a unique mode error, since it doesn't realize that destructive
	update only occurs _after_ we have committed to this branch.

tests/hard_coded/Mmakefile:
	Disable the test case bidirectional.m, since the compiler now
	rejects it, due to the above change to unique_modes.m.
	The compiler is again being overly conservative in its analysis.
	The problem is similar to that in the two test cases above,
	unfortunately there is no easy work-around in this case.
	The compiler really ought to support this style of bidirectional
	code using unique modes, so I do consider this to be a significant
	problem, but the fix is a fair bit of work, so I will deal with
	that as a separate change.
1999-04-16 07:52:12 +00:00
Zoltan Somogyi
3bf462e0b7 Switch to a closure representation that includes runtime type and procedure id
Estimated hours taken: 36

Switch to a closure representation that includes runtime type and procedure id
information, so that closures can be copied, garbage collected, printed, etc.

This RTTI information is not yet used. Adding code to use it would be futile
until Tyson finishes his changes to the other RTTI data structures.

Note also that this change provides the information required for solving the
problem of trying to deep copy closures only for grades that include
--typeinfo-liveness. Providing this info for other grades is future work.

configure.in:
	Find out what the right way to refer to a variable-sized array
	at the end of a struct is.

runtime/mercury_ho_call.h:
	New file to define the structure of closures and macros for accessing
	closures.

runtime/Mmakefile:
	Add the new header file.

runtime/mercury_ho_call.c:
	Add an entry point to handle calls to new-style closures. The code
	to handle old-style closures, which was unnecessarily duplicated for
	each code model, stays until all the installed compilers use the new
	closure representation.

	Until that time, the new entry point will contain code to detect
	the use of old-style closures and invoke the old code instead.
	This allows stage1s compiled with old compilers to use the old style
	and stage2 to use the new style without any special tricks anywhere
	else.

	Add a new entry point to handle method calls of all code models.
	The old entry points, which had the same code, will also be deleted
	after this change has been bootstrapped.

runtime/mercury_calls.h:
	Remove the macros that call closures. Their interface sucked, they
	were not used, and their implementation is now out of date.

runtime/mercury_stack_layout.h:
	Add a new type, MR_Type_Param_Locns, for use by the C type
	representing closures. Since MR_Stack_Layout_Vars has a field,
	MR_slvs_tvars, which references a data structure identical
	in every way to MR_Type_Param_Locns, change the type of that field
	to this new type, instead of the previous cheat.

runtime/mercury_layout_util.h:
	Minor update to conform to the new type of the MR_slvs_tvars field.
	(This is the only use of that field in the system.)

runtime/mercury_type_info.h:
	Add new types MR_TypeInfo and MR_PseudoTypeInfo. For now, they
	are just Word, but later we can make them more accurate.
	In the meantime, we can refer to them instead of to Word,
	making code clearer. One such reference is now in mercury_ho_call.h.

compiler/notes/release_checklist.html:
	Add a reminder to remove the redundant code from mercury_ho_call.c
	after bootstrapping.

compiler/llds.m:
	Replace three code addresses for calling closures and another three
	for calling methods with one each.

compiler/call_gen.m:
compiler/dupelim.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/llds_out.m:
	Trivial updates in accordance with the change to llds.m

compiler/code_info.m:
	Move the code to handle layouts to continuation_info.m,
	since that's where it belongs. Leave only the code for picking
	up parameters from code_infos and for putting results back in there.

	Remove the redundant arguments of code_info__init, and extract
	them from ProcInfo, to make clear that they are related.

compiler/code_gen.m:
	Since we pass ProcInfo to code_info__init, don't pass its components.

compiler/continuation_info.m:
	Add the code moved from code_info.m, in a form which takes explicit
	arguments for things that used be hidden in the code_info.

	Add new code, closely related to the moved code, that creates
	layout info from a procedure's argument info, rather than from a
	(part of) the current code generator state. This way, it can be
	invoked from places that don't have a code_info for the procedure
	for which they want to generate layouts. This is the case when
	we generate layouts for closures.

compiler/par_conj_gen.m:
compiler/trace.m:
	Minor changes required by the move of stuff from code_info to
	continuation_info.

compiler/stack_layout.m:
	Export some predicates for use by unify_gen.

compiler/unify_gen.m:
	Switch to creating new style closures, complete with layout info.

	Optimize the code for extending closures a bit. By copying the
	fixed words of the closure outside the loop, we avoid incurring
	the loop overhead twice.

compiler/code_util.m:
	Add a couple of utility predicates for continuation_info.m and
	unify_gen.m

library/benchmarking.m:
library/std_util.m:
	Refer to the new entry point for handling closures.

browser/dl.m:
	Use the new closure representation.

	Note that extras/dynamic_linking/dl.m, which is supposed to be
	the same as browser/dl.m but is not, should also be updated, but
	this will be handled later by Fergus.

tests/hard_coded/closure_extension.{m,exp}:
	A new test case to exercise the code for extending closures.

tests/hard_coded/Mmakefile:
	Enable the new test case.
1999-04-16 06:05:49 +00:00
Zoltan Somogyi
ed1716bf35 Clean up the debugger tests directory by (a) removing the long obsolete
Estimated hours taken: 1

Clean up the debugger tests directory by (a) removing the long obsolete
*_lib files, and (b) separating out the three roles of the queens.m
into mdb_command_test.m and interactive.m as well as queens.m.

tests/debugger/mdb_command_test.m:
	Add a trivial source file for this test. The other files of the test
	case (.inp, .exp) already existed.

tests/debugger/queens.{m,exp,inp}:
	Remove the tests of interactive functionality.

tests/debugger/interactive.{m,exp,inp}:
	A renamed copy of the old queens.m, with the interactive functionality
	intact. Note: since this test case is currently disabled, I cannot
	be sure that the .exp file is quite correct in every detail.

tests/debugger/*_lib.*:
	Removed these obsolete test cases, since for a while now we have
	avoided depending on whether the library was compiled with tracing
	or not by leaving all library code to the end and not printing
	or stopping at any event inside library code.

tests/debugger/Mmakefile:
	Make the necessary updates to accommodate the above changes.
1999-04-16 01:13:04 +00:00
Zoltan Somogyi
526e5b9efe Clean up the debugger tests directory by (a) removing the long obsolete
Estimated hours taken: 1

Clean up the debugger tests directory by (a) removing the long obsolete
*_lib files, and (b) separating out the three roles of the queens.m
into mdb_command_test.m and interactive.m as well as queens.m.

tests/debugger/mdb_command_test.m:
	Add a trivial source file for this test. The other files of the test
	case (.inp, .exp) already existed.

tests/debugger/queens.{m,exp,inp}:
	Remove the tests of interactive functionality.

tests/debugger/interactive.{m,exp,inp}:
	A renamed copy of the old queens.m, with the interactive functionality
	intact. Note: since this test case is currently disabled, I cannot
	be sure that the .exp file is quite correct in every detail.

tests/debugger/*_lib.*:
	Removed these obsolete test cases, since for a while now we have
	avoided depending on whether the library was compiled with tracing
	or not by leaving all library code to the end and not printing
	or stopping at any event inside library code.

tests/debugger/Mmakefile:
	Make the necessary updates to accommodate the above changes.
1999-04-16 01:12:54 +00:00
Fergus Henderson
5b9f441aa2 Add some hard-coded dependencies on queens.{dep,depend},
Estimated hours taken: 0.1

tests/debugger/Mmakefile:
	Add some hard-coded dependencies on queens.{dep,depend},
	since these are needed for the mdb_command_test test.
1999-04-12 05:35:23 +00:00
Fergus Henderson
90c295d644 Disable the `queens' test, since currently we don't pass it if
Estimated hours taken: 0.1

tests/debugger/Mmakefile:
	Disable the `queens' test, since currently we don't pass it if
	readline support is enabled.
1999-04-11 08:24:25 +00:00
Fergus Henderson
f7df319d0c GNU readline always echos the inputs, so if readline support is
Estimated hours taken: 2

trace/mercury_trace_internal.c:
	GNU readline always echos the inputs, so if readline support is
	enabled, then ignore the MR_echo_commands variable,
	and report an error if the user tries to use `echo off'.
	Also, if we're not using readline, then echo the `echo on' command,
	so that the output will be the same as with readline.

tests/debugger/*.inp:
	Ensure that `echo on' is always the first command.

tests/debugger/*.exp:
tests/debugger/*.exp2:
	Update to reflect the changes to *.inp,
	and to include the echo of the `echo on' command.

	(Also delete the mdb intro banners from *_lib.exp*,
	because mdb is invoked with MERCURY_SUPPRESS_MDB_BANNER=yes.
	The *_lib* files are in fact currently not used, so they should
	probably be just deleted, I think.  But I'll do that as
	a separate change.)
1999-04-08 16:04:27 +00:00
Fergus Henderson
0a7b4cf015 Work around some problems with egcs-1.1b getting internal
Estimated hours taken: 0.25

tests/debugger/Mmakefile:
	Work around some problems with egcs-1.1b getting internal
	errors on alpha-dec-osf3.2 when compiling certain queries
	in grade reg.gc.
1999-03-31 11:14:19 +00:00
Fergus Henderson
df486b6dc3 Pass the appropriate options to ensure that queens.m
Estimated hours taken: 0.25

tests/debugger/Mmakefile:
	Pass the appropriate options to ensure that queens.m
	is compiled with shared libraries on Linux.  This is
	necessary because interactive queries only work if you
	use shared libraries.
1999-03-29 10:59:52 +00:00
Fergus Henderson
5268018339 Updated to match queens.inp: swap the order of the calls to the
Estimated hours taken: 0.1

tests/debugger/queens.exp:
	Updated to match queens.inp: swap the order of the calls to the
	`mmc_options' command, so that mmc will get invoked *without*
	the `--use-subdirs' option.
	(I had modified queens.inp as described above before committing
	it, and I had forgotten to update queens.exp accordingly.
	The reason I modified queens.inp was to make it work without
	`--use-subdirs'.  Unfortunately getting it to work both with and
	without `--use-subdirs' is non-trivial, so curently it does not
	work with `--use-subdirs'.  I should fix that sometime...)
1999-03-28 01:05:37 +00:00
Fergus Henderson
4aac7dd4c9 Add some test cases to test interactive queries.
Estimated hours taken: 3

Add some test cases to test interactive queries.

tests/debugger/queens.inp:
	Add tests of interactive queries.

tests/debugger/queens.exp:
        Update to reflect the new output for this test case.

tests/debugger/Mmakefile:
	Add dependency of queens.out on queens.ints.
	This is needed in order for us to use interactive queries.

tests/debugger/queens.m:
	Export qperm/2, for use in interactive queries.

browser/interactive_query.m:
	Flush MDB_stdout after printing the prompt, so things work
	properly with I/O redirections.

trace/mercury_trace_internal.c:
	Fix an off-by-one error detected by the above test cases.
1999-03-26 21:12:36 +00:00