Branches: main
Add test case for the previous bug fix:
Fix a problem where a d.u. type which is written out to the implementation
section of an interface file may have field types which are not defined
anywhere. This is the case when a d.u. type has a foreign type definition.
tests/valid/Mmakefile:
tests/valid/foreign_du_field.m:
tests/valid/foreign_du_field2.m:
As above.
Branches: main
Fix bug #123. There was an incorrect assumption that instance method clauses
will not contain explicit type qualifications.
compiler/add_class.m:
compiler/check_typeclass.m:
compiler/make_hlds.m:
Thread the type varset through `produce_instance_method_clause' instead
of creating a dummy varset at each call and discarding the final varset
from `clauses_info_add_clause'.
compiler/options.m:
Fix a typo.
compiler/typecheck_info.m:
Show variable number suffixes with `--debug-types'.
tests/valid/Mmakefile:
tests/valid/instance_typequal.m:
Add test case.
Branches: main
Fix a long standing bug in the liveness detection pass.
compiler/liveness.m:
In detect_deadness_in_goal, when the instmap delta for an if-then-else
goal is `unreachable', call `add_branch_pre_deaths' for the condition
and else goals with the InstmapReachable argument `no', not `yes'.
This avoids triggering a sanity check later in the
detect_resume_points_in_goal pass on the following test case.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/liveness_ite.m:
Add test case.
Estimated hours taken: 8
Branches: main
Represent ":- module" and ":- end_module" items using purpose-specific kinds of
items, instead of as part of the generic "module_defn" item kind. This is in
preparation for a diff that would return submodules as separate entities in
their own right, instead of as an embedded sequence of items that happen
to start with a :- module item and end with an optional :- end_module item.
Also as preparation, make missing a ":- module" declaration at the start of a
source file an error instead of a warning.
compiler/prog_item.m:
Change the type representing items.
compiler/prog_io.m:
Conform to the change above, make missing module declarations into an
error, and simplify some code.
compiler/equiv_type.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the change above. Where relevant, turn chains of
if-then-elses on item types into switches.
compiler/inst.m:
Make the module name in the module declaration match the module name.
tests/invalid/big_test.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/typeclass_test_1.err_exp:
Update the expected error messages.
tests/valid/inhibit_warn_test.m:
To keep this test case valid, don't omit the ":- module" declaration.
Branches: main
Revert a change committed on 2009-08-21 to prevent a compiler abort when using
--trace shallow on a test case. The change caused aborts with other modules.
Fix the original bug a different way, and another bug with --trace shallow.
compiler/live_vars.m:
Revert the old change.
Add a check that variables needed across a call do not appear in the
post-death set of that call.
Only add typeinfo variables to the set of variables needed across a
call for output variable which are not local to the call. Otherwise
the sanity check fails on livevars_shallow2.m.
compiler/liveness.m:
A switch variable which needs to be added to the pre-death set of a
case may require typeinfo variables which describe the type of that
variable to be added to the pre-death set as well. This fixes the
problem with livevars_shallow.m.
tests/valid/livevars_shallow.m:
Replace this test case by another derived from the same original file.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/livevars_shallow2.m:
Add test case.
Branches: main
Support --optimize-constructor-last-call in the java grade, and possibly other
grades using high-level data.
compiler/handle_options.m:
Don't disable --optimize-constructor-last-call on high-level data, nor
if the target language is Java.
compiler/lco.m:
Use a modified transformation when targetting high-level data that
doesn't require taking the address of fields nor using the store_at_ref
builtin.
compiler/ml_unify_gen.m:
Handle the `take_address_fields' part of a construction unification
differently when targetting high-level data.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/lco_term.m:
Add a test case.
Estimated hours taken: 4
Branches: main
Fix test case failures caused by recent changes.
compiler/ml_unify_gen.m:
When generating code for a no_tag type wrapping a float, box the
float constant. Regardless of what it is wrapping, cast the
wrapped rval to the right type in order to avoid warnings from
the C compiler.
tests/valid/Mmakefile:
Move the livevars_shallow test case, which specifies --grade none
for mmc, to the list of tests to be executed only in LLDS grades,
because in MLDS grades, its compilation fails due to mgnuc still
being given the MLDS grade, which causes it to #include the wrong
set of header files.
Branches: main
Fix a compiler abort when compiling the given program with --trace shallow.
compiler/live_vars.m:
Remove any call forward vars from the post-deaths set of a goal.
In the test program, a typeinfo variable added to the forward vars set
by maybe_add_typeinfo_liveness was already in the post-death set.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/livevars_shallow.m:
Add test case.
Branches: main
Allow testing of java grade. Requires using `mmc --make' for now.
This patch does not attempt to fix test failures.
tests/Mmake.common:
Delete unneeded Java-specific rule, which was broken.
tests/benchmarks/Mmakefile:
tests/general/Mmakefile:
tests/general/string_format/Mmakefile:
tests/grade_subdirs/Mmakefile:
tests/hard_coded/Mmakefile:
tests/recompilation/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
Don't deliberately disable tests in java grade.
tests/*.m:
Add Java foreign code.
Write dummy procedures instead of abusing `:- external'.
Branches: main
Fix bug #90. The compiler would abort on the given program when performing
higher order/type specialisation due to "inconsistent type_infos".
compiler/higher_order.m:
In interpret_typeclass_info_manipulator, when assigning to a variable
TypeInfoVar the extracted field of a type_info TypeInfoArg, duplicate
the TypeInfoArg rtti_var_info for TypeInfoVar.
On the test program the rtti_var_info for TypeInfoVar already existed
but was for the procedure *before* specialisation, which is what
lead to the inconsistent type_infos message.
compiler/hlds_rtti.m:
Add version of rtti_var_info_duplicate which doesn't abort if the
rtti_varmap already has an entry for the target variable.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/tci_spec_varmap.m:
Add test case.
Branches: main
compiler/erl_unify_gen.m:
Don't generate code to compare variables with dummy types.
Such variables might not exist in the generated code.
tests/valid/Mmakefile:
tests/valid/unify_dummy.m:
Add test case.
Branches: main
compiler/erl_call_gen.m:
Don't materialise dummy input variables before making a higher order
call. This should no longer be necessary as we replace dummy inputs in
higher order calls by `false' directly. Materialising dummy variables
can cause the Erlang compiler to warn about 'unsafe' code if the
variable is materialised multiple times (although we know it's actually
safe).
Delete materialise_dummies_before_expr, now unused.
tests/valid/Mmakefile:
tests/valid/zf_erlang_bug.m:
Add test case.
Branches: main
compiler/ml_closure_gen.m:
Fix a bug where `ml_gen_wrapper_arg_lvals' treated unused arguments
like output arguments. This caused the Java code generator to abort
on some code.
tests/valid/Mmakefile:
tests/valid/wrapper_arg_lvals.m:
Add test case.
tests/valid/ambig_confuse1.m:
tests/valid/ambig_confuse2.m:
tests/valid/ambig_confuse3.m:
tests/valid/ambig_functor.m:
tests/valid/ambig_high_level.m:
tests/valid/ambig_pred.m:
Add some test cases for the constraint based type checker.
Estimated hours taken: 300
Branches: main
Created a constraint-based typechecker. The typechecker works by generating
a collection of constraints on the types of variables in each clause of the
program, then solving these constraints using propagation. Information on the
types of local variables (clauses_info^clauses_vartypes) and the IDs of
predicate calls (hlds_goal_expr^call_pred_id) is passed back into the HLDS.
In the event that the program being compiled is not type-correct, the
typechecker will generate an error message describing the error. If the
constraints on a variable cannot fully determine a type, the typechecker will
report each possible type the variable could take. If the constraints on the
type of a variable are unsatisfiable, the compiler will report each minimal
unsatisfiable subset of the constraints, pointing out the likely location(s)
of the error.
The constraint-based typechecker can handle ambiguous predicate calls and
functor unifications much more efficiently than the old typechecker. However,
it cannot handle anything related to existentially qualified variables,
typeclass constraints and typeclass methods. The detail and clarity of error
reporting is also rather poor.
These changes have not yet been comprehensively debugged, although it
should work in most cases, given the exceptions detailed above.
To use the constraint-based typechecker instead of the original typechecker,
enable the option --type-check-constraints when compiling your program.
compiler/type_constraints.m:
Built from scratch.
compiler/mercury_compile.m:
Imported the constraint-based typechecker.
Enabled constraint-based typechecking if the --type-check-constraints
option is set.
compiler/options.m:
Added the --type-check-constraints option.
library/list.m:
Added a list.filter_map_foldl predicate.
library/set.m:
Added a predicate version of set.filter_map.
NEWS:
Mention the new library predicates.
Estimated hours taken: 0.1
Branches: main
tests/valid/ambiguity_stress_test.m:
Add this test case, contributed by Michael Day.
tests/valid/Mmakefile:
List the test case, but don't enable it, since we don't now pass it.
Estimated hours taken: 0.2
Branches: main
tests/*/Mmakefile:
Sort the lists of tests in each directory. (We usually keep each list
sorted, but then we concatenate several lists, which loses the order.)
This gives you a better idea of how far a bootcheck still has to go.
tools/bootcheck:
Build the interface files before the rest of the files in the library
directory. Again, this gives you a better idea of how far a bootcheck
still has to go.
Make the dependencies for the slice subdirectory of the stage2 at the
same time as the other subdirs; don't let it be caught later.
library/Mmakefile:
Build the interface files in the right order.
Branches: main
Predefine MR_TypeClassConstaint_NStructs for type classes with arities up
to 10 (was 5). Although low-level C grades would define the structures
for higher arities on demand, this is not currently implemented for
high-level C grades.
runtime/mercury_type_info.h:
Define MR_TypeClassConstaint_NStructs for N =< 10.
compiler/rtti_out.m:
Bump max_always_declared_arity_type_class_constraint.
tests/valid/Mmakefile:
tests/valid/typeclass_constraint_arity.m:
Add test case.
Estimated hours taken: 3
Branches: main
When converting lambdas into separate predicates, the non-local sets of
the procedure which contained the lambda may change. However, the
compiler didn't recompute instmap deltas so that some non-local variables
might not appear in the instmap delta for the goal.
compiler/lambda.m:
Recompute instmap deltas after requantifying the procedure.
tests/valid/Mmakefile:
tests/valid/lambda_instmap_bug2.m:
Add test case.
Estimated hours taken: 0.3
Branches: main
tests/valid/bug85.m:
Add this test case for bug85 (cut down by Julien from a compiler
module).
tests/valid/Mercury.options:
Add the options to compile the test case with.
tests/valid/Mmakefile:
Enable the test case, though we don't yet pass it.
Branches: main
compiler/add_pragma.m:
Do *not* generate table reset/statistics predicates for tabling
pragmas with no attributes.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/table_no_attr.m:
Add test case.
Estimated hours taken: 3
Branches: main
compiler/mode_util.m:
`recompute_instmap_delta' was producing a `reachable' instmap_delta for
a generic call with no solutions. Fix this.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/instmap_generic_failure.m:
Add test case.
Branches: main
Fix a compiler abort when writing out an intermodule optimisation file, the
module for which has a typeclass instance of a typeclass that has a method with
an existentially typed argument, but the predicate which implements
the method is not itself existentially typed. This is Mantis bug #76.
compiler/prog_type.m:
Make `arg_type_list_subsumes' possibly succeed if a callee may bind
existential type variables in the caller, rather than failing.
compiler/pred_table.m:
Update `resolve_pred_overloading' and `find_matching_pred_id' to take
extra arguments for `arg_type_list_subsumes'.
Rename `get_pred_id' and `get_pred_id_and_proc_id' to be less
ambiguous.
compiler/intermod.m:
compiler/modes.m:
compiler/post_typecheck.m:
compiler/purity.m:
Conform to extra arguments and renamings.
compiler/trans_opt.m:
Delete an unused predicate.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/intermod_typeclass_exist.m:
Add test case.
Branches: main
compiler/ctgc.selector.m:
Fix a bug in the implementation of ctgc.selector.subsumed_by which
caused structure sharing analysis to never reach a fixpoint for a
certain module, with sharing widening enabled.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/sharing_loop2.m:
Add the test case.
tests/valid/sharing_loop3.m:
Another test case. The compiler didn't fail on this module before
or after the change, but it did fail on it when I made a different
"fix", so add it too.
Branches: main
The definition of `ctgc.selector.subsumed_by' missed cases such as the
following:
subsumed_by(ModuleInfo, Sel1, Sel2, Type, Extension)
Sel1 = [termsel(foo/2, 1)],
Sel2 = [typesel(bar)]
If the type of the node selected by the term selector in Sel1 is `bar' (the
same as selected by the type selector in Sel2) then it should succeed with
Extension = [].
One symptom was that structure sharing analysis would never reach a fixpoint
analysing some particular SCCs when widening was enabled (which is when type
selectors are introduced).
compiler/ctgc.selector.m:
Fix `subsumed_by' as above.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/sharing_loop.m:
Add a test case.
Estimated hours taken: 0.1
Branches: main
tests/valid/Mercury.options:
Compile the fzn_debug_abort test case with --trace rep, since
--trace deep is not allowed in decldebug grades.
Estimated hours taken: 0.5
Branches: main
Add a new option, --no-warn-unresolved-polymorphism, to stop the
compiler emitting warnings about unresolved polymorphism.
compiler/options.m:
compiler/post_typecheck.m:
Add the option and make reporting unresolved polymorphism
conditional on its value.
doc/user_guide.texi:
Document the new option.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid//no_warn_unresolved_poly.m:
Test the new option.
Estimated hours taken: 0.5
Branches: main
Fix a bug reported by Ralph. The compiler was reporting that type-info
related variables that were being bound in the body of a
promise_equivalent_solutions scope were not mentioned in the head of the
scope. The error message should be restricted to those variables that
occur in the source code, not those introduced by the compiler.
compiler/det_analysis.m:
Do not consider type-info related variables when checking that
variables that are bound in the body of a promise_equivalent_solutions
scope are listed in the head of that scope.
tests/valid/Mmakefile:
tests/valid/promise_equiv_exists_non_local.m:
A regression test for the above problem.
Estimated hours taken: 0.1
Branches: main
tests/hard_coded/Mmakefile:
tests/valid/Mmakefile:
Disable testing of CTGC programs in debugging grades for now as it
results in a compiler abort.
Branches: main
Fix two compiler aborts in the structure sharing analysis.
compiler/ctgc.selector.m:
Fix a problem with widening structure sharing pairs in the presence of
existential types. We'd try to reduce a term selector to a type
selector of the type of the node selected by the term selector, but if
that node would be existentially typed then the compiler would abort.
To avoid that, we resort to reducing the selector to a type selector of
the parent node's type instead.
Make `type_of_node' and `select_subtype' into semidet predicates which
fail if the selector would select an existentially typed node, rather
than aborting. Add det versions of the original functions.
Make `select_subtype' able to succeed on existentially typed functors
if the selector doesn't actually select an existentally typed
argument.
compiler/structure_sharing.domain.m:
Don't add a new sharing pair to a sharing set if the left and right
hand sides of the sharing pair are the same after normalisation. This
avoids a different abort if such a pair needs to be removed: it tries
to remove both (LHS - RHS) and (RHS - LHS) but since the two sides are
equal, only one copy of the pair would exist in the sharing set to be
removed.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/sharing_exist.m:
Add test case.
Branches: main
Fix Mantis bug #43. The compiler was aborting when making an `.opt' file when
`--intermod-unused-args' was enabled for the following test case. The problem
was that polymorphism wasn't adding all type variables in typeclass
constraints into the procedure's type_info varmap.
It also revealed a problem where we were writing out unused args pragmas for
type specialised procedures. The compiler aborts when reading them back in,
as for other analyses.
compiler/polymorphism.m:
In `record_constraint_type_info_locns', when working out which type
variables we haven't seen before, we only checked type variables which
appear directly in a constraint, e.g. `tc(T)'. We also need to check
variables which appear in type constructors, e.g. `tc(tt(T))'.
compiler/unused_args.m:
Don't write out unused args pragmas for type specialised procedures.
Convert some lambdas into predicates.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/intermod_ua_type_spec.m:
Add test case.
Estimated hours taken: 2.5
Branches: main
Write out user-specified structure sharing annotations
(no_sharing/unknown_sharing/sharing) on foreign_procs, e.g. when making `.opt'
files.
compiler/prog_data.m:
Move `attributes_to_strings' to mercury_to_mercury.m and rename it to
less ambiguous `foreign_proc_attributes_to_strings'. This is to avoid
a circular dependency.
Add a comment that adding a field to `pragma_foreign_proc_attributes'
requires updating `foreign_proc_attributes_to_strings'.
compiler/mercury_to_mercury.m:
Make `foreign_proc_attributes_to_strings' take into account user
sharing annotations.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/intermod_user_sharing.m:
tests/valid/intermod_user_sharing_2.m:
Add a test case.
Estimated hours taken: 4
Branches: main
compiler/var_locn.m:
Fix a compiler abort where the structure reuse pass would tell the
code generator to reuse a dead cell, which turns out to be known (at
compile time) to be static.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/reuse_static.m:
Add a test case.
Estimated hours taken: 12
Branches: main
Fix two problems that together caused bug Mantis bug #44.
The first bug was that unify_gen.m wasn't checking whether a variable it was
adding to a closure was of dummy type or not.
The second bug was that the code for recognizing whether a type is dummy or not
recognized only two cases: builtin dummy types such as io.state, and types
with one function symbol of arity zero. In this program, there is a notag
wrapper around a dummy type. Since the representation of a notag type is
always the same as the type it wraps, this notag type should be recognized
as a dummy type too.
compiler/unify_gen.m:
Fix the first bug by adding the required checks.
compiler/code_info.m:
Add a utility predicate to factor out some now common code in
unify_gen.m.
(The modifications to all the following files were to fix the second bug.)
compiler/hlds_data.m:
compiler/prog_type.m:
Change the type_category type (in prog_type.m) and the enum_or_dummy
type (in hlds_data.m) to separate out the representation of notag types
from other du types. This allows the fix for the second bug, and
incidentally allows some parts of the compiler to avoid the same tests
over and over.
To ensure that all places in the compiler that could need special
handling for notag types get them, rename those types to
type_ctor_category (since it does *not* take argument types into
account) and du_type_kind respectively.
Since the type_ctor_category type needs to be modified anyway,
change it to allow code that manipulates values of the type to
factor out common code fragments.
Rename some predicates, and turn some into functions where this helps
to make code (either here or in clients) more robust.
compiler/make_tags.m:
When creating a HLDS representation for a du type, record whether
it is a notag type (we already recorded whether it is enum or dummy).
compiler/type_util.m:
Fix the predicate that tests for dummy types by recognizing the third
way a type can be a dummy type.
Don't test for dummyness of the argument when deciding whether
a type could be a notag types; just record it as a notag type,
and let later lookup code use the new fixed algorithm to do the right
thing.
Add a type for recording the is_dummy_type/is_not_dummy_type
distinction.
Rename some predicates, and turn some into functions where this helps
to make code (either here or in clients) more robust.
Add an XXX about possible redundant code.
compiler/llds.m:
Use the new type instead of booleans in some places.
compiler/add_pragma.m:
compiler/add_special_pred.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/continuation_info.m:
compiler/ctgc.selector.m:
compiler/ctgc.util.m:
compiler/equiv_type_hlds.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/erl_code_util.m:
compiler/erl_unify_gen.m:
compiler/exception_analysis.m:
compiler/export.m:
compiler/foreign.m:
compiler/higher_order.m:
compiler/hlds_data.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/inst_match.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/prog_type.m:
compiler/rtti_to_mlds.m:
compiler/simplify.m:
compiler/special_pred.m:
compiler/stack_layout.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_constr_util.m:
compiler/term_norm.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/var_locn.m:
Conform to the changes above.
Make a few analyses more precise by using the new detail in the
type_ctor_category type to make less conservative assumptions about
du types that are either notag or dummy.
In ctgc.selector.m, ctgc.util.m, make_tags.m, mlds_to_java.m
and special_pred.m, add XXXs about possible bugs.
tests/valid/fzn_debug_abort.m:
Add the bug demo program from Mantis as a regression test.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the new test, and run it with the old bug-inducing option.
Estimated hours taken: 100
Branches: main
Implement higher-order `any' insts. Pred or func expressions with an `any'
inst may bind non-local solver variables, but themselves must not be
called in a negated context. (The existing ground pred and func expressions
may not bind non-local solver variables, but may be called in a negated
context.)
Higher-order `any' insts are specified by using `any_pred' and `any_func'
in place of `pred' and `func', respectively.
We implement these insts by adding a new field to the any/1 constructor of
mer_inst, which is identical to the ground_inst_info field of the ground/2
constructor. Both are given the new type `ho_inst_info'. We then relax the
locking of non-local variables in these pred and func expressions, and extend
call/N and apply/N to also accept the new insts (provided the variables are
not locked).
We also store the groundness (ho_ground or ho_any) of each lambda expression
in a unification, in a new field in the rhs_lambda_goal constructor.
NEWS:
Mention the new feature.
compiler/prog_data.m:
Rename the ground_inst_info type ho_inst_info, and update its
documentation.
Add the ho_inst_info field to the any constructor in mer_inst.
compiler/hlds_goal.m:
Add the rhs_groundness field to rhs_lambda_goal in unify_rhs.
compiler/inst_match.m:
Propagate inst matching into the pred_inst_infos of any insts,
if they exist.
compiler/inst_util.m:
Propagate abstract unification and inst merging into the
pred_inst_infos of any insts, if they exist. May use of this
information when building ground, any, shared and mostly_unique
versions of insts.
compiler/modecheck_call.m:
Allow an `any' inst as the pred (func) argument to call/N (apply/N),
but check that the variable is not locked. If the variable is
locked, report a mode error which suggests using the ground inst.
(We could also suggest that the goal be made impure, but it is
best to point users towards the pure approach.)
compiler/modecheck_unify.m:
Relax the locking of non-locals when processing non-ground lambda
goals.
Update documentation.
compiler/mode_util.m:
Propagate type information into the pred_inst_infos of any insts.
compiler/mode_errors.m:
Change the purity error "lambda should be impure" to "lambda
should be any", since this is better advice. Also provide an
example of correct syntax if the verbose errors option is given.
compiler/prog_io_goal.m:
Parse the new kinds of expressions, returning the groundness along
with the existing information about lambda expressions.
compiler/superhomogeneous.m:
Use the above groundness when building the lambda unification.
compiler/prog_io_util.m:
Parse the new kind of insts, filling in the new ho_inst_info field
where appropriate.
compiler/polymorphism.m:
Handle the new fields. Assume that the shorthand form of lambda
expressions always defines a ground inst -- if users want non-ground
higher-order expressions they will need to use an explicit any_pred
or any_func expression.
compiler/equiv_type_hlds.m:
Replace equivalent types in the pred_inst_infos of `any' insts.
compiler/module_qual.m:
Module qualify the pred_inst_infos of `any' insts.
compiler/recompilation.usage.m:
compiler/unused_imports.m:
Look for items or imports used by insts in the pred_inst_infos of
`any' insts.
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
Output the new lambda expressions and insts in the correct format.
compiler/type_util.m:
Treat all pred and func types as solver types. (Effectively they
are, since all such types can now have non-ground values, with
call/N and apply/N acting as constraints.)
compiler/lambda.m:
Pass the groundness value when building procedures for lambda
expressions. This is not currently required for anything.
doc/reference_manual.texi:
Document the new feature, and update existing documentation on
solver types and negated contexts.
tests/valid/Mmakefile:
tests/valid/ho_any_inst.m:
New test case for some valid code using higher-order any insts.
tests/invalid/Mmakefile:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_any_inst.m:
New test case for some illegal code.
tests/invalid/anys_in_negated_contexts.err_exp:
Update expected error message for this test case. We now report
that the expression should be `any', rather than impure.
compiler/*.m:
Handle the new fields.
Estimated hours taken: 1.5
Branches: main
Fix bug #30. The determinism analysis run as part of partial deduction
was erroneously reporting that the head of a promise_equivalent_solutions
scope contained extra variables, i.e. non-locals that were not further bound
or (potentially) constrained within the scope.
This violated an assertion that this run of determinism checking should
not produce any errors.
The error was caused because some of the variables in the scope head that
prior to inlining had inst any, had become ground after inlining.
The fix is to ignore such extra variables in determinism analysis passes
that are invoked after inlining.
compiler/det_util.m:
Add a field to the det_info structure that indicates whether or not we
should report extra variables occurring in the head of a
promise_equivalent_solutions scope as an error.
Define a new type to represent this.
compiler/det_analysis.m:
Check the value of the above field before reporting the
presence of extra variables in a promise_equivalent_solutions scope.
compiler/pd_util.m:
compiler/det_report.m:
compiler/simplify.m:
Set the value of the det_info di_pess_extra_vars field as necessary.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/equiv_solns_ia.m:
Regression test for the above.
Estimated hours taken: 1
Branches: main
Fix an annoyance: the compiler was emitting warnings for opt imported
predicates that it had inferred were erroneous. Suppress this behaviour
since there is not much the writer of the importing module can do about it.
(The writer could enable --no-warn-inferred-erroneous for the importing
module but that may suppress warnings for which something useful could
potentially be done.)
Additionally the context attached to the spurious warning indicated that
it was occurring inside a .int file, which is a potential source of
confusion in itself.
compiler/det_report.m:
Don't warn about opt imported predicates whose determinism is inferred
to be erroneous.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/opt_det_warn.m:
tests/valid/opt_det_warn2.m:
Test case for the above.
Estimated hours: 0.1
Branches: main
Disable a test case that will no longer compile successfully due to
the change in r1.82 of compiler/inst_match.m. (The test checked that
mutable varsets were correct in the presence of automatic solver type
initialisation - there's not much point in fixing it will that is not
officially supported.)
tests/valid/Mmakefile:
Disable the solver_type_mutable_bug test.
tests/valid/solver_type_mutable_bug.m:
Add a comment to the head of this module explaining why we don't
run it.
Estimated hours: 0.1
Branches: main
Fix the failure of tests/valid/testxmlreader with --intermodule-optimization
enabled.
tests/valid/xmlreader.m:
The C type xmlTextReadrPtr in the foreign type definition for
xmlreader is undefined. This causes problems when compiling
with --intermodule-optimization. Provide a dummy definition.
(This is okay since the test is a regression test for problems
in Mercury's code generator, i.e. it doesn't really matter what
the C code is.)
Estimated hours taken: 4
Branches: main
Fix bug #28 in Mantis. The only substantive change is to code_info.m; the
changes to the other compiler modules are cosmetic only.
compiler/code_info.m:
Fix bug #28 in Mantis. The problem was with the code that generated the
annotation giving the set of live lvalues at calls: it didn't delete
from the set the registers used for passing dummy arguments, such as
I/O states. A recursive call for an I/O predicate would thus compute
the correct set of live lvalues at the start of the predicate body
(in the case of the test case, {r1}), but the wrong set at the
recursive call ((in the case of the test case, {r1,r2}, with r2
being the register assigned to hold the I/O state argument). The bug
was an abort caused by a sanity check looking for this kind of
mismatch.
compiler/c_util.m:
Make two predicates into functions to make them easier to use.
compiler/opt_debug.m:
Use those functions.
compiler/ml_code_gen.m:
compiler/pragma_c_gen.m:
Conform to the change to c_util.
compiler/jumpopt.m:
Delete unnecessary module qualifications.
tests/valid/testxmlreader.m:
tests/valid/xmlreader.m:
A regression test for this bug. It is in valid rather than hard_coded
because it cannot be made executable without libraries that not all
machines have, and which it would be inappropriate to add to the test
suite itself.
tests/valid/Mmakefile:
Enable the new test case.
Estimated hours taken: 2
Branches: main
Remove support for the `initialisation is ...' attribute from solver types.
This attribute is now a syntax error, unless the developer-only option
`--solver-type-auto-init' is enabled -- in which case things will work
as before.
Update the test suite to conform to the above change.
compiler/globals.m:
Add a mutable that stores whether or not we support automatic
solver type initialisation. The value of this mutable is used in
the parser to decide if `initialisation is ...' attributes in solver
type definitions are legal syntax or not.
compiler/prog_io.m:
Only accept `initialisation is ...' attributes in solver type
definitions as legal syntax if the value of the above mutable indicates
that `--solver-type-auto-init' is enabled.
NEWS:
Announce the removal of support for automatic initialisation.
tests/debugger/Mercury.options:
Run the solver_test test with `--solver-type-auto-init' enabled.
tests/hard_coded/Mercury.options:
Run tests that check if automatic initialisation is working
with `--solver-type-auto-init' enabled.
Delete a reference to a test case was deleted some time ago.
tests/warnings/Mercury.options:
tests/invalid/Mercury.options:
Enable `--solver-type-auto-init' for some tests.
tests/invalid/any_mode.m:
tests/invalid/any_passed_as_ground.m:
tests/invalid/any_should_not_match_bound.m:
tests/invalid/any_ground_in_ite_cond.m:
tests/valid/solv.m:
tests/hard_coded/any_call_hoist_bug.m:
tests/hard_coded/any_free_unify.m:
tests/hard_coded/sub-modules/ts.m:
Remove `initialisation is ...' attributes from the solver type
definitions in these tests.
Estimated hours taken: 2
Branches: main
Fix a problem with conjunction re-ordering that was introduced by my
recent change to remove automatic solver type initialisation.
This was causing the stage 2 deep profiler to break.
compiler/modes.m:
Despite its name, modecheck_delayed_solver_goals, in fact
attempts to reschedule all goals, not just solver goals.
Call this predicate as we did before my previous change and
shift the code disables automatic initialisation to a place
where the rescheduling of non-solver goals will not be affected.
tests/valid/Mmakefile:
tests/valid/trace_goal_reorder.m:
A test case for the above bug.
tests/invalid/partial_implied_mode.err_exp:
Revert the last change to this file. The change to the
expected error was caused by the above bug.
Estimated hours taken: 1
Branches: main
Fix bug #21: the compiler was generating badly typed initialisation predicates
for equivalence types. They were badly typed because equiv_type_casts were
being omitted from the clauses.
compiler/unify_proc.m:
Re-arrange an if-then-else so that correct clauses are generated for
the initialisation predicates of equivalence types. The condition
on the first if goal previously meant that the else if branch
that would have generated the correct code for equivalence types
was never executed.
compiler/add_special_pred.m:
Fix a comment.
tests/valid/Mmakefile:
tests/valid/fz_conf.m:
Test case for the above bug.
tests/valid/Mercury.options:
Compile the new test case with `--solver-type-auto-init'.
Group all the test cases that require this flag together.
Estimated hours taken: 10
Branches: main
Remove support for automatic initialisation of solver types from the language.
This is being done because:
* the current implementation of automatic initialisation means we cannot
support polymorphic solver types, e.g. you cannot have the type foo(bar)
where:
:- solver type foo(T).
:- solver type bar.
* the current initialisation strategy is fairly ad-hoc anyway; in particular
it has a tendency to unnecessarily change the determinism of procedures.
* mode error messages are often quite poor because of the interaction between
automatic initialisation and impure code.
* automatic initialisation is not used in practice. All of the
G12 solver libraries that use solver types recommend explicitly
initialising solver variables.
This change removes support for automatic solver initialisation from the
language. The code for supporting it remains in the implementation, but
it is now dependent upon the developer-only `--solver-type-auto-init'
option.
As a transitional measure the compiler will still accept
`initialisation is ...' attributes in solver type definitions even when
`--no-solver-type-auto-init' is enabled. After this change has bootstrapped,
and the relevant updates have been made to the G12 solver libraries, this
will be changed so that `initialisation is ...' attributes are considered
a syntax error unless `--solver-type-auto-init' is enabled.
doc/reference_manual.texi:
Document that solver type definitions no longer allow initialisation
predicates to be supplied. (The section documenting initialisation
predicates has been commented out rather than deleted since the
implementation of automatic initialisation still exists.)
Remove the section documenting the restrictions on polymorphic
solver types. These restrictions no longer apply in the absence
of automatic initialisation.
compiler/options.m:
Add a new developer-only option, `--solver-type-auto-init', that
controls whether automatic initialisation of solver variables is
allowed (for those solver types that have initialisation predicates
specified.)
compiler/prog_data.m:
Add a type that represents whether a solver type allows automatic
initialisation or not.
Extend the solver_type_details structure to allow initialisation
predicates to be optional.
compiler/prog_io.m:
Allow initialisation predicates to be optional in solver type
definitions.
compiler/modes.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
Only insert calls to solver type initialisation predicates if
the solver type has an initialisation predicate and the
developer-only option `--solver-type-auto-init' is enabled.
compiler/unify_proc.m:
Handle the situation where a solver type does not have an
initialise predicate.
compiler/add_special_pred.m:
Only add initialisation special predicates for those solver
types whose definition provides an initialisation predicate.
compiler/mode_info.m:
Add a utility predicate that tests whether the support for
automatic solver type initialisation is enabled.
compiler/type_util.m:
Add a predicate that tests whether a type is a solver type
that supports automatic initialisation.
Add an XXX comment about such types and abstract equivalence
types.
compiler/mercury_to_mercury.m:
Conform to the above changes.
compiler/special_pred.m:
Fix some typos.
samples/solver_types/eqneq.m:
Delete the `initialisation is ...' from the definition of the solver
type eqneq/1.
tests/hard_coded/Mercury.options:
Enable `--solver-type-auto-init' for the solver_construction_init_test
test.
tests/hard_coded/solver_build_call.m:
tests/invalid/any_pass_as_ground.m:
Don't use automatic solver variable initialisation in these
test cases.
tests/invalid/partial_implied_mode.err_exp:
Conform to the above changes in the mode analyser.
tests/valid/Mercury.options:
Compile some tests cases with `--solver-type-auto-init' enabled.
Estimated hours taken: 0.5
Branches: main
compiler/erl_code_gen.m:
Fix a bug in the Erlang code generator where a call to a predicate
with determinism `failure' can be followed by references to unbound
variables.
tests/valid/Mmakefile:
tests/valid/call_failure.m:
Add test case.
Estimated hours taken: 0.2
Branches: main
compiler/elds_to_erlang.m:
Shorten function names which are too long for Erlang. Previously we
did this only for RTTI functions.
tests/valid/Mmakefile:
tests/valid/long_name.m:
Add test case.
Estimated hours taken: 2
Branches: main
Fix a bug in the bug in the generation of if-then-else goals in the Erlang
backend. The calculation of the variables bound by the then branch was wrong
for model_semi conditions -- it included variables bound in the condition.
compiler/erl_code_gen.m:
Fix the calculation of variables bound by then branches.
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
Add test case.
Estimated hours taken: 1
Branches: main
hard_coded/Mmakefile:
Disable solver type tests in non-C grades.
Disable C foreign interface tests in non-C grades.
Disable C runtime option test in non-C grades.
valid/Mmakefile:
Disable solver type tests in non-C grades.
Disable C foreign interface tests in non-C grades.
Delete stray `$' character.
hard_coded/foreign_import_module.m:
hard_coded/foreign_import_module_2.m:
valid/mert.m:
valid/solver_type_bug.m:
Make these test cases work in Erlang
hard_coded/write_xml.m:
Add Erlang foreign code (still fails for other reasons).
Estimated hours taken: 1
Branches: main
compiler/ml_string_switch.m:
Fix a compiler abort when generating code for determistic string
switches.
tests/valid/Mmakefile:
tests/valid/det_string_switch.m:
Add test case.