Commit Graph

6652 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
Warwick Harvey
d2b98d996c Fixed a typo in the rule to generate .pic_o' files from .m' files
Estimated hours taken: 0.25

scripts/Mmake.rules:
	Fixed a typo in the rule to generate `.pic_o' files from `.m' files
	when `RM_C' is not set to `:'.
1999-07-14 07:17:51 +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
Warwick Harvey
f1de7db5a9 Fixed a couple of problems with the bootcheck script.
Estimated hours taken: 4

Fixed a couple of problems with the bootcheck script.

tools/bootcheck:
	Changed the stage 2 and 3 builds to always use the stage 1 version
	of `mmake' rather than the installed version (it had been using a
	rather bizarre mix of the two, which made bootstrapping changes to
	mmake rather difficult).  As part of this, made the definitions of
	`MMAKE_VPATH' and `MMAKE_DIR' apply to all invocations of mmake for
	stages 2 and 3, rather than just some of them.
1999-07-14 06:17:28 +00:00
Zoltan Somogyi
fd5c0b0587 Document the trace, goal_path and commit_gen modules.
Estimated hours taken: 0.2

compiler/notes/compiler_design.html:
	Document the trace, goal_path and commit_gen modules.
1999-07-14 05:41:49 +00:00
Peter Ross
41013f55e0 Mention the x fun y to fun(x, y) transformation.
Estimated hours taken: 0.25

NEWS:
    Mention the x `fun` y to fun(x, y) transformation.
1999-07-14 04:28:01 +00:00
Peter Ross
4fdc8b46c5 Record in which predicate an assertion is used.
Estimated hours taken: 8

Record in which predicate an assertion is used.

compiler/accumulator.m:
compiler/lambda.m:
compiler/magic.m:
    Initialise the assertions field in the new pred_info.

compiler/assertion.m:
    An abstract interface to the assertion table (hopefully).

compiler/hlds_data.m:
    Modify assertion_table_add_assertion to return the assert_id of the
    inserted assertion.

compiler/hlds_pred.m:
    Record in the pred_info the set of assertions that mention the pred.

compiler/post_typecheck.m:
    Now record which predicates are used in assertions.

compiler/notes/compiler_design.html:
    Document assertion.m
1999-07-14 04:17:20 +00:00
Peter Ross
88c3e52881 Record in which predicate an assertion is used.
Estimated hours taken: 8

Record in which predicate an assertion is used.

compiler/accumulator.m:
compiler/lambda.m:
compiler/magic.m:
    Initialise the assertions field in the new pred_info.

compiler/assertion.m:
    An abstract interface to the assertion table (hopefully).

compiler/hlds_data.m:
    Modify assertion_table_add_assertion to return the assert_id of the
    inserted assertion.

compiler/hlds_pred.m:
    Record in the pred_info the set of assertions that mention the pred.

compiler/post_typecheck.m:
    Now record which predicates are used in assertions.

compiler/notes/compiler_design.html:
    Document assertion.m
1999-07-14 04:17:13 +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
Simon Taylor
b10ca6f893 Add a version of process_all_nonimported_nonaditi_procs
Estimated hours taken: 0.1

compiler/passes_aux.m:
	Add a version of process_all_nonimported_nonaditi_procs
	which takes and returns a piece of user data. This will
	be used in the pass to perform optimization of updates.
1999-07-13 08:03:00 +00:00
David Overton
1df5dc64d7 In the definition of MR_body(), cast the first argument to
Estimated hours taken: 1

runtime/mercury_tags.h:
	In the definition of MR_body(), cast the first argument to
	type Word before doing the tag subtraction.
	This is necessary for code such as:
	r3 = MR_const_field(MR_mktag(1), MR_mkword(MR_mktag(1),
		&mercury_const_46), (Integer) 0);
	(which is produced by value numbering).  MR_mkword casts its
	result to type (Word *) which means that MR_body, called from
	within MR_const_field, was doing pointer arithmetic on it and
	thus failing to remove the tag properly.
1999-07-13 05:05:47 +00:00
Simon Taylor
9a1d3aa0e7 Move code to convert a string to a list of bytes from
Estimated hours taken: 0.2

compiler/rl_code.m:
compiler/bytecode_data.m:
	Move code to convert a string to a list of bytes from
	rl_code.m to be near similar code for ints and floats
	in bytecode_data.m.

	Remove some unnecessary module imports.
