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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.