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.
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.
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.
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.)
Estimated hours taken: 0.75
Fix some bugs where we were not properly escaping special characters in
C strings in the generated code.
compiler/llds_out.m:
Change a number of places to call output_quoted_c_string instead of
io__write_string, so that special characters will be properly escaped.
Add new predicate llds_out__quote_c_string, for use by pragma_c_gen.m.
compiler/pragma_c_gen.m:
Call llds_out__quite_c_string, to ensure that special characters
in the generated "pragma_c_raw_code" are properly escaped.
tests/valid/int64.m:
tests/valid/Mmakefile:
Regression test for the above-mentioned bug fix.
Estimated hours taken: 4
Fix a bug with unique mode inference.
compiler/modes.m:
compiler/unify_proc.m:
When doing unique mode inference, save a copy of the old
procedure bodies, and use this to restore the old procedure
bodies before each pass. This avoids problems where
modes.m was doing optimizations based on incomplete
information obtained in passes before the fixpoint.
Note that we already did this for ordinary mode inference, by
copying the clauses from the clauses_info, so this was only a
problem for unique mode inference. But I've also changed that
code so that doesn't copies stuff from the clauses_info before
the first pass, since that is already done by post_typecheck.m.
Now it only does does the copying for the second and subsequent
passes.
tests/valid/Mmakefile:
tests/valid/uniq_mode_inf_bug.m:
Add a test case for the above-mentioned bug.
Estimated hours taken: 0.5
library/parser.m:
Fix a bug: according to the ISO Prolog standard, it should allow
terms of the form `{}(foo)' or `[](foo)'.
tests/valid/Mmakefile:
tests/valid/parsing_bug.m:
tests/valid/parsing_bug_main.m:
Regression test.
Estimated hours taken: 0.5
compiler/make_hlds.m:
Fix a bug introduced by my earlier change to add the new alternative
`exported_to_submodules' to the `import_status' type: I forgot to add
a clause for that alternative to the predicate `combine_status_2/3'.
(The compiler didn't complain because the pred was semidet.)
tests/valid/Mmakefile:
tests/valid/nested_mod_type_bug.m:
Regression test.
Estimated hours taken: 1
compiler/pd_util.m:
Fix a loop in inst_MSG caused by not keeping track
of the set of already expanded insts.
tests/valid/deforest_loop.m:
Regression test.
Estimated hours taken: 1
compiler/simplify.m:
Fix a bug - deforestation and simplify rerun quantification
which can introduce new variables, but these variables were
not in the proc_info in the predicate table which det_analysis
looks up.
tests/valid/deforest_rerun_det.m:
Test case.
Estimated hours taken: 10
Fix bugs in the handling of temporaries.
compiler/code_info.m:
Reorganize the way temporary slots are handled. Create a stack slot
to slot_contents map that is part of the permanent state, so each
slot can be used for only one purpose within a procedure; this is
to make garbage collection of these slots possible. Make the set
of temporary slots in use be part of the location dependent state.
At the ends of branched control structures, consider a temp slot
in use if it was in use at the end of any branch. (Previously,
we considered it live after the control structure if it was live
at the end of the last branch. We got that right for branched
structures that manipulate temp slots, i.e. disjunctions and
if-then-elses, but we got it wrong for switches.
Rename some predicates to get rid of the double meaning of the word
"discard" as applied to a temporary, which used to mean either
"release the slot" or "execute the discard_ticket operation".
It now means only the latter; the word "release" refers to the former.
compiler/disj_gen.m:
compiler/ite_gen.m:
Conform to the new method of handling temporary slots.
tests/valid/complex_failure.m:
tests/valid/semi_fail_in_non_ite.m:
Copies of the test cases from tests/general.
tests/valid/Mmakefile:
Enable the new test cases, running them with --use-trail.
Unfortunately, we cannot just specify --use-trail for them
in tests/general, since that would cause a link error in the usual
case that the runtime being linked with is not in a trailing grade.
Estimated hours taken: 0.5
Fix a bug with quoting of module-qualified terms in .opt files.
Add a test case for this bug.
compiler/hlds_out.m:
Add a version of `hlds_out__write_functor' which has a
`needs_quotes' argument. Call this new predicate from
`hlds_out__write_qualified_functor' to ensure that functors
are properly quoted after the `:'.
compiler/mercury_to_mercury.m:
Export `mercury_output_term/6' so it can be called by
`hlds_out__write_functor/7'.
tests/valid/Mmakefile:
Add the new test case.
tests/valid/intermod_quote.m:
tests/valid/intermod_quote2.m:
New test case for this bug.
Estimated hours taken: 0.5
tests/valid/Mmakefile:
Disable the typeclass related tests in `jump.*' and `fast.*'
grades, since the `func_method.m' tests was failing in those
grades due to the initializer for the base_typeclass_info
containing a pointer and hence being non-const in those grades,
resulting in an error from gcc.
Estimated hours taken: 0.5
compiler/lambda.m:
Fix a bug in the computation of the modes of introduced
predicates.
tests/valid/lambda_output.m:
Test case.
Estimated hours taken: 5
Fix a bug where cse_detection failed to hoist a common deconstruction for
a one-armed switch out where switch_detection expected it to, due to a
call getting in the way. This resulted in switch_detection not finding
a switch necessary to prove determinism correctness.
compiler/switch_detection.m:
compiler/cse_detection.m:
Make both modules use the same code to find deconstructions of
non-local variables of disjunctions.
tests/valid/switch_detection_bug2.m:
Test case, taken from samples/diff.
Estimated hours taken: 0.1
Another fix to make things work with my change to
ensure that the declarations and definitions for data constants
specify the same linkage (extern or static).
tests/valid/intermod_lambda.m:
Add definitions for types which were declared but not defined.
Estimated hours taken: 0.5
Another fix to make things work with my change to
ensure that the declarations and definitions for data constants
specify the same linkage (extern or static).
tests/valid/headvar_not_found.m:
tests/valid/subtype_switch.m:
Add definitions for types which were declared but not defined.
Estimated hours taken: 0.1
tests/valid/typeclasses/func_method.m:
Add a test case for a function as a typeclass method. The non-locals
were not being set correctly, which caused a software error in this
case.
tests/valid/typeclasses/Mmakefile:
Turn this test on.
Estimated hours taken: 1
tests/valid/Mmakefile:
tests/debugger/Mmakefile:
Change the tests for grade `jump' and `fast' so that they also
catch grades `jump.gc', `fast.gc', etc.
compiler/polymorphism.m:
When building the type-infos to be packaged inside a typeclass-info,
apply the variable type bindings first.
tests/valid/instance_unconstrained_tvar.m:
Test case for this.
tests/valid/Mmakefile:
Turn this test on. Also turn another test on which I mistakenly
turned off in my previous commit (because the test was failing).
Estimated hours taken: 1/4
Fix test case... the compiler was getting tripped up by a different bug than
the one this was meant to be testing.
ts/valid/instance_superclass.m:
Fixed so it doesn't have an unbound type variable.
(Actually, I don't really see why the compiler thinks it is unbound).
Estimated hours taken: 1/4
New typeclass test case.
tests/valid/instance_superclass.m:
New test case.
tests/valid/Mmakefile:
Updated to run the new test.
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.
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.
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.
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.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.
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: 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.
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.
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.
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: 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.
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: 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.
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.