1999-07-13 03:22:28 +00:00
David Overton
ea96a2b910 Document fact_table.m.
Estimated hours taken: 0.25

compiler/notes/compiler_design.html:
	Document fact_table.m.
1999-07-13 02:56:12 +00:00
Peter Ross
8d456a1396 Document the transform_llds module.
Estimated hours taken: 0.25

compiler/notes/compiler_design.html:
    Document the transform_llds module.
1999-07-13 02:26:03 +00:00
Simon Taylor
786ee0f64d Document bytecode_data.m, rl_opt.m and rl_relops.m.
Estimated hours taken: 0.2

compiler/notes/compiler_design.html:
	Document bytecode_data.m, rl_opt.m and rl_relops.m.
1999-07-13 02:16:31 +00:00
Peter Ross
57e163d3ed delete repeated occurence of token.
Estimated hours taken: 0.1

doc/reference_manual.texi:
    delete repeated occurence of token.
1999-07-13 02:04:38 +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
Fergus Henderson
64b3c37f45 More changes to reduce the complexity of the intermodule dependencies.
Estimated hours taken: 2

More changes to reduce the complexity of the intermodule dependencies.

compiler/module_qual.m:
	Some minor changes to avoid the need to import hlds*.m.
	This module acts on the parse tree, not the HLDS, so we
	shouldn't import hlds*.m here.

compiler/modules.m:
compiler/prog_io.m:
compiler/det_analysis.m:
	Delete some unnecessary imports.

compiler/equiv_type.m:
compiler/dependency_graph.m:
	Add some XXX comments about unwanted intermodule dependencies.
1999-07-12 14:09:12 +00:00
Peter Ross
cc38915026 Allow the term (x fun y) to be expanded to fun(x,y).
Estimated hours taken: 5

Allow the term (x `fun` y) to be expanded to fun(x,y).

library/lexer.m:
    Handle the backquote token.

library/parser.m:
    Do the term transformation as the program is parsed.
1999-07-12 07:44:37 +00:00
Peter Ross
fced64229c Document the x fun y transformation.
Estimated hours taken: 1

doc/reference_manual.texi:
    Document the x `fun` y transformation.
1999-07-12 07:43:09 +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
Fergus Henderson
d66c8481ae Some more changes to minimize the complexity of the intermodule dependencies.
Estimated hours taken: 4

Some more changes to minimize the complexity of the intermodule dependencies.
In particular, ensure that hlds_module.m does not need to import llds.m.

compiler/hlds_module.m:
compiler/llds.m:
	Move the definition of the c_interface_info type (and the types
	used for all its fields) from llds.m into hlds_module.m, since
	this type contains high-level information about the user-level
	C interface stuff that is not directly related to the LLDS and
	is needed by other back-ends.

compiler/hlds_module.m:
compiler/llds.m:
compiler/mercury_compile.m:
compiler/code_gen.m:
compiler/stack_layout.m:
compiler/table_gen.m:
	Move the `global_data' type from hlds_module.m into llds.m,
	since this type contains low-level stuff that is dependent on
	the LLDS.  Delete the `global_data' field of the module_info,
	instead passing it around as a separate argument where needed.
	Move the code for inserting llds__tabling_pointer_vars into the
	global_data from table_gen.m to code_gen.m, since this is
	dependent on the LLDS and table_gen.m should be a pure
	HLDS->HLDS transformation, so that it can work with other
	back-ends.

compiler/continuation_info.m:
	Update some comments which this change makes obsolete.

compiler/optimize.m:
	Delete the import of module hlds_data, since it is no longer needed.
1999-07-12 06:21:25 +00:00
Fergus Henderson
05e01e649d Eliminate dependencies on llds.m, by duplicating the definitions
Estimated hours taken: 2

compiler/mlds.m:
	Eliminate dependencies on llds.m, by duplicating the definitions
	of a few types (`tag', `base_data', and `reset_trail_reason').

	Rename the instruction for doing memory allocation from
	`incr_hp' to `new_object', and rework its argument types
	(the original definition was cut-and-paste from llds.m
	that had not had much thought invested in it).
	Delete the `create' rval -- the code generator should use
	`new_object' instead.
1999-07-11 11:22:22 +00:00
Fergus Henderson
266ff0a51d Fix some compilation errors that were introduced in my last change.
Estimated hours taken: 0.25

