Commit Graph

96 Commits

Author SHA1 Message Date
Fergus Henderson
eae7eec887 Allow modules to be put in source files whose names do not directly match
Estimated hours taken: 10

Allow modules to be put in source files whose names do not directly match
their the module names.  When looking for the source for a module such
as `foo:bar:baz', search for it first in `foo.bar.baz.m', then in `bar.baz.m',
and finally in `baz.m'.

compiler/prog_io.m:
	Change prog_io__read_module so that it returns the name of
	the module read, as determined by the `:- module' declaration.
	Add predicate `check_module_has_expected_name', for checking
	that this name matches what was expected.

compiler/modules.m:
	Add read_mod_from_file, for reading a module given the file name,
	and generated_file_dependencies, for generating the dependencies
	of a module given the file name.  (As opposed to the module name.)
	Change read_mod and read_mod_ignore_errors so that they
	search for `.m' files as described above, and return the name
	of the source file read.
	Also improve the efficiency of read_dependencies slightly:
	when reading in `.int' files, there's no need to call
	split_into_submodules, because we generate a seperate
	`.int' file for each submodule anyway.

compiler/mercury_compile.m:
	Change the handling of command-line arguments.
	Arguments ending with `.m' are assumed to be file names,
	and other arguments are assumed to be module names.
	For file names, call read_mod_from_file instead of read_mod.

compiler/handle_options.m:
	Change help message to reflect the above change to the semantics
	of command-line arguments.

compiler/intermod.m:
compiler/trans_opt.m:
	Fix a bug: call prog_io__read_opt_file instead of prog_io__read_module.

doc/user_guide.texi:
	Document the above change to the semantics of command-line arguments.
	Update the "libraries" chapter to reflect our support for nested
	modules.

tests/*/*.m:
tests/*/*.exp:
	Fix a few incorrect module names in `:- module' declarations.
1998-05-29 08:57:42 +00:00
Zoltan Somogyi
564d358da3 Avoid about half of the slow "mmake realclean"s required by a bootcheck.
Estimated hours taken: 0.5

Avoid about half of the slow "mmake realclean"s required by a bootcheck.

tests/*/runtests:
	Concentrate all the actions performed before the test and after
	a successful tests (both of which involve an "mmake realclean")
	into two scripts, tests/{startup,shutdown}.

tests/shutdown:
	Clean up the directory, and touch the file CLEAN.

tests/startup:
	If the file CLEAN exists and is the most recent file in the directory,
	consider the directory clean to beging with. Otherwise, run mmake
	realclean.
1998-05-13 04:06:38 +00:00
Fergus Henderson
f3b7548ac4 Fix a problem reported by Baudouin Le Charlier <ble@info.fundp.ac.be>
where switch detection was getting confused by explicit existential
quantifications.

compiler/switch_detection.m:
	When detecting switches, traverse through some/2 goals.
	Also simplify the code a bit.

tests/valid/Mmakefile:
tests/valid/some_switch.m:
	Regression test for the above change.
1998-05-12 17:05:06 +00:00
Fergus Henderson
49c25842cf Fix a problem reported by Baudouin Le Charlier <ble@info.fundp.ac.be>
where switch detection was getting confused by explicit existential
quantifications.

compiler/switch_detection.m:
	When detecting switches, traverse through some/2 goals.
	Also simplify the code a bit.

tests/valid/Mmakefile:
tests/valid/some_switch.m:
	Regression test for the above change.
1998-05-12 17:05:04 +00:00
Zoltan Somogyi
cd31eecf88 When reporting the results, print the options that controlled
Estimated hours taken: 0.2

tests/runtests:
tests/*/runtests:
	When reporting the results, print the options that controlled
	the tests, so you don't have to search for them.