Fix some compilation errors that were introduced in my last change.
The errors were ambiguities in mercury_compile.m caused by names defined
in mlds.m being the same as those defined in other modules.

compiler/mercury_compile.m:
	s/label/llds__label/

compiler/mlds.m:
	s/mlds__module_name/mlds_module_name/g
1999-07-10 08:55:17 +00:00
Fergus Henderson
56276baac1 Add import of module `builtin_ops'. (This should have been
Estimated hours taken: 0.1

compiler/mlds.m:
	Add import of module `builtin_ops'.  (This should have been
	part of my recent change which added `builtin_ops.m', but I
	forgot to modify this file as part of that change.)

compiler/mercury_compile.m:
	Add import of mlds.m, to ensure that it will get compiled,
	so as to avoid problems like the one above in future.
1999-07-10 07:59:04 +00:00
Fergus Henderson
773bd702cc Some more changes to minimize the complexity of the intermodule dependencies.
Estimated hours taken: 2.5

Some more changes to minimize the complexity of the intermodule dependencies.
In particular, ensure that bytecode.m does not need to import llds.m.

compiler/llds.m:
compiler/builtin_ops.m:
	Move the definitions of the unary_op and binary_op types into
	a new module `builtin_ops'.  These types are used by three of the
	different back-ends (bytecode, llds, and mlds) and therefore deserve
	to be in their own module.

compiler/bytecode.m:
	Define a type `byte_reg_type' and use that instead of llds__reg_type.
	Delete the import of module llds.

compiler/notes/compiler_design.html:
	Document the new module builtin_ops.

compiler/rl_exprn.m:
	Add a comment explaining why we need to import llds (and builtin_ops).

compiler/base_type_layout.m:
compiler/bytecode.m:
compiler/code_util.m:
compiler/dense_switch.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/llds_out.m:
compiler/lookup_switch.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/rl_exprn.m:
compiler/string_switch.m:
compiler/tag_switch.m:
compiler/transform_llds.m:
compiler/unify_gen.m:
compiler/value_number.m:
compiler/vn_block.m:
compiler/vn_cost.m:
compiler/vn_flush.m:
compiler/vn_type.m:
compiler/vn_util.m:
compiler/vn_verify.m:
	Add imports of module builtin_ops to lots of modules that
	imported llds.
1999-07-10 07:20:09 +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
Mark Brown
bf66b3545c Add two new mmake targets, clean_local and realclean_local, which
Estimated hours taken: 1

Add two new mmake targets, clean_local and realclean_local, which
are the same as clean and realclean except that the former retain their
original meanings if rules are added to the latter.  This is useful
if users want to add rules for a recursive mmake clean.

compiler/modules.m:
	Output `clean_local: module.clean' to generated .dep files
	instead of `clean: module.clean'.  Same for `realclean'.

scripts/Mmake.rules:
	Add dependencies to implement the original targets in terms of
	the new targets.
1999-07-09 04:53:13 +00:00
Peter Ross
31dcd002d4 Add the infrastructure for assertions into the compiler.
Estimated hours taken: 0.25

Add the infrastructure for assertions into the compiler.

library/ops.m:
    Declare the :- assertion op.
1999-07-09 01:16:41 +00:00
Peter Ross
41be69cb26 Add the infrastructure for assertions into the compiler.
Estimated hours taken: 0.25

Add the infrastructure for assertions into the compiler.

compiler/notes/compiler_design.html:
    Update documentation about exactly where quantification is done.

compiler/notes/glossary.html:
    Define what an assertion is.
1999-07-09 01:16:19 +00:00
Peter Ross
a5f5c63a3a Add the infrastructure for assertions into the compiler.
Estimated hours taken: 50

Add the infrastructure for assertions into the compiler.

compiler/error_util.m:
    Output the correct pred name for assertions.

compiler/hlds_data.m:
    Add the assertion_table structure.

compiler/hlds_module.m:
    Get/set the assertion_table from the module_info.

compiler/hlds_out.m:
    Modify hlds_out__write_pred_id to identify assertions.

compiler/hlds_pred.m:
    Add the goal_type assertion.

compiler/make_hlds.m:
    Transform the assertion to a HLDS data structure that can be
    typechecked.

compiler/mercury_to_goedel.m:
compiler/module_qual.m:
    Handle the assertion structure.