tests/*/runtests:
	Clean up the directory if the tests are successful, in order
	to reduce disk space usage.
1998-04-23 09:28:39 +00:00
Fergus Henderson
40f7fad627 Fix some code rot in the rules for `make clean';
Estimated hours taken: 0.5

Makefile:
tests/valid/Mmakefile:
tests/invalid/Mmakefile:
	Fix some code rot in the rules for `make clean';
	amoung other things, change them so that they
	handle `--use-subdirs' correctly.
1998-04-09 03:59:12 +00:00
Fergus Henderson
5653ad9190 Change a hard-coded test for `$file.o' so that it will
Estimated hours taken: 0.25

tests/valid/runtests:
tests/valid/Mmakefile:
	Change a hard-coded test for `$file.o' so that it will
	work with --use-subdirs.
1998-03-30 13:25:05 +00:00
Fergus Henderson
7ebc79e927 Fix some problems with the `--use-subdirs' option.
Estimated hours taken: 6

Fix some problems with the `--use-subdirs' option.
The compiler itself now compiles and bootstraps fine with --use-subdirs.

compiler/modules.m:
	Put `.h' files in the source directory, rather than
	in the `Mercury/hs' subdirectory.

compiler/mercury_compile.m:
scripts/Mmake.rules:
	If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
	so that #include statements work relative to the source directory
	rather than relative to the `Mercury/cs' subdirectory.

scripts/Mmake.vars.in:
	Define $(cs_subdir), $(os_subdir) etc. variables;
	these are set to the directory to use for .c, .o, etc. files,
	(including the trailing `/'), or to the empty string,
	if --use-subdirs is not set.

scripts/Mmake.rules:
	Use $(cs_subdir), $(os_subdir) etc. to avoid the code
	duplication created by my previous change to handle
	--use-subdirs.
	Also add lots of comments, and reorder the code
	in a more logical order.

Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
	Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
	file-names (e.g. *.dep, *_init.[co], tree234.o) that were
	used in some of the rules.

library/Mmakefile:
	Add `rm -f tags' to the rule for `mmake realclean'.

tools/bootcheck:
	Add `--use-subdirs' option (defaults to setting of the
	MMAKE_USE_SUBDIRS environment variable).
	Change the code which compares the stage2 & stage3 C files
	to use the appropriate location for them based on the
	setting of this option.
1998-03-20 02:58:33 +00:00
Simon Taylor
c76b0fb370 Fix a bug: recompute_instmap_delta wasn't recomputing
Estimated hours taken: 1

compiler/mode_util.m
	Fix a bug: recompute_instmap_delta wasn't recomputing
	the instmap_deltas of lambda goals.

tests/valid/lambda_recompute.m
	Regression test.
1998-02-28 11:33:46 +00:00
Simon Taylor
4ab55e32a5 Fix a bug in the optimization where polymorphism.m passes a
Estimated hours taken: 5

Fix a bug in the optimization where polymorphism.m passes a
base_type_info in place of a type_info for non-polymorphic types.
The type of the variable was `base_type_info' not `type_info'.
This caused inlining.m to be unable to compute a type substitution,
and code_util__cons_id_to_tag aborted on an unsubstituted type
variable.

compiler/mercury_builtin.m
compiler/code_util.m
	Add a new builtin, unsafe_type_cast/2, used by common.m
	to preserve type correctness.
	Make unsafe_promise_unique/2 a builtin, since it is basically
	the same as unsafe_type_cast/2.

compiler/polymorphism.m
	Set the type of a `base_type_info' passed where a `type_info'
	is expected to `type_info'.
	Don't add the type_info argument for unsafe_type_cast, since it is
	not needed and would make the code in common.m more complicated.

compiler/common.m
	Generate a call to unsafe_type_cast rather than an assignment
	unification when the assignment would not be type correct.

tests/valid/inlining_bug.m
	Regression test.

tests/general/common_type_cast.m
tests/general/common_type_cast.exp
	Test of type casts.
1998-02-25 00:12:16 +00:00
Simon Taylor
e3e2a9a870 Add the test case for modules.m which was committed
Estimated hours taken: 0.01

tests/valid/Mmakefile
	Add the test case for modules.m which was committed
	previously to the list of tests.
1998-02-09 00:44:42 +00:00
Simon Taylor
9d07a2ccdb Fix a bug reported by Tomas By which caused multiple
Estimated hours taken: 0.5

Fix a bug reported by Tomas By which caused multiple
definition errors when two modules used a third
module, and one of the modules imported the other.

compiler/modules.m
	Delay processing of short interfaces until all long
	interfaces have been read to avoid reading both
	the long and short interface for a module.

tests/valid/module_*.m
	Add a test case.
1998-02-07 09:55:52 +00:00
Simon Taylor
4dbad44fc9 Remove some mode errors which were not detected
Estimated hours taken: 0.1

tests/valid/intermod_lambda2.m
tests/valid/intermod_test2.m
	Remove some mode errors which were not detected
	because mode analysis was never run - only `.opt'
	files are produced for these modules.
1998-02-04 12:10:42 +00:00
Fergus Henderson
fbe9a332a6 Modify the code to avoid a (spurious in this case, as it happens)
Estimated hours taken: 0.25

tests/valid/agc_graph.m:
	Modify the code to avoid a (spurious in this case, as it happens)
	"Sorry, not implemented" message for abstract exported polymorphic
	equivalence types whose bodies have fewer type variables than their
	heads.
1998-01-29 14:21:33 +00:00
Fergus Henderson
cabfd6bd1a Fix a problem where the use of explicit quantifiers lead to
Estimated hours taken: 1

compiler/quantification.m:
	Fix a problem where the use of explicit quantifiers lead to
	spurious warnings about unbound type variables, by deleting
	explicit quantifiers during quantification (once the
	variables have been renamed apart, the explicit quantifiers
	are no longer needed).

tests/valid/Mmakefile:
tests/valid/explicit_quant.m:
	Regression test.
1998-01-22 07:29:47 +00:00
Fergus Henderson
e22c6fd3d2 Fix a bug introduced in stayl's changes to add support for
Estimated hours taken: 1

compiler/modules.m:
	Fix a bug introduced in stayl's changes to add support for
	`use_module': it was not reading in the `.int2' files
	for modules indirectly imported from `.int' files.

tests/valid/Mmakefile:
tests/valid/module_a.m:
tests/valid/module_b.m:
tests/valid/module_c.m:
tests/valid/module_d.m:
	A regression test for the above-mentioned bug.
1998-01-09 12:35:16 +00:00
Tyson Dowd
e96e89c657 Turn off the accurate GC tests for "jump" and "fast" grades.
Estimated hours taken: 0.5

tests/valid/Mmakefile:
tests/valid/runtests:
	Turn off the accurate GC tests for "jump" and "fast" grades.
1998-01-06 04:16:17 +00:00
Fergus Henderson
82744e5b95 Add new options for disabling some warnings, so that they
Estimated hours taken: 1

Add new options for disabling some warnings, so that they
can be disabled by `--inhibit-warnings'.

compiler/options.m:
	Add new options `warn-missing-module-name'
	and `warn-wrong-module-name' (enabled by default),
	and ensure that `--inhibit-warnings' disables these options.

compiler/prog_io.m:
	Add code to conditionalize the printing of warnings
	based on the settings of the new options.

doc/user_guide.texi:
	Document the new options.

tests/valid/Mmakefile:
tests/valid/inhibit_warn_test.m:
	A regression test.
1998-01-05 08:40:43 +00:00
Fergus Henderson
0b337ee174 Handle inference of mostly-unique (not just unique) modes.
Estimated hours taken: 25

Handle inference of mostly-unique (not just unique) modes.

compiler/unique_modes.m:
	Change the handling of calls so that if the mode originally selected
	by ordinary mode analysis (modes.m) won't work, then it now calls
	modecheck_call_pred to introduce a new mode for the predicate.

compiler/unify_proc.m:
	Generalize the existing "unify request queue" so that
	it can handle requests for any kind of predicate, not
	just for unification predicates, and hence rename the
	`unify_request' table which contains it as the `proc_request' table.

compiler/hlds_module.m:
	Rename the `unify_request' table as the `proc_request' table.

compiler/modecheck_call.m:
	When introducing new modes for predicates, do this by adding them
	to the request queue.  This ensures that when we do get around
	to processing predicates added in unique mode analysis, we will
	run mode analysis, switch detection, and determinism analysis
	before doing unique mode analysis.  To make this work, we
	need to pass down a `maybe(determinism)' argument indicating
	the determinism of the newly added procedure.  unique_modes.m
	sets this to the determinism inferred for the mode originally
	inferred by modes.m.  That should be OK, because uniqueness
	should not affect determinism.
	Also change modecheck_call_proc to return a `Changed' flag
	indicating whether we need to rerun fixpoint analysis.
	And change `get_var_insts_and_lives' to return `dead' for
	mostly_unique modes, not just for unique modes, so that
	we can infer `mdi' modes.

compiler/modes.m:
	Instead of analyzing everything to a fixpoint, and then
	analyzing the queued unification procedures, change it so
	that analysis of queued procedures is part of each fixpoint
	iteration.
	When doing ordinary mode analysis for calls, pass `no' as the
	new `maybe(determinism)' argument to modecheck_call_pred.

compiler/constraint.m:
compiler/cse_detection.m:
	Ignore the new output argument for modecheck_call_proc.

compiler/mode_util.m:
	Add code to insts_to_mode to recognize `muo', `mui', and `mdi'
	modes and use the corresponding abbreviations (previously this
	was done only for `uo', `ui', `di', `in' and `out').

tests/valid/mostly_uniq_mode_inf.m:
	A test case for the above change.
1998-01-05 07:26:32 +00:00
Fergus Henderson
239e96ec59 Clean up the handling of unbound type variables.
Estimated hours taken: 8

Clean up the handling of unbound type variables.
Fix a bug with unbound type variables in lambda expressions.
Run purity analysis, modechecking etc. even if there were type errors.

compiler/mercury_compile.m:
	Run purity analysis, modechecking etc. even if there were type
	errors.  This fixes a bug (inconsistency between the code and
	the comments) that seems to have been introduced in stayl's
	change to mercury_compile.m (revision 1.25) to add intermodule
	unused argument elimination: the comment said "continue,
	even if type checking found errors", but the code did not
	continue.

	This change was needed to ensure that we still report a warning
	message about unused type variables for tests/invalid/error2.m;
	without it, we stop after type checking and don't do purity
	analysis, and so don't report the warning.

compiler/typecheck.m:
compiler/purity.m:
	Move the code for checking for unbound type variables
	from typecheck.m to purity.m.  It needs to be done
	*after* type inference has been completed, so it
	can't be done in the ordinary type checking/inference
	passes.  Add code to purity.m to bind the
	unbound type variables to the builtin type `void'.

compiler/polymorphism.m:
	Comment out old code to bind unbound type variables
	to `void'; the old code was incomplete, and this
	is now done in purity.m.

compiler/notes/compiler_design.html:
	Document the above changes.

tests/valid/Mmakefile:
tests/valid/unbound_tvar_in_lambda.m:
	Regression test for the above-mentioned bug with unbound type
	variables in lambda expressions.

tests/warnings/singleton_test.exp:
tests/invalid/errors2.err_exp:
	Change the expected warning message for unbound type variables.
	The error context is not as precise as it used to be, I'm afraid:
	we only know which function/predicate the error occurred in,
	not which clause.  Also it now comes out in a different order
	relative to the other error messages.

tests/invalid/errors2.err_exp:
tests/invalid/funcs_as_preds.err_exp:
	Add some new error/warning messages that are output now that
	we run mode and determinism analysis even if there are type errors.
1998-01-02 00:11:41 +00:00
Fergus Henderson
9fc30fa8bb Change unique mode analysis (unique_modes.m) so that it does the same
Estimated hours taken: 4

Change unique mode analysis (unique_modes.m) so that it does the same
fixpoint analysis that ordinary mode analysis (modes.m) does.

This is a first step towards mode inference of "mostly-unique" modes.
Unique mode analysis still won't introduce any new modes, but it may
now change the final insts of inferred modes from `unique' to `mostly_unique'.

The next step (not included in this diff) will be to change the handling of
calls in unique_modes.m so that it does introduce new modes.

Also change things so that the inferred modes are normally printed
only after unique mode analysis, with determinism annotations attached.

compiler/modes.m:
	Add an extra WhatToCheck parameter to lots of predicates,
	so they can also be used for checking unique modes.
	Add a few small new bits of code to handle the
	`WhatToCheck = check_unique_modes' case.

compiler/unique_modes.m:
	Call the routines in modes.m rather than special casing things.
	The checking of goals is still special-cased, since for
	example unique_modes does not do reordering, but the traversal
	of modules and procedures now uses code from modes.m.

compiler/mode_errors.m:
	Add an extra bool parameter to write_mode_inference_messages
	indicating whether or not to print determinism annotations.

tests/valid/Mmakefile:
tests/valid/mostly_uniq_mode_inf.m:
	Test case for the above change.
1997-11-24 23:10:38 +00:00
Fergus Henderson
bd0cb6e90f Fix duplicate mode declaration errors.
Estimated hours taken: 0.25

tests/valid/qualified_cons_id.m:
library/int.m:
	Fix duplicate mode declaration errors.
1997-11-23 05:19:24 +00:00
Fergus Henderson
5d0414bbab For the tests of accurate gc, just add `--gc accurate'
Estimated hours taken: 0.5

tests/Mmake.common:
tests/valid/Mmakefile:
	For the tests of accurate gc, just add `--gc accurate'
	to GRADEFLAGS, rather than setting GRADE=asm_fast.agc.
	Otherwise the tests fail on systems for which we
	don't support asm_fast.* grades.
1997-11-22 17:14:02 +00:00
Andrew Bromage
04125e10ba Fix a bug in the writing of .opt files.
Estimated hours taken: 1

Fix a bug in the writing of .opt files.

The problem occurs when you have a pragma inline declaration for an
exported function.  The declaration:

:- func addone(int) = int.
:- pragma inline(addone/1).
addone(I) = I + 1.

gets written to the .opt file as:

:- pragma inline((foo:addone)/2).

That is, the arity of the _predicate_ version is written rather than
the arity of the _function_.

compiler/intermod.m:
compiler/mercury_to_mercury.m:
	Add a pred_or_func argument to mercury_output_pragma_decl,
	and use that to determine the declared arity.

tests/valid/intermod_test.m:
tests/valid/intermod_test2.m:
	Regression test.
1997-11-21 00:38:57 +00:00
Zoltan Somogyi
9721c4b090 Recompute nonlocal sets before starting liveness computations
Estimated hours taken: 4

compiler/liveness.m:
	Recompute nonlocal sets before starting liveness computations
	in order to avoid a compiler abort. The new version could in
	some cases also lead to the generation of better code through
	saving fewer variables across disjuncts.

tests/valid/liveness_nonlocals.m:
	Test case to exercise the fix.

tests/valid/Mmakefile:
	Enable the new test case.
1997-10-16 07:01:58 +00:00
Fergus Henderson
6e06050558 Rename Mmake' as Mmakefile', since using the name `Mmake'
Estimated hours taken: 0.25

*/Mmake:
	Rename `Mmake' as `Mmakefile', since using the name `Mmake'
	causes problems on case-insensitive file systems.
1997-09-29 18:05:38 +00:00
Fergus Henderson
256418c481 Fix a bug for the case of a higher-order function call in code
with common sub-expression; mercury 0.7 failed this test, reporting
"Software Error: modecheck fails when repeated", due to confusion
between h.o. _function_ call and h.o. _predicate_ call.

compiler/hlds_goal.m:
	Add `pred_or_func' field to HLDS higher_order_calls.

compiler/modes.m:
compiler/modecheck_call.m:
compiler/hlds_out.m:
compiler/*.m:
	Add code to handle new field for higher_order_call goals.

tests/valid/Mmake:
tests/valid/ho_func_call.m:
	Regression test for the above-mentioned bug.
1997-09-01 14:09:05 +00:00
Andrew Bromage
b539cb29f7 Better handling of abstract unification of insts which always fail.
Estimated hours taken: 8

Better handling of abstract unification of insts which always fail.

compiler/det_analysis.m:
	New predicate det_par_conjunction_detism/3 to compute the
	determinism of parallel conjunctions (or virtual parallel
	conjunctions).

compiler/hlds_data.m:
	Make the ground_inst_table store the determinism of the
	grounding operation.  The reason for this is that
	make_ground_inst* now returns the determinism of the
	grounding operation, and so it makes sense to store the
	determinisms along with cached groundings to avoid
	recomputing them.

compiler/inst_util.m:
	Add a new argument to return the determinism of the
	unification/grounding to the following predicates:

		abstractly_unify_inst_functor
		abstractly_unify_bound_inst_list
		abstractly_unify_bound_inst_list_lives
		abstractly_unify_inst_list_lives
		make_ground_inst_list_lives
		make_ground_inst_list
		make_ground_inst
		make_ground_bound_inst_list

	This is to make it easier to locate unifications which
	cannot succeed.

compiler/instmap.m:
	If you attempt to insert a not_reached into an instmap, the
	entire instmap becomes unreachable.

compiler/modecheck_unify.m:
	Slight reorganisation of code dealing with var-functor
	unifications.  Simple optimisations have been moved to
	modecheck_unify_functor.

	All unifications which definitely fail are now optimised
	to `fail'.