compiler/mercury_to_mercury.m:
    Output assertions.

compiler/post_typecheck.m:
    Add a predicate which must be called after typechecking of
    assertions has been finished.  Also document some possible problems
    with typechecking assertions.

compiler/prog_data.m:
    Add assertion to the type item.

compiler/prog_io.m:
    Add the ability to parse assertions.

compiler/purity.m:
    After finished typechecking assertions call
    post_typecheck__finish_assertion.

compiler/typecheck.m:
    Don't output inference messages for assertions.

compiler/notes/compiler_design.html:
    Update documentation about exactly where quantification is done.

compiler/notes/glossary.html:
    Define what an assertion is.
1999-07-09 01:15:40 +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
59ef7a2ac8 Do special error-handling for if-then-else in DCGs in the same
Estimated hours taken: 0.25

compiler/typecheck.m:
	Do special error-handling for if-then-else in DCGs in the same
	way that we currently do for ordinary (non-DCG) if-then-elses.
1999-07-08 10:02:59 +00:00
Fergus Henderson
ad79755c9c New module -- the "Medium Level Data Structure".
Estimated hours taken: 24

compiler/mlds.m:
	New module -- the "Medium Level Data Structure".
	This module will eventually be used as the basis of a
	new back-end for the Mercury compiler that generates
	code at a higher lever than the current back-end.
	Currently nothing uses this module, but I'm committing
	it now so that Tyson can start playing with it.
1999-07-08 09:22:19 +00:00
Peter Ross
cba483823e Very minor code reordering.
Estimated hours taken: 0.1

compiler/accumulator.m:
    Very minor code reordering.
1999-07-08 08:51:41 +00:00
Peter Ross
807ac16ff8 fix spelling errors.
Estimated hours taken: 0.25

doc/reference_manual.texi:
    fix spelling errors.
1999-07-08 08:48:05 +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
Fergus Henderson
419795f059 Import module prog_data in the interface rather than in the
Estimated hours taken: 0.1

compiler/det_analysis.m:
	Import module prog_data in the interface rather than in the
	implementation.  This is necessary now that the `determinism'
	type is defined in prog_data.m rather than hlds_data.m.

	(This change is part of my previous set of changes to move some
	declarations around in order to reduce the number and complexity
	of the intermodule dependencies.  I accidentally forgot to commit
	this one with the other changes.)
1999-07-08 06:43:37 +00:00
Fergus Henderson
6af76f74ea Move some declarations around and make some other minor changes in order
Estimated hours taken: 4

Move some declarations around and make some other minor changes in order
to reduce the number and complexity of the intermodule dependencies.
In particular, ensure that prog_data.m does not need to import
hlds*.m, purity.m, rl.m, or term_util.m.

Since we expect to have only one input language, but potentially many
different target languages, the general design principle that we have adopted
in order to minimize the number of dependencies, particularly cyclic ones,
is that modules which belong to an earlier stage of compilation should
not depend on modules which belong to a later stage of compilation.
However, that design principle has not been adhered to in many cases.
This change reduces the number of such cases.

compiler/prog_data.m:
compiler/hlds_pred.m:
	Move definition of the types `eval_method' and `pred_or_func'
	from hlds_pred.m to prog_data.m.
	Add new type `mode_num' to prog_data.m, defined by
	`type mode_num == int', and change the proc_id argument of
	the `unused_args' pragma to instead use this type instead of proc_id.
	Delete the import of module hlds_pred from prog_data.m.

compiler/prog_data.m:
compiler/hlds_data.m:
	Move the definition of the type `determinism' from hlds_data.m to
	prog_data.m.  Delete the import of module hlds_data from prog_data.m.

compiler/prog_data.m:
compiler/purity.m:
	Move the definition of the type `purity' from purity.m to prog_data.m.
	Add import of module prog_data to purity.m.
	Delete the import of module purity from prog_data.m.

	This is needed because purity.m imports hlds*.m and so by
	importing purity.m, prog_data.m was indirectly importing hlds*.m.

	(An possible alternative here would be to split purity.m into two
	parts, called say purity.m and check_purity.m; of these, only the
	second would import hlds*.m.  But that would be a significantly
	more complicated change.)

compiler/prog_data.m:
compiler/rl.m:
	Move the definition of the `index_spec' and `index_type' types from
	rl.m to prog_data.m.  Delete the import of module rl from prog_data.m.