compiler/mode_util.m:
	Minor change to support the alteration to the ground_inst_table
	above.

tests/valid/Mmake:
tests/valid/empty_bound_inst_list.m:
	Test case.
1997-08-21 07:29:35 +00:00
Fergus Henderson
6fa7e253ca Change the rule for `mmake clean' to remove *.err, not *.err2,
Estimated hours taken: 0.25

tests/valid/Mmake:
	Change the rule for `mmake clean' to remove *.err, not *.err2,
	since the `*.err2' files have been renamed as `*.err'.
1997-08-14 07:37:43 +00:00
Fergus Henderson
b4346909c2 Add proper dependencies so that `mmake depend' does the right thing.
Estimated hours taken: 0.25

tests/valid/Mmake:
	Add proper dependencies so that `mmake depend' does the right thing.
	Previously it failed for the recently-added multi-module test
	`func_int_bug_main.m'.
1997-08-10 21:20:36 +00:00
Fergus Henderson
7dd69ebfb6 Fix a bug where the code generator complained about `nondet
Estimated hours taken: 2

compiler/simplify.m:
	Fix a bug where the code generator complained about `nondet
	model in semidet context':  If a model_det or model_semi
	if-then-else has a model_nondet condition, then change the
	determinism of the if-then-else as a whole to nondet and put it
	inside a `some'.  (This can only happen if the `then' part
	has determinism `erroneous' or `failure'.)  The treatment
	of this problem for if-then-elses is similar to the way we
	treat the analgous problem for conjunctions.