compiler/prog_data.m:
	Add new types `pragma_arg_size_info' and `pragma_termination_info'
	to prog_data.m.  These are similar to the existing types
	`arg_size_info' and `termination_info' defined in term_util.m,
	except that they correspond more directly to what is actually
	used in `pragma termination_info' declarations.

compiler/term_util.m:
	Add new predicates `add_context_to_arg_size_info' and
	`add_context_to_pragma_termination_info' for converting
	the prog_data types to their corresponding term_util types.

compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/prog_io_pragma.m:
compiler/unused_args.m:
	Minor modifications to handle the change in the type of the
	mode number argument in `unused_args' pragmas, and in the types
	of the arg_size_info and termination_info arguments in
	`termination_info' pragmas.

compiler/mercury_to_mercury.m:
compiler/prog_io_pragma.m:
compiler/inst.m:
compiler/make_hlds.m:
compiler/call_gen.m:
compiler/common.m:
compiler/continuation_info.m:
compiler/det_report.m:
compiler/hlds_pred.m:
compiler/lambda.m:
compiler/magic_util.m:
compiler/modecheck_call.m:
compiler/prog_io_goal.m:
compiler/prog_io_util.m:
compiler/prog_util.m:
compiler/termination.m:
	Delete imports of modules purity, rl, and hlds_pred, or
	move them from the interface section to the implementation section.

compiler/inst.m:
compiler/prog_io_util.m:
        Add an XXX comment explaining why we need to import hlds_data.m.
1999-07-08 05:08:58 +00:00
Peter Ross
c69fb79895 Add .ispell_words to the doc directory.
Estimated hours taken: 0.5

Add .ispell_words to the doc directory.
To add a word to this file, just press `I' when using ispell to spell
check the documentation.
1999-07-08 04:58:07 +00:00
Peter Ross
0b378f7cdb Fix spelling errors.
Estimated hours taken: 0.25

doc/user_guide.texi:
    Fix spelling errors.
1999-07-08 04:56:34 +00:00
Fergus Henderson
65782f9925 Add functions for the single output det predicates in a number
Estimated hours taken: 5

[This change was by Ralph Becket.
I'm just the person who reviewed it and committed it.  -fjh.]

Add functions for the single output det predicates in a number
of modules in the standard library.  Basically, for each

	:- pred f(in, ..., in, out) is det.

I have added the declaration

	:- func f(in, ..., in) = out.

and definition

	f(X1, ..., Xn) = Y :-
		f(X1, ..., Xn, Y).

library/char.m:
library/dir.m:
library/map.m:
library/string.m:
library/list.m:
library/set.m:
	Make the changes described above.

library/array.m:
	As above, except array input modes are all array_ui or
	array_di as appropriate and array output modes are array_uo.

library/int.m:
	Added forward versions of +/2, */2 and -/2 as plus/2, times/2
	and minus/2 respectively, to make it easier to pass these
	as arguments to higher-order predicates.
	Also added func constants for max_int, min_int and bits_per_int.

library/integer.m:
	Replaced local functions for list head, tail and length with
	calls to equivalent functions now defined in list.m.

library/io.m:
	Added func for error_message/2.

library/list.m:
	Add functions det_head/1 and det_tail/1 which abort on null lists.

library/set.m:
	Add functions map/2, filter_map/2 and fold/3.

library/std_util.m:
	Added utility function to construct a pair object from its
	arguments and general purpose higher order functions for
	partial functions and for function composition, exponentiation
	and exchanging the arguments of a binary function.
1999-07-07 15:19:42 +00:00
Fergus Henderson
6f4970a41d Use more meaningful variable names, as suggested by dgj's code review.
Estimated hours taken: 0.25

compiler/polymorphism.m:
	Use more meaningful variable names, as suggested by dgj's code review.
1999-07-07 14:58:26 +00:00
Fergus Henderson
33b1b8d5ab Add a comment, as suggested by dgj's code review.
Estimated hours taken: 0.25

compiler/mode_errors.m:
	Add a comment, as suggested by dgj's code review.
1999-07-07 14:49:02 +00:00
Fergus Henderson
ae3c740974 Fix a typo in a comment (s/there/the/).
Estimated hours taken: 0.01

compiler/quantification.m:
	Fix a typo in a comment (s/there/the/).
1999-07-06 14:54:30 +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