tests/valid/Mmake:
tests/valid/tricky_ite.m:
	Regression test for the above bug fix.
1997-08-09 01:30:37 +00:00
Fergus Henderson
474c88cede Fix a bug or two that showed up when exporting a func/0 with a func
Estimated hours taken: 2

compiler/mercury_to_mercury.m:
	Fix a bug or two that showed up when exporting a func/0 with a func
	declaration that combines types and modes.  It was incorrectly
	(a) printing the determinism in the type declaration, not just
	the mode declaration and (b) printing the determinism in the
	wrong place in the mode declaration.

tests/valid/Mmake.m:
tests/valid/func_int_bug.m:
tests/valid/func_int_bug_main.m:
	Regression test for the above bug fix.
1997-08-08 19:30:39 +00:00
Zoltan Somogyi
351a1cfdd4 Bug fix: make sure that the transformation that keeps stack frames
Estimated hours taken: 4

compiler/frameopt:
	Bug fix: make sure that the transformation that keeps stack frames
	put the instruction that restores succip before a livevals/goto pair.
	It used to put it in between the livevals and the goto, which violates
	an invariant that value numbering depends on.

compiler/vn_table:
	Allow the two operands of an operator to be the same.

compiler/vn_util:
	Add simplification rules for dealing with boolean and and or,
	and rules exploiting the identities of several operators.

tests/hard_coded/float_map:
	A test case for the fix to builtin_float_compare recently checked in
	by Fergus.

tests/hard_coded/Mmake:
	Enable the new test case.

tests/valid/livevals_seq:
	A new test case for the fix to frameopt.

tests/valid/double_vn:
	A new test case for the fix to vn_table.

tests/valid/Mmake:
	Enable the new test cases.
1997-07-23 08:38:18 +00:00
Fergus Henderson
27b076a173 Fix a bug: the code was passing around two different copies
compiler/simplify.m:
	Fix a bug: the code was passing around two different copies
	of ModuleInfo, one passed directly, one stored in the det_info
	in the simplify_info, and these were not being kept in sync.
	That caused the final ModuleInfo to contain the wrong merge_inst
	table, which led to map__lookup failures.

tests/valid/Mmake:
tests/valid/lazy_list.m:
	Add regression test for the above bug.
1997-07-12 17:53:58 +00:00
Fergus Henderson
f4e0523e03 Fix a couple of bugs in the handling of implicit quantification
for variables in lambda goals.

compiler/quantification.m:
	(1) When implicitly-quantifying a lambda goal, the "lambda-outsidevars"
	    should be set to the empty set, so that variables occurring
	    only inside disjoint lambda goals are locally quantified
	    inside those lambda goals.
	(2) When quantifying conjunctions and if-then-elses, use both
	    the lambda outsidevars and the ordinary outsidevars when
	    computing the non-locals, rather than just using the
	    ordinary outsidevars.

tests/valid/lambda_quant.m:
	Add another test case for bug (1).
	There was already a tests in this module that was supposed to
	test this sort of stuff, but that test case happened to work,
	because the effects of bugs (1) and (2) cancelled out. :-(

tests/valid/Mmake:
tests/valid/lambda_quant_bug.m:
	Add a regression test for bug (2).
1997-07-12 17:52:43 +00:00
Tyson Dowd
8be7f7e2b7 Fix several bugs in liveness for accurate GC.
Estimated hours taken: 5

Fix several bugs in liveness for accurate GC.

compiler/liveness.m:
	- Add `liveness__get_nonlocals_and_typeinfos'.
	- Call `liveness__get_nonlocals_and_typeinfos' instead of just
	  getting nonlocals. This removes a lot of repeated code (and
	  improves correctness).
	- Intersect the initially live variables with the non-locals and
	  their typeinfo vars, not just the non-locals.
	- Don't add corresponding typeinfos to the liveness after the
	  intersection (previously we did this, which "fixed" many
	  problems that doing the intersection wrong introduced, but
	  introduced a few bugs of its own).

tests/valid/Mmake:
tests/valid/agc_graph.m:
tests/valid/agc_ho_pred.m:
	Test cases for these bugs.
1997-07-03 07:18:27 +00:00
Fergus Henderson
2f92c3a095 Regression test for bug in modecheck_call.m with handling
Estimated hours taken: 0.25

tests/valid/Mmake:
tests/valid/higher_order_implied_mode.m:
	Regression test for bug in modecheck_call.m with handling
	of implied modes of higher-order calls.
1997-07-03 05:55:40 +00:00
Simon Taylor
620b1a1162 Test case for inter-module optimization.
Estimated hours taken: 0.2

tests/valid/intermod_test.m
tests/valid/intermod_test2.m
	Test case for inter-module optimization.
1997-06-29 23:23:32 +00:00
Simon Taylor
91e5e993a3 Fix a bug in simplify.m where deconstructions were being
Estimated hours taken: 0.5

compiler/simplify.m
	Fix a bug in simplify.m where deconstructions were being
	propagated into lambda expressions, changing the non-locals of
	the lambda expression, but the uni-modes field of the lambda
	expression construction was not being updated.

tests/valid/lambda_struct_bug.m
	Regression test.
1997-06-25 08:45:56 +00:00
Tyson Dowd
dcea4df42e Fix a bug in liveness that causes a sanity check to fail for accurate
Estimated hours taken: 1

Fix a bug in liveness that causes a sanity check to fail for accurate
gc.

compiler/liveness.m:
	Handle if-then-else correctly for .agc grades, it wasn't
	handling polymorphic type variables correctly.

tests/valid/Mmake:
tests/valid/agc_ite.m:
	Add a test case for if-then-else - previously the compiler
	aborted on this test case.
1997-06-23 05:32:38 +00:00
Andrew Bromage
cf4f945a9a Test case to ensure that special_preds for higher order
Estimated hours taken: 0.1

tests/valid/Mmake:
tests/valid/ho_inst.m:
	Test case to ensure that special_preds for higher order
	func insts are created and mode/determinism checked correctly.
1997-06-18 07:26:05 +00:00
Tyson Dowd
74c88bc9f0 Fix another bug triggered by compilation for accurate gc.
Estimated hours taken: 5

Fix another bug triggered by compilation for accurate gc.

The compiler was not correctly handling the unbound type variables when
doing inlining.

compiler/inlining.m:

	Update TypeVarSet and TypeInfoVarMap when inlining - unbound
	type variables can occur in the callee which need to be migrated
	to the caller when inlined.  Introduce new inline_info type, which
	stores information threaded through inling. This should make future
	changes to inlining much easier.

compiler/type_util.m:
	Add `apply_substitutions_to_var_map' which will update a
	map(tvar, var) given a type substitution and a variable
	substitution.

tests/valid/Mmake:
tests/valid/agc_unbound_typevars2.m:
	Test case for this bug.
1997-06-03 06:23:09 +00:00
Fergus Henderson
b44a9fa042 Add a regression test for the bug in polymorphism.m that I just fixed.
Estimated hours taken: 0.25

tests/valid/Mmake:
tests/valid/pred_with_no_modes.m:
	Add a regression test for the bug in polymorphism.m that I just fixed.
1997-06-02 06:45:35 +00:00
Simon Taylor
5294c35b1f Use the declared argmodes or procedures when gathering modes to put
Estimated hours taken: 0.1

compiler/intermod.m
        Use the declared argmodes or procedures when gathering modes to put
        into .opt files, since these are the modes that are written to the
        .opt file.

tests/valid/intermod_lambda.m
tests/valid/intermod_lambda2.m
        Updated these to act as a regression test.
1997-05-24 02:20:18 +00:00
Tyson Dowd
630c98c8f1 Remove support for term_to_type and type_to_term implemented as special
Estimated hours taken: 5

Remove support for term_to_type and type_to_term implemented as special
preds.  Remove support for one-cell and one-or-two-cell type_infos (now
shared-one-or-two-cell type_infos). Move definitions that were in
mercury_builtin.m back to where they belong.

This code has been removed because it is no longer used, and was no
longer being maintained but was still quite complex.

tests/general/disj_disj.m:
tests/general/dnf.m:
tests/general/higher_order.m:
tests/general/nondet_disj.m:
tests/hard_coded/cc_nondet_disj.m:
tests/hard_coded/pragma_inline.m:
tests/invalid/funcs_as_preds.err_exp:
tests/misc_tests/mdemangle_test.exp:
tests/valid/agc_unbound_typevars.m:
tests/valid/middle_rec_labels.m:
tests/valid/subtype_switch.m:
tests/warnings/infinite_recursion.m:
	Import module `list' or `term' (or both).
1997-05-20 02:09:15 +00:00
Tyson Dowd
b39bbb1d53 Add test cases for recently fixed accurate garbage collection compilation
Estimated hours taken: 1

Add test cases for recently fixed accurate garbage collection compilation
problems.

tests/valid/Mmake:
tests/valid/agc_unused_in.m:
	Test case for getting liveness right with an unused polymorphic typed
	variable with a mode of `in'.

tests/valid/agc_unbound_typevars.m:
	Test case for keeping the information needed for unbound type
	variables.
1997-05-15 06:55:32 +00:00
Fergus Henderson
e1b7af94a8 Add a regression test for the bug in switch detection
Estimated hours taken: 0.25

tests/valid/Mmake:
tests/valid/switch_detection_bug.m:
	Add a regression test for the bug in switch detection
	that I just fixed.
1997-05-11 11:00:56 +00:00
Simon Taylor
00180662fe Fix a determinism analysis abort which was caused by det_analysis.m not
Estimated hours taken: 1.5

Fix a determinism analysis abort which was caused by det_analysis.m not
updating the instmap to include the initial insts of the lambda variables
before processing a lambda goal. This problem was also present in
cse_detection.m and simplify.m.

tests/valid/Mmake
tests/valid/lambda_instmap_bug.m
	Regression test.
1997-05-08 06:47:41 +00:00
Simon Taylor
f933775d66 Regression test for if-then-elses with conditions that cannot
Estimated hours taken: 0.1

tests/valid/fail_ite.m
	Regression test for if-then-elses with conditions that cannot
	succeed.
1997-04-28 00:07:57 +00:00
Fergus Henderson
16590bb9ea Add test case to check that type inference checks for
Estimated hours taken: 0.5

tests/valid/Mmake:
tests/valid/type_inf_ambig_test.m:
	Add test case to check that type inference checks for
	ambiguities predicate-at-a-time rather than clause-at-a-time,
	as per my recent change to typecheck.m.
1997-04-21 13:44:02 +00:00