mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
master
66 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b560f66ab9 |
Move four modules from check_hlds.m to hlds.m.
After this, I think all modules in the check_hlds package belong there.
compiler/inst_match.m:
compiler/mode_test.m:
Move these modules from the check_hlds package to the hlds package
because most of their uses are outside the semantic analysis passes
that the check_hlds package is intended to contain.
compiler/inst_merge.m:
Move this module from the check_hlds package to the hlds package
because it is imported by only two modules, instmap.m and inst_match.m,
and after this diff, both are in the hlds package.
compiler/implementation_defined_literals.m:
Move this module from the check_hlds package to the hlds package
because it does a straightforward program transformation that
does not have anything to do with semantic analysis (though its
invocation does happen between semantic analysis passes).
compiler/notes/compiler_design.html:
Update the documentation of the goal_path.m module. (I checked the
documentation of the moved modules, which did not need updates,
and found the need for this instead.)
compiler/*.m:
Conform to the changes above. (For many modules, this deletes
their import of the check_hlds package itself.)
|
||
|
|
3a042143b4 |
Keep modecheck_util.m private in check_hlds.m.
compiler/check_hlds.m:
As above.
compiler/mode_util.m:
compiler/modecheck_util.m:
To make that possible, move two predicates from modecheck_util.m,
which are used from outside the check_hlds package, to mode_util.m,
which is in the hlds package.
compiler/deforest.m:
compiler/pd_info.m:
Import mode_util.m instead of modecheck_util.m.
|
||
|
|
d8a31e574e |
Move six utility modules from check_hlds to hlds.
compiler/inst_lookup.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_util.m:
compiler/mode_util.m:
compiler/type_util.m:
Move these modules from the check_hlds package to the hlds package.
The reason is that all the content of five of these modules, and
most of the content of one module (inst_util.m) is not used
exclusively during semantic checking passes. (A later diff
should deal with the exception.) Some are used by the pass that
builds the initial HLDS, and all are used by middle-end and backend
passes. The move therefore reduces the number of inappropriate imports
of the check_hlds package.
compiler/check_hlds.m:
compiler/hlds.m:
Effect the transfer.
compiler/*.m:
Conform to the changes above.
|
||
|
|
153590a30f |
Update and fix more copyright notices.
compiler/*.m:
As above.
|
||
|
|
0c162fb50e |
Improve diagnostics for higher-order mode errors.
In case of a problem with an argument of a higher order call,
we used to generate diagnostics containing text such as
in argument 2 (i.e. argument 1 of the called function)
of impure higher-order function call:
This clumsy construction was needed because the HLDS did not contain
enough info. Specifically, it did not specify whether in the source code,
the higher order call was written as e.g. call(P, A, B, C) or as P(A, B, C).
If the former, then then a problem with e.g. A occurs in argument 2
of the call to the 'call' builtin; if the latter, then it occurs
in argument 1 of the call to 'P'.
This diff fixes that. It adds to the HLDS representation of higher order
calls a record of the original form of the call in the source code
compiler/hlds_goal.m:
Add this field, the higher_order_syntax field, to the representation
of higher order calls.
compiler/goal_expr_to_goal.m:
Fill the higher_order_syntax field for higher order predicate calls.
compiler/resolve_unify_functor.m:
Fill the higher_order_syntax field for higher order function calls.
compiler/hlds_pred.m:
Change the representation of generic calls in call_ids, which we use
to identify callees for diagnostics, to include both the variable
specifying the callee in higher order calls (by changing from a
generic_call_id to the generic_call from which it would be derived
by throwing out that info), and the var_name_source needed to
look up its name.
compiler/hlds_out_util.m:
Use the new higher_order_syntax field to generate text that
- identifies the higher order call as using either call(P, A, B, C)
syntax or P(A, B, C) syntax, and likewise for function, and
- specifies the exact argument number (which will depend on the above
distinction).
This should result in more easily understandable diagnostics.
Add a version of this predicate that generates text that specifically
describes the higher order callee, not the higher order call as a whole.
Add an option to suppress the printing of variable names.
We use this to *not* refer to e.g. "the predicate P" when reporting
an error about P actually being a function, not a predicate.
compiler/mode_info.m:
Rename mode_context_call to mode_context_call_arg, because
the context it describes is one argument of a call.
Add a new mode context, mode_context_call, which now describes
a call as a whole.
compiler/mode_errors.m:
Use the new facilies described above to generate better diagnostics
for higher order calls.
compiler/modecheck_util.m:
Document the reason why we handle argument numbers for higher order calls
the way we do.
When generating an error that relates the whole of a higher order call,
use the new mechanism in mode_info.m to record the fact that the error
is not specific to any one argument of the call. Not doing this would
include the argument number in the context of the error, which would be
misleading.
Add a utility function that is needed by more than one module below.
compiler/*.m:
Conform to the changes above.
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/bind_var_errors.err_exp:
tests/invalid/constrained_poly_insts_2.err_exp:
tests/invalid/det_errors_cc.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/functor_ho_inst_bad_2.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/ho_unique_error.err_exp:
tests/invalid/mode_error_arg_number_ho.err_exp:
tests/invalid/no_ho_inst.err_exp:
tests/invalid/type_diff.err_exp:
tests/invalid_purity/impure_func_t5_fixed.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense_1.err_exp:
tests/invalid_purity/purity_nonsense_2.err_exp:
Expect updated error messages.
|
||
|
|
613345461c |
Report mode errors for bound inst vars.
compiler/mode_errors.m:
When a procedure whose mode includes a constrained inst var makes
a call that would bind that inst var, we have always considered that
to be a mode error, but we reported that error only as actual insts
of the actual arguments not matching the initial insts of the formal
arguments.
Change this by explicitly reporting the binding of one or more inst
variables as the cause of the non-match, and naming those inst vars.
Add a distinguishing prefix to all the function symbols of a type.
compiler/modecheck_call.m:
Collect the extra info now required by mode_errors.m.
Simplify the code that does the collecting, by setting the errors
field of the mode_info to empty at the *start* of the processing
of each procedure of the callee, and by returning info about a
mismatch only when a mismatch actually happens.
Fix some places that should have used modecheck_util.m's mechanism
for computing arg offsets (to refer to user-visible arguments by
their correct argument numbers even in the presence of compiler
generated arguments) but didn't.
compiler/modecheck_util.m:
Use an abstract type (modecheck_arg_offset) to make that kind of bug
impossible to make.
Record inst vars being bound when they shouldn't be bound.
Use more descriptive variable names.
compiler/modecheck_unify.m:
compiler/unique_modes.m:
Conform to the changes abovee.
tests/invalid/constrained_poly_insts_2.err_exp:
Expect the extra info in error messages.
|
||
|
|
406e0f3f83 | Improve programming style. | ||
|
|
52dda2656b |
Shorten some predicate names in modecheck_util.m.
compiler/modecheck_util.m:
As above.
compiler/modecheck_call.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/unique_modes.m:
Conform to the changes above.
|
||
|
|
07109943df |
Better diagnostics for "no matching mode" errors.
compiler/mode_errors.m:
Completely rewrite the code that generates diagnostics for
calls to predicates and functions where the insts of the arguments
in the caller don't meet the requirements of any of the modes
of the callee.
The old code printed
- a list of the arguments in the call together with their insts, and
- a list of the arguments that do not match *any* of the modes.
This was both too much and too little. It was too much in that
arguments that match the initial inst requirements of all the modes
cannot possibly be the cause of the mode error, so including
their inst in the output adds only clutter. In was too little
in that it did not identify arguments that failed to match
the requirements of some modes while matching others.
The new code prints the names of all the arguments, but
- it prints the insts of only the arguments that fail to match
the requirements of at one least mode, and
- for each such argument, it specifies *which* modes of the callee
its inst is incompatible with.
An unrelated change: use lagged iteration to format lists of insts.
compiler/modecheck_util.m:
Fix an old issue that wasn't a problem until now: when reporting
a "no matching mode" error, include the mode that wasn't matched
in the representation of the error. (The old code did not assume
the presence of at least one mode, but the new one does.)
Add an XXX about a desirable improvement, and make the first step
towards implementing it.
compiler/modecheck_call.m:
Fix comment rot.
compiler/write_error_spec.m:
Fix an old bug that affected the updated output for one of the
changed .err_exp files below. The bug was that when a word is
followed by a color change, we assumed that it is ok to break the line
after the color change. When e.g. some text wrapped up in a color
is followed by a suffix, this assumption is false.
The fix is to include the last word before the color change
on the current line only if there is also room on the line
for any following suffix.
Document an invariant.
compiler/inst_mode_type_prop.m:
Fix a typo in an error message.
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/constrained_poly_insts_2.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/state_vars_test_1.err_exp:
tests/invalid/try_detism.err_exp:
Expect the updated diagnostics.
|
||
|
|
2408e77f67 |
Allow and use ho_inst_infos in equivalence types.
compiler/inst_abstract_unify.m:
Include higher-order inst info from types in insts before processing them.
compiler/modecheck_util.m:
Move utility code here from inst_abstract_unify.m, where it used to be
just a part of a predicate, because we now want to use it from more places,
including here.
Include higher-order inst info from types in insts before testing them
against an expected inst. This is needed to handle matches between
higher order insts implicit in types and explicit higher order insts.
compiler/parse_type_name.m:
compiler/parse_type_defn.m:
compiler/parse_type_repn.m:
Allow equivalence types to contain higher-order inst information.
tests/invalid_nodepend/combined_ho_type_inst_1.err_exp:
Expect the *absence* of error messages about equivalence types containing
higher-order inst info.
|
||
|
|
f74e2b70c6 |
Rename the bound_inst type to bound_functor.
compiler/prog_data.m:
As above. The main function symbol of the type was already named
bound_functor, and "bound inst", when spoken/typed in text,
usually refers to the bound/3 function symbol of the mer_inst type,
not to new-renamed type.
compiler/add_mutable_aux_preds.m:
compiler/comp_unit_interface.m:
compiler/cse_detection.m:
compiler/det_report.m:
compiler/direct_arg_in_out.m:
compiler/equiv_type_hlds.m:
compiler/error_msg_inst.m:
compiler/float_regs.m:
compiler/hlds_code_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_mode.m:
compiler/hlds_statistics.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_match.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/inst_util.m:
compiler/lco.m:
compiler/mode_constraints.m:
compiler/mode_errors.m:
compiler/mode_top_functor.m:
compiler/mode_util.m:
compiler/modecheck_coerce.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_inst_mode_name.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_out_item.m:
compiler/parse_tree_to_term.m:
compiler/pd_util.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/simplify_goal_switch.m:
compiler/switch_detection.m:
compiler/types_into_modes.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Perform s/bound_inst/bound_functor/ and s/BoundInst/BoundFunctor/ where
appropriate, with some instances of s/bound_inst_list/bound_functors/.
|
||
|
|
4149a58ea8 |
Fix bad predicate names.
compiler/hlds_proc_util.m:
Rename proc_info_never_succeeds to can_proc_info_ever_succeed.
The latter expresses the question that the predicate is designed to answer,
while the former presupposes what the answer would be.
compiler/modecheck_util.m:
Rename modecheck_var_has_inst_list_{exact_match,no_exact_match} to
modecheck_vars_have_inst_list_{exact_match,no_exact_match}, because
the old names were misleading: both predicates take a *list* of variables,
not a single variable.
compiler/mode_util.m:
Add mode_list_get_initial_final_insts, which does the same job
as two calls to mode_list_get_initial_insts and mode_list_get_final_insts,
but faster.
compiler/modecheck_call.m:
Use the new predicate in mode_util.m.
Conform to the changes above.
compiler/modecheck_unify.m:
compiler/unique_modes.m:
Conform to the changes above.
|
||
|
|
16e50783c5 |
Reorder the contents of modecheck_unify.m.
And add some missing copyright years.
compiler/modecheck_unify.m:
This module handles three kinds of unifications, those with vars,
functors and lambdas as their right hand size. Previously, the code
handling these three kinds of unifications were all jumbled up together.
Fix this by moving related predicates next to each other.
Shorten and/or improve some predicate names.
compiler/modecheck_goal.m:
compiler/modecheck_util.m:
compiler/unique_modes.m:
Conform to the changes in modecheck_unify.m.
|
||
|
|
556161aa80 |
Move create_var_var_unification to modecheck_util.m.
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
Move create_var_var_unification from modecheck_unify.m to modecheck_util.m,
since it is a utility predicate needed in three modules. The move breaks
what used to be the circural dependency between these two modules.
compiler/modecheck_coerce.m:
Conform to the move.
|
||
|
|
e6e90e1b2a | Fix comment. | ||
|
|
c7d30fa051 |
Reorder argument lists in inst_abstract_unify.m.
compiler/inst_abstract_unify.m:
Impose our usual standard order on the argument lists of the predicates
of this module. First put the paramaters that stay unchanged through
recursion, usually the type, then the is_live/is_dead flag, and then the
real_unify/fake_unify flag, in that order. Put those arguments
containing the properties of the input insts of the operation *after*
all those. Previously, they were all mixed up, and different predicates
even had them mixed differently.
compiler/inst_match.m:
compiler/instmap.m:
compiler/modecheck_coerce.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/recompute_instmap_deltas.m:
Conform to the changed order of arguments in the exported predicates
of inst_abstract_unify.m.
|
||
|
|
877ce06d3b |
Eliminate all calls to no_type_available ...
... outside inst_util.m.
compiler/inst_match.m:
Replace all calls to no_type_available with the actual type,
mostly by requiring our callers in other modules to supply that info.
compiler/inst_util.m:
Stop exporting no_type_available, since all its remaining uses
are in this module.
Document some of the reasons why we do still need it inside this module.
compiler/inst_abstract_unify.m:
compiler/inst_merge.m:
compiler/modecheck_util.m:
compiler/pd_util.m:
Conform to the changes above.
|
||
|
|
6c75c0edb4 |
Use more actual types in inst tests.
compiler/inst_test.m:
compiler/inst_match.m:
Replace some calls to no_type_available with the actual types
of the variables whose insts we are processing.
compiler/inst_abstract_unify.m:
compiler/inst_merge.m:
compiler/inst_util.m:
compiler/instmap.m:
compiler/modecheck_coerce.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/recompute_instmap_deltas.m:
compiler/simplify_goal_disj.m:
compiler/unique_modes.m:
Conform to the changes above.
|
||
|
|
a6f0470291 |
Use actual types in groundness tests.
compiler/inst_test.m:
Add a type argument to inst_is_ground and related predicates.
Previously, these predicates passed the type variable returned by
the "no_type_available" function, which was less than ideal, because
it prevents the recognition of a bound inst that lists all the function
symbols of the type as being ground (provided of course that all
*their* arguments are themselves ground).
Stop considering "any" to match "ground" if the type is not a solver type.
The previous code did the right thing for invalid/bad_fact_table_decls
*only* because of the absence of type information; the new code does
the right thing by design. (However, valid/any_matches_bound did depend
on the old behavior.)
compiler/add_pragma_tabling.m:
compiler/common.m:
compiler/complexity.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/fact_table.m:
compiler/goal_mode.m:
compiler/hlds_proc_util.m:
compiler/instmap.m:
compiler/interval.m:
compiler/lco.m:
compiler/loop_inv.m:
compiler/mode_errors.m:
compiler/mode_test.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/pd_util.m:
compiler/proc_requests.m:
compiler/prog_rep.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/ssdebug.m:
compiler/table_gen.m:
Conform to the changes in inst_test.m, by passing along either
the actual types of the variables later being tested for groundness,
or the whole var_table in which their type can later be looked up.
tests/valid/Mmakefile:
tests/valid/any_matches_bound.m:
Disable the any_matches_bound test case, because it depends on behavior
that this diff changes. (That behavior was intented to support HAL,
but is now obsolete.)
|
||
|
|
5a45d1afb8 |
Replace the cons/3 cons_id ...
... with the du_data_ctor/1 cons_id, which contains a du_ctor/3.
Putting all the info about discriminated union data constructors into a
separate type allows code that works only with the cons_ids of du types
to stop having to worry about all the other kinds of cons_ids.
compiler/prog_data.m:
As above.
Delete the cons_ctor type from this module after moving it to
recompilation.usage.m, which is the only part of the compiler
that uses it.
compiler/add_foreign_enum.m:
Replace cons_id_to_tag_map with du_ctor_to_tag_map, since the only
cons_ids the map handles are du_ctors.
compiler/hlds_cons.m:
Replace cons_ids with du_ctors in the cons_table and in the
info we keep about du types' fields.
compiler/hlds_data.m:
Replace cons_ids with du_ctors in cheaper_tag_tests.
Provide two forms of a utility function. Both return du_ctors,
but one wraps them up as cons_ids.
compiler/type_assign.m:
Replace cons_ids with du_ctors in cons_type_info_sources.
compiler/type_util.m:
Switch many of the utility predicates and functions in this module
to operate on du_ctors instead of cons_ids. Split some of the others
to have both du_ctor and cons_id versions.
Replace a predicate that returned a set of solutions one at a time
on backtracking with a predicate that returns all the solutions
at once in a list.
Reduce unnecessary variability in variable names.
Add some XXXs for code with unclear motivations.
compiler/typecheck_error_undef.m:
Delete a function argument that was used only in a sanity check,
because the code at its only call site derived that argument using code
that made it impossible for the sanity check to fail.
Factor out some common code.
compiler/parse_tree_out_cons_id.m:
For three functions that operate on cons_ids, add versions
that do the same job on du_ctors.
compiler/inst_match.m:
Conform to the changes above. This diff rewrites from scratch
the algorithm for testing whether a list of bound insts covers
*all* the du_ctors of a type, because the old code was both inefficient
and very opaque.
compiler/float_regs.m:
Conform to the changes above, and delete a conditionally enabled abort
that shouldn't ever be enabled.
compiler/inst_util.m:
Conform to the changes above, and rename a predicate to avoid
an ambiguity.
compiler/mode_errors.m:
Conform to the changes above, and switch to printing the cons_ids
in some error messages using the standard mechanisms of
write_error_spec.m.
compiler/resolve_unify_functor.m:
Conform to the changes above. Factor out repeated tests against
du_data_ctor.
compiler/term_norm.m:
Conform to the changes above. Add XXXs for some bugs.
compiler/add_type.m:
compiler/assertion.m:
compiler/builtin_lib_types.m:
compiler/comp_unit_interface.m:
compiler/complexity.m:
compiler/const_struct.m:
compiler/cse_detection.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/delay_partial_inst.m:
compiler/direct_arg_in_out.m:
compiler/distance_granularity.m:
compiler/du_type_layout.m:
compiler/error_msg_inst.m:
compiler/field_access.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/goal_util.m:
compiler/hhf.m:
compiler/higher_order.specialize_calls.m:
compiler/higher_order.specialize_unify_compare.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_type_table.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_decide.m:
compiler/lco.m:
compiler/ml_global_data.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_util.m:
compiler/mode_top_functor.m:
compiler/mode_util.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/old_type_constraints.m:
compiler/parse_inst_mode_name.m:
compiler/parse_tree_out_item.m:
compiler/parse_tree_to_term.m:
compiler/polymorphism_goal.m:
compiler/polymorphism_lambda.m:
compiler/pre_typecheck.m:
compiler/prog_ctgc.m:
compiler/prog_mode.m:
compiler/prog_rep.m:
compiler/prog_type.m:
compiler/prog_util.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.usage.m:
compiler/recompilation.used_file.m:
compiler/recompute_instmap_deltas.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/size_prof.m:
compiler/ssdebug.m:
compiler/stack_opt.m:
compiler/structure_reuse.direct_choose_reuse.m:
compiler/structure_reuse.direct_detect_garbage.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_build.m:
compiler/typecheck_clauses.m:
compiler/typecheck_error_util.m:
compiler/typecheck_errors.m:
compiler/unify_gen_test.m:
compiler/unify_gen_util.m:
compiler/unify_proc.m:
compiler/untupling.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
Expect diagnostics generated using the standard error_spec representations
of cons_ids.
|
||
|
|
75dc210ab3 |
Color subjects in mode errors.
compiler/mode_errors.m:
Use color to emphasize the subject variables and terms of mode errors.
Use color to emphasize disagreements as possible causes
in a few more places.
Require reporters of the "no matching mode" error to specify
what the match was against. This is to allow us to generate
better diagnostics. Note the things that should still be improved.
Use the names of numbers (as in two, three etc) instead of their numeral
versions.
Improve the wording and/or the punctuation of some error messages.
compiler/inst_mode_type_prop.m:
Use the names of numbers (as in two, three etc) instead of their numeral
versions.
compiler/error_spec.m:
compiler/write_error_spec.m:
Move two formerly private utility functions of write_error_spec.m
to error_spec.m, and export them. One of them is now used in
the modules above.
compiler/modecheck_call.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/unique_modes.m:
Pass around info about "what the match was against" for the change
in mode_errors.m descrived above.
compiler/hlds_out_util.m:
Improve variable name.
compiler/hlds_module.m:
Add an XXX.
tests/invalid/any_mode.err_exp:
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/any_should_not_match_bound.err_exp:
tests/invalid/any_to_ground_in_ite_cond.err_exp:
tests/invalid/any_to_ground_in_ite_cond_nomax.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bind_var_errors.err_exp:
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_clobbered.err_exp:
tests/invalid/coerce_disambig.err_exp:
tests/invalid/coerce_implied_mode.err_exp:
tests/invalid/coerce_instvar.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/coerce_uniq.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/currying_multimode_func.err_exp:
tests/invalid/dcg_context.err_exp:
tests/invalid/default_ho_inst.err_exp:
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/functor_ho_inst_bad_2.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_2.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/ho_unique_error.err_exp:
tests/invalid/html.err_exp:
tests/invalid/inst_matches_final_bug.err_exp:
tests/invalid/invalid_integral_call_inst.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/mode_error_arg_number.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/no_ho_inst.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/state_vars_test1.err_exp:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/try_detism.err_exp:
tests/invalid/unify_mode_error.err_exp:
tests/invalid/uniq_modes.err_exp:
tests/invalid/uniq_neg.err_exp:
tests/invalid_nodepend/constrained_poly_insts.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_purity/impure_func_t5_fixed.err_exp:
tests/invalid_purity/purity.err_exp:
tests/warnings/simple_code.err_exp:
tests/warnings/unify_f_g.err_exp:
Expect the updated versions of diagnostics.
|
||
|
|
dde8c1f396 |
Delete mer_inst's free/1 functor.
This functor was intended to have the same semantics as free/0, while
containing the type of the value it was applied to. However, commit
|
||
|
|
92941c4239 |
Delete mer_inst's abstract_inst functor.
We have never supported abstract insts, and we are not likely to start
using them any time soon, but we have had them in the representation of insts
since the beginning. Since they were never actually generated, the code
that operated on them was never really tested, which is good, because
in many places, that code simply threw an exception. The code that didn't
throw an exception when it found an abstract inst had to work correctly
for the abstract_insts that we actually generated, which were abstract
only in the sense that they were references to a would-be user-defined inst
name that wasn't actually defined.
There were two sources of such "abstract" insts.
- One was failed calls to inst_lookup that specified an user_inst inst_name.
- The other consisted of predicates whose job was to construct error messages
involving insts. These either converted cons_ids into abstract insts,
or mangled valid user_inst inst_names into invalid user_inst inst_names,
because error_msg_inst.m generated good-looking messages when given
the results of such conversions.
The first is handled by the fact that module qualification detects and
reports references to undefined insts and modes, and does not let the
compiler proceed to the compiler phases that may call inst_lookup.
The second is handled by the changes to error_msg_inst.m below.
These change to handle the use cases of the two error-message-constructing
predicates that used to employ abstract_insts, but now employ user_inst
defined_insts with a two particular kinds of undefined inst ctor,
one for each use case.
compiler/prog_data.m:
Delete the abstract_int function symbol from the mer_inst type.
compiler/inst_lookup.m:
When the lookup of an user_inst inst_name inside a defined_inst
fails, don't convert that defined_inst into abstract inst,
throw an exception.
compiler/error_msg_inst.m:
Add code to deal with the insts that add_mutable_aux_preds.m and
mode_errors.m generate for us to convert to lists of error message pieces.
The addition is done twice, in an as identical a fashion as possible,
when generating non-inline pieces and when generating inline pieces.
compiler/add_mutable_aux_preds.m:
compiler/mode_errors.m:
Document how these modules cooperates with error_msg_inst.m.
compiler/add_mode.m:
compiler/comp_unit_interface.m:
compiler/direct_arg_in_out.m:
compiler/equiv_type_hlds.m:
compiler/float_regs.m:
compiler/hlds_code_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_mode.m:
compiler/hlds_statistics.m:
compiler/inst_abstract_unify.m:
compiler/inst_check.m:
compiler/inst_match.m:
compiler/inst_merge.m:
compiler/inst_mode_type_prop.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/inst_util.m:
compiler/make_hlds_passes.m:
compiler/mode_top_functor.m:
compiler/modecheck_coerce.m:
compiler/modecheck_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/pd_util.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/types_into_modes.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above, mostly by deleting code dealing with
abstract_insts.
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid_nodepend/occurs.err_exp:
Update these expected outputs, which each involve errors generated
by the modified code in mode_errors.m or add_mutable_aux_preds.m.
Some of these referred to some things as "named insts" when they were
*not* named insts in the program.
tests/invalid_nodepend/kind.{m,err_exp}:
Add some invalid code to this test, and update the expected output
accordingly.
|
||
|
|
b6ec42a132 |
Make some arities into pred_form_arities.
compiler/hlds_pred.m:
Replace the arity field in pred_infos with a pred_form_arity field.
Move the pred_info's pred_or_func field to its usual position
in predicate/function descriptions: at the front (pred/func name/arity).
compiler/hlds_pred.m:
Change two utility operations to return pred_form_arities instead of
just arities, since they get them from pred_infos.
compiler/inst_mode_type_prop.m:
compiler/llds.m:
compiler/rtti.m:
Change some fields whose types used to be arity (or int) to be
pred_form_arity.
In llds.m, include a pred_or_func field in c_procedures,
for use in procedure-start comments.
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
Add notes about two possible future improvements along similar lines.
compiler/prog_data.m:
Add a utility function to calculate the number of extra arguments
added to predicates/functions by compiler passes such as polymorphism.
compiler/add_pragma.m:
Conform to the changes above.
Fix a bug in an error message about ":- external" pragmas:
the message used the pred_form arity instead of the user arity.
(See the diff to external2.err_exp below.)
compiler/hlds_defns.m:
Conform to the changes above.
Include pred/func prefixes before name/arity pairs in the output
where relavnt. (The user guide does not need to be updated, because
its wording permits both the old and the new behavior.)
Fix two separate bugs that referred to functions in user-facing output
with the predicate form of their arity.
compiler/table_gen.m:
compiler/unused_args.m:
Conform to the changes above.
Fix a bug in each module that referred to functions in user-facing output
with the predicate form of their arity.
compiler/recompilation.usage.m:
compiler/xml_documentation.m:
Conform to the changes above.
Mark a probable bug in each module with an XXX.
compiler/direct_arg_in_out.m:
Conform to the changes above.
Improve the wording of an error message a bit.
(See the diff to gh72_errors.err_exp below.)
compiler/accumulator.m:
compiler/bytecode_gen.m:
compiler/complexity.m:
compiler/default_func_mode.m:
compiler/det_report.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/higher_order.m:
compiler/hlds_defns.m:
compiler/hlds_error_util.m:
compiler/hlds_module.m:
compiler/intermod.m:
compiler/intermod_order_pred_info.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/llds_out_file.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/mode_errors.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/old_type_constraints.m:
compiler/optimize.m:
compiler/polymorphism.m:
compiler/polymorphism_goal.m:
compiler/post_typecheck.m:
compiler/pre_typecheck.m:
compiler/pred_table.m:
compiler/proc_gen.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.usage.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/simplify_goal_call.m:
compiler/ssdebug.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_initial.m:
compiler/termination.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/tupling.m:
compiler/type_class_info.m:
compiler/typecheck.m:
compiler/typecheck_error_undef.m:
compiler/types_into_modes.m:
compiler/xml_documentation.m:
Conform to the changes above.
compiler/recompilation.m:
Add a note.
compiler/parse_tree_out_sym_name.m:
Improve variable names.
tests/invalid/external2.err_exp:
Expect the fixed arity in an error message.
tests/invalid/gh72_errors.err_exp:
Expect the expanded text of an error message.
|
||
|
|
edf9d4fa1b |
Document how two fields of mode_info work.
compiler/mode_info.m:
Replace the documentation of the mi_mode_context field,
which was a misleading short comment, with a description of how
the field is actually used. Rename one of the function symbols,
which was misleading, in its type.
Add some documentation of the mi_inst_varset field. The documentation
says how that field is actually handled in practice, though I don't know
*why* it is handled that way.
compiler/modecheck_call.m:
Replace a strange way of getting a proc_info.
Improve some variable names.
compiler/modecheck_goal.m:
Improve some variable names.
compiler/mode_errors.m:
compiler/modecheck_util.m:
Conform to the changes above.
compiler/rbmm.region_transformation.m:
Delete an already-handled ZZZ.
|
||
|
|
0ab6993894 |
Convert mode analysis to use var_tables.
compiler/instmap.m:
compiler/mode_comparison.m:
compiler/mode_debug.m:
compiler/mode_info.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/unique_modes.m:
Convert these modules to use var_tables.
compiler/mode_errors.m:
Convert this module to use var_tables.
Fix an ancient error that I think has escaped detection until now
because it arises only in the presence of a mode error in a procedure
whose mode is being inferred. The bug is that when we modecheck a call,
say from p to q, and find no matching modes in the callee because
its mode inference has generated errors, then we report those errors
in the callee as part of the explanation of the error in the caller.
That is fine. What was not fine is that we printed any variables
in the callee's mode_error using the *caller's* varset. We now
print them using the callee's var table.
compiler/type_util.m:
Add a var_table-using variant of an existing predicate,
for use in new code above.
compiler/pd_util.m:
Conform to the changes above.
tests/invalid/mode_inf.m:
Modify this test case to make the caller and callee use disjoint
sets of variable names, which is probably why the incorrect variables
in the error message about the callee has not been noticed.
tests/invalid/mode_inf.err_exp:
Expect the updated, and now correct, version of that error message.
|
||
|
|
ea4f95a7ed |
Use var_tables in lco.m, and when dumping goals.
Since this is the first converted module that dumps out goals when
debugging trace flags are enabled, this required generalizing the code
that does that, to take either varsets or var_tables as a means of
specifying the names of variables. We do this via a new type,
var_name_source, which contains either a varset or a var_table.
Almost all of this diff is there to implement this generalization.
A large part of it affects code in the parse_tree package that we use
to write out the parts of HLDS goals that are defined by types defined
in that package. Since we want to avoid making any part of the parse_tree
package dependent on the hlds package, this required defining the
var_name_source type in the parse_tree package, which in turn requires
var_table.m to be in that same package.
compiler/lco.m:
Convert this module to use var_tables instead of varsets and vartypes.
compiler/var_table.m:
Move this module from the hlds package to the parse_tree package.
To make this, possible, move the parts that required access to the HLDS
to hlds_pred.m, from where it was usually invoked.
Export some utility predicates to allow the moved code to work
in hlds_pred.m without access to the actual definition of the
var_table type.
Define the var_name_source type.
Add some utility functions for use by code writing out variable names.
compiler/hlds_pred.m:
Add the code moved from var_table.m.
compiler/vartypes.m:
Move this module from the hlds package to the parse_tree package,
for symmetry with var_table.m. It did not depend on being in hlds
in any way.
compiler/hlds.m:
compiler/parse_tree.m:
Move vartypes.m and var_table.m from the hlds package
to the parse_tree package.
compiler/hlds_out_goal.m:
Change all the predicates in this module to take a var_name_source
instead of a prog_varset.
Fix some comments.
compiler/hlds_out_util.m:
Change some of the predicates in this module (those called from
hlds_out_goal.m) to take a var_name_source instead of a prog_varset.
compiler/parse_tree_out_term.m:
Provide variants of some existing predicates and functions that take
var_name_sources instead of varsets. The code of the copies
duplicates the logic of the originals, though I hope that this
duplication can be done away with at the end of the transition.
(The best solution would be to use a typeclass with methods
that convert vars to their names, but we would want to ensure
that the compiler can specialize all the affected predicates
and functions to the two instances of this typeclass, which is
something that we cannot do yet. In the meantime, the lack of
any generalization in the old versions preserves their performance.)
tools/sort_imports:
tools/filter_sort_imports:
A new tool that automatically sorts any occurrences of consecutive
":- import_module" declarations in the named files. The sorting is done
in filter_sort_imports; sort_imports loops over the named files.
After automatically replacing all occurrences of hlds.{vartypes,var_table}
in import_module declarations with their parse_tree versions, the updated
import_module declarations were usually out of order with respect to
their neighbours. I used this script to fix that, and some earlier
out-of-order imports.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_heap_ops.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/analysis.m:
compiler/arg_info.m:
compiler/build_mode_constraints.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/check_promise.m:
compiler/closure_analysis.m:
compiler/closure_gen.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/continuation_info.m:
compiler/convert_parse_tree.m:
compiler/coverage_profiling.m:
compiler/cse_detection.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/direct_arg_in_out.m:
compiler/disj_gen.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/file_names.m:
compiler/float_regs.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/goal_mode.m:
compiler/goal_path.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_clauses.m:
compiler/hlds_code_util.m:
compiler/hlds_error_util.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/hlds_out_pred.m:
compiler/hlds_rtti.m:
compiler/hlds_statistics.m:
compiler/inlining.m:
compiler/inst_check.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/instance_method_clauses.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_analysis.m:
compiler/interval.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/lookup_switch.m:
compiler/loop_inv.m:
compiler/make.module_target.m:
compiler/make.util.m:
compiler/make_goal.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_types.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_commit_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_unify_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mmc_analysis.m:
compiler/mode_comparison.m:
compiler/mode_constraints.m:
compiler/mode_debug.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_ordering.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/module_cmds.m:
compiler/old_type_constraints.m:
compiler/opt_debug.m:
compiler/optimize.m:
compiler/options_file.m:
compiler/ordering_mode_constraints.m:
compiler/par_loop_control.m:
compiler/parse_item.m:
compiler/parse_string_format.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/parse_util.m:
compiler/pd_debug.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/peephole.m:
compiler/polymorphism.m:
compiler/polymorphism_info.m:
compiler/polymorphism_lambda.m:
compiler/polymorphism_type_class_info.m:
compiler/polymorphism_type_info.m:
compiler/post_typecheck.m:
compiler/pragma_c_gen.m:
compiler/pred_name.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/quantification.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_graph.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.used_file.m:
compiler/recompilation.version.m:
compiler/recompute_instmap_deltas.m:
compiler/resolve_unify_functor.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/set_of_var.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_goal_scope.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/smm_common.m:
compiler/ssdebug.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.domain.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_data.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/term_constr_util.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/try_expand.m:
compiler/tupling.m:
compiler/type_assign.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_debug.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/var_locn.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
Conform to the changes above.
|
||
|
|
e8503e890c |
Fix formatting of "no matching mode" error msgs.
compiler/error_msg_inst.m:
When printing constrained insts, add the ")" at the end separately,
not as part of a suffix. When it was printed as part of a suffix,
it could be printed before a nl_indent_delta(-1) that balanced
an earlier nl_indent_delta(1).
compiler/mode_errors.m:
Don't get error_msg_inst.m, through the report_inst function, add
an nl_indent_delta(-1) as part of the formatting of an inst,
when it is in fact needed only *after* the inst.
Change the representation of "no matching mode" errors to implicitly
encode the invariant that every argument variable has its own inst.
compiler/modecheck_call.m:
compiler/modecheck_util.m:
Conform to the changed representation of "no matching mode" errors.
tests/invalid/constrained_poly_insts2.err_exp:
Expect the fixed formatting.
|
||
|
|
d76c7bf617 |
Break up inst_util.m and mode_util.m.
This step significantly improves module cohesion.
compiler/inst_abstract_unify.m:
New module carved out of inst_util.m, which does abstract unifications
on insts.
compiler/inst_merge.m:
New module carved out of inst_util.m, which merges insts.
compiler/inst_lookup.m:
New module carved partly out of inst_util.m and partly out of mode_util.m,
which looks up insts in the module_info, and then possibly expands out
the result.
compiler/mode_test.m:
New module carved out of mode_util.m, whose predicates
perform tests on modes.
compiler/mode_top_functor.m:
New module carved out of mode_util.m, which computes top_functor_modes
from modes.
compiler/inst_mode_type_prop.m:
New module carved out of mode_util.m, which propagates type information
into both insts and modes.
compiler/recompute_instmap_deltas.m:
New module carved out of mode_util.m, which recomputes goals'
instmap_deltas.
compiler/inst_test.m:
Move here the predicates in inst_util.m that perform tests on insts.
compiler/inst_util.m:
compiler/mode_util.m:
Delete the code that this diff moves to other modules.
compiler/check_hlds.m:
Add the new modules to the check_hlds package, the package that also
contains inst_util.m and mode_util.m. (Some of these modules could
be argued to fit better in the hlds package, but moving them there
would not be desirable while they depend on code that is still in the
check_hlds package.)
compiler/notes/compiler_design.html:
Document the new modules.
compiler/add_pragma_tabling.m:
compiler/arg_info.m:
compiler/bytecode_gen.m:
compiler/closure_analysis.m:
compiler/complexity.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/det_report.m:
compiler/direct_arg_in_out.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/error_msg_inst.m:
compiler/fact_table.m:
compiler/float_regs.m:
compiler/follow_code.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_pred.m:
compiler/hlds_rtti.m:
compiler/inlining.m:
compiler/inst_match.m:
compiler/inst_user.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/interval.m:
compiler/introduce_exists_casts.m:
compiler/lambda.m:
compiler/lco.m:
compiler/liveness.m:
compiler/lookup_util.m:
compiler/loop_inv.m:
compiler/mark_tail_calls.m:
compiler/ml_args_util.m:
compiler/ml_code_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_util.m:
compiler/mode_constraints.m:
compiler/mode_errors.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/oisu_check.m:
compiler/par_conj_gen.m:
compiler/pd_util.m:
compiler/post_typecheck.m:
compiler/pragma_c_gen.m:
compiler/proc_requests.m:
compiler/prog_rep.m:
compiler/push_goals_together.m:
compiler/rbmm.region_transformation.m:
compiler/saved_vars.m:
compiler/simplify_goal_switch.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/ssdebug.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/stratify.m:
compiler/structure_reuse.versions.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_build.m:
compiler/term_pass2.m:
compiler/term_util.m:
compiler/tupling.m:
compiler/unify_gen_construct.m:
compiler/unify_gen_util.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
Conform to the changes above by importing the required new modules,
sometimes in addition to inst_util.m or mode_util.m, but more usually
instead of them.
|
||
|
|
a818e42cb9 |
Put bigger/slower-varying inputs before others.
compiler/inst_match.m:
compiler/inst_test.m:
As above.
compiler/common.m:
compiler/constraint.m:
compiler/goal_mode.m:
compiler/hlds_pred.m:
compiler/inst_util.m:
compiler/instmap.m:
compiler/mode_comparison.m:
compiler/mode_errors.m:
compiler/mode_util.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/pd_info.m:
compiler/simplify_goal_disj.m:
compiler/unique_modes.m:
compiler/unused_args.m:
Conform to the changes above.
|
||
|
|
bd594dded2 |
Impose logical order on mode_info.m and mode_util.m.
compiler/mode_info.m:
compiler/mode_util.m:
Put the predicates in these modules into logical groups, and ensure
that the orders of the declarations and definitions match.
Delete the unused predicate mode_info_set_how_to_check from mode_info.m.
Delete the unused predicates select_output_vars, select_output_things,
and partition_args from mode_util.m.
Rename the unify_modes_to_X predicates to unify_mode_to_X, since each
of these predicates operates on only *one* unify_mode.
Move three predicates that are needed only during mode checking,
and not during later compuiler passes, to modecheck_util.m.
compiler/modecheck_util.m:
Add the predicates moved from mode_util.m.
compiler/Mercury.options:
Require the order of predicates' definitions to match the order of
their declarations in mode_info.m and mode_util.m.
compiler/common.m:
compiler/loop_inv.m:
compiler/modecheck_goal.m:
Conform to the changes in mode_util.m.
|
||
|
|
c3f39870a1 |
Clean up the representation of mode errors.
compiler/mode_errors.m:
Give the function symbols representing the various kinds of mode errors
more meaningful names. (Some fix misleading implications, such as when
a function symbol name includes "pred", but the error applies to functions
as well.) Do the same for other function symbols in this module.
Where arguments are lists that should never be empty, change their type
to one_or_more to encode this invariant.
In one case (var_multimode_pred_error), the same data items were packaged
in two different ways in two different places. Remove this unnecessary
difference.
In some cases, put arguments in a more logical order.
Improve the comments on most of these function symbols, fixing errors,
fixing omissions, documenting arguments. Add XXXs where warranted.
Put the types used in the various kinds of mode errors below the
mode_error type itself. Put them into meaningful groups.
The current order of the mode_error function symbols is totally
haphazard. Propose a new order for them, but do not implement it yet,
in order to make this diff easier to review.
Make the representation of the error that says "calling an implied mode
for this predicate or function is not implemented" say *why* it is
not implemented. Include this info in the error message we generate.
This error message is not exercised by any existing test case, which is
why there are no changes to test cases in this diff.
Improve the explanation for why you cannot unify two functions or
two predicates. Since this explanation occurs only in verbose output,
no test case is affected by this change either.
Improve variable names.
compiler/mode_info.m:
Conform to the changes in mode_errors.m.
If --debug-modes is specified, print each error message as it is added
to the mode_info. This helped me track down a bug in this change.
compiler/instmap.m:
compiler/modecheck_call.m:
compiler/modecheck_conj.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
Conform to the changes in mode_errors.m and/or mode_info.m.
Add XXXs in some places. One marks one possible cause of Mantis bug #529.
|
||
|
|
913468c9d0 | Fix comments. | ||
|
|
3a1ed2efcb |
Replace simple_call_id with pf_sym_name_arity.
compiler/prog_data.m:
Delete the simple_call_id data type, since it is isomorphic
to the pf_sym_name_arity type, which more clearly specifies
what is stored inside it.
compiler/prog_out.m:
Rename (all three versions of) simple_call_id_to_string to
pf_sym_name_orig_arity_to_string, both to conform to the change
in the input data type, and to emphasize that the resulting string
will contain the *original* arity of functions (which does not include
the return value), which is one less than the arity in the
pf_sym_name_arity structure (which, in accordance with the
convention inside the compiler that the arity is the length
of the argument list, *does* include the return value).
Delete the provision inside simple_call_id_to_string, now
pf_sym_name_orig_arity_to_string, for special handling of the names
of the predicates we use to implement promises, because it seems that
*none* of the call sites to any of the three versions of this function
can actually pass to it the identity of such a predicate. These calls
refer to a predicate or mode declaration item (which promise predicates
do not have), to clause or foreign_proc items (which again, promise
predicates cannot have) or calls to the predicate (promise predicates
cannot be called).
Delete the exported predicate simple_call_id_to_sym_name_arity.
It was called from exactly one place, inside prog_out.m itself,
and this diff inlines that call.
Avoid unnecessary forwarding of work from prog_out.m to error_util.m.
Delete (all three versions of) write_simple_call_id. The changes
below replace all their (few) uses with calls to
pf_sym_name_orig_arity_to_string.
compiler/error_util.m:
Replace the simple_call() error piece with qual_pf_sym_name_orig_arity,
and add a new version unqual_pf_sym_name_orig_arity. Their names
explicitly say that they print the original arities of functions,
also say whether they strip away any module qualification on the
sym_name inside the pf_sym_name_arity. We prefer the unqual version
in situations where the module qualifier is implicit, which usually means
that it must be the same as the name of the module being compiled, because
it reduces visual clutter for readers of error messages.
Put {qual,unqual}_pf_sym_name_orig_arity next to their most closely
related function symbols, {qual,unqual}_sym_name_arity, in the
format_component type. (This yields a few inconsequential changes
in the order of error_specs when sorted.)
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_typeclass.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/goal_expr_to_goal.m:
compiler/hlds_data.m:
compiler/hlds_desc.m:
compiler/hlds_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/inst_util.m:
compiler/llds_out_instr.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_error.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/ml_unify_gen_construct.m:
compiler/mlds_to_c_stmt.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/modecheck_util.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_item.m:
compiler/parse_module.m:
compiler/parse_type_repn.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/pre_quantification.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/recompilation.version.m:
compiler/term_constr_build.m:
compiler/termination.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unused_imports.m:
Conform to the changes above. Where I am pretty sure that in an error
message, the module qualifier of a name must be the current module,
use unqual_pf_sym_name_orig_arity instead of qual_pf_sym_name_orig_arity.
Add some sanity checks where they seem appropriate.
Replace sequences of io.write_strings with uses of io.format where this
yields clearer code. (This is why there were no remaining calls to
write_simple_call_id.)
Shorten some too-long lines.
In add_pred.m, make the order of some predicate definitions match
the order of the calls to them.
tests/invalid/ambiguous_method.err_exp:
tests/invalid/ambiguous_method_2.err_exp:
tests/invalid/bad_pred_arity.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bigtest.err_exp:
tests/invalid/bug113.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug410.err_exp:
tests/invalid/bug476.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/complex_constraint_err.err_exp:
tests/invalid/constrained_poly_insts.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/exported_mode.err_exp:
tests/invalid/field_syntax_error.err_exp:
tests/invalid/foreign_singleton.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/imported_mode.err_exp:
tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/make_opt_error.err_exp:
tests/invalid/missing_det_decls.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/ref_to_implicit_pred.err_exp:
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.err_exp2:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.err_exp2:
tests/invalid/require_tailrec_3.err_exp:
tests/invalid/require_tailrec_3.err_exp2:
tests/invalid/state_vars_test2.err_exp:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_constraint_extra_var.err_exp:
tests/invalid/typeclass_mode_2.err_exp:
tests/invalid/typeclass_test_12.err_exp:
tests/invalid/typeclass_test_2.err_exp:
tests/invalid/typeclass_test_9.err_exp:
tests/invalid/types.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/unbound_type_vars.err_exp:
tests/invalid/with_type.err_exp:
tests/invalid_purity/purity_nonsense.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
tests/warnings/double_underscore.exp:
tests/warnings/pragma_source_file.exp:
tests/warnings/singleton_test.exp:
tests/warnings/singleton_test.exp2:
tests/warnings/singleton_test.exp3:
tests/warnings/singleton_test.exp4:
tests/warnings/singleton_test_state_var.exp:
tests/warnings/warn_return.exp:
tests/warnings/warn_return.exp2:
tests/warnings/warn_return.exp3:
tests/warnings/warn_succ_ind.exp:
tests/warnings/warn_succ_ind.exp2:
tests/warnings/warn_succ_ind.exp3:
tests/warnings/warn_succ_ind.exp4:
Update all these expected output files. Most changes are due to
predicate and function names no longer being module qualified when
the module qualification is obvious. A few changes are due to the
change in the relative ordering of the function symbols of the
format_component type.
For singleton_test, warn_return and warn_succ_ind in warnings,
the changes to the non-C .exp files were done by hand, so they
may have the wrong white space.
|
||
|
|
b831562958 |
Improve error messages for some mode errors.
compiler/mode_errors.m:
There are two improvements.
The first and much the more important is that when a call does not match
any of the declared modes of the called predicate or function, we now
print the names and insts of any arguments whose insts, by themselves,
do not match any of the callee's modes. Instead of reporting "here are
all the arguments, here are all their insts, find out for yourself
which one is wrong", the compiler now tells the programmer explicitly
which one is wrong in almost all cases. (Not all. If e.g. two args <A, B>
have insts <free, free>, but the callee has two modes, <in, out> and
<out, in>, then the compiler won't report either arg, since neither arg
is wrong by itself.)
The second improvement is that when the verbosity settings ask us
to print all possible reasons why we can't schedule a conjunction,
instead of our default approach of printing the only the first,
we now put a blank line between the different reasons, for visual
separation.
compiler/modecheck_call.m:
Preserve the extra information now needed by mode_errors.m.
compiler/modecheck_util.m:
Conform to the changes above.
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/try_detism.err_exp:
Expect the updated error messages for these tests.
|
||
|
|
5722645ce5 |
Separate out type_info args and return values in mode error msgs.
compiler/mode_errors.m:
When printing an error message that says "these args have these modes,
which do not match any declared mode of the callee", avoid confusing
users by not mentioning the extra type_info/typeclass_info args added by
polymorphism, except in the very rare case that they could be the *cause*
of the mode error.
When the callee is a function, list its return value separately from
the other arguments, again in an effort to reduce possible confusion.
compiler/mode_info.m:
To make the above possible, record the actual pred_id of the callee
for plain calls. This should actually be faster than the old code
it replaces, because it avoids the computation of the call_id from
the pred_id for all calls that do not result in error messages.
Fix a misleading predicate name.
compiler/modecheck_goal.m:
compiler/modecheck_util.m:
compiler/unique_modes.m:
Conform to the changes in mode_info.m.
compiler/hlds_pred.m:
Fix a misleading predicate name.
compiler/polymorphism.m:
compiler/pred_table.m:
Conform to the changes in hlds_pred.m.
compiler/add_pred.m:
compiler/add_special_pred.m:
compiler/higher_order.m:
Use variable names that specify which kind of arity they talk about:
the one that counts functions' return values, or the one that doesn't.
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/state_vars_test1.err_exp:
tests/invalid/try_detism.err_exp:
Update these expected output files to account for the change to
mode_errors.m above.
tests/invalid/any_passed_as_ground.err_exp2:
The old any_passed_as_ground.err_exp could not be matched for a long time
now. The new any_passed_as_ground.err_exp actually updates the old
any_passed_as_ground.err_exp2, since we can't have a .err_exp2 file
without a .err_exp file. Since we now need only one expected output file,
delete the .err_exp2 file.
tests/invalid/ho_default_func_1.err_exp2:
tests/invalid/ho_default_func_3.err_exp2:
Delete these files, since they could not be matched for a long time now.
tests/invalid/try_detism.err_exp2:
The same deal as with the any_passed_as_ground test case.
|
||
|
|
15aa457e12 | Delete $module arg from calls to unexpected. | ||
|
|
fca7b99c96 |
Carve mode_comparison.m out of modecheck_call.m.
modecheck_call.m had three different predicates for comparing the
different modes of a predicate in different ways. Mode checking calls,
the job of modecheck_call.m, needs only one of these three predicates.
The other two were there only because, due to the commonalities between
the three comparison predicates, it is easier to maintain them
if they are all in the same place.
Moving the comparison predicates to their own module improves
the cohesion of the both the old module and the new.
compiler/mode_comparison.m:
Move the predicates dealing with comparing the different modes of a
predicate here from modecheck_call.m. Make the comment describing
one of the moved predicates easier to read.
compiler/modecheck_call.m:
Delete the moved code.
compiler/modecheck_util.m:
Add a simple utility predicate needed both by the code moved out of
modecheck_call.m and the code that stays there.
compiler/check_hlds.m:
compiler/notes/compiler_design.html:
Mention the new module.
In check_hlds.m, add some more structure.
In compiler_design.html, delete a stray line.
compiler/det_analysis.m:
compiler/post_typecheck.m:
Import mode_comparison.m instead modecheck_call.m to get access
to predicates that compare the different modes of a predicate.
|
||
|
|
116ffd49c7 | Match the order of predicate definitions to declarations. | ||
|
|
72fdbec2fd |
Improve diagnostics for currying multi-mode predicates.
The improvements take two forms.
The first is that when the mode checker tries to schedule a unification
of the form X = curried_pred(A1, ... An), but fails, perhaps because
curried_pred has more than one declared mode matching the current insts
of the Ai, we record this fact in the mode_info. Then, if later we find
that X is insufficiently instantiated, we print the message we originally
generated for the X = curried_pred(A1, ... An) unification (but which we
threw away when the scheduling attempt failed) as a possible explanation
of this insufficient instantiation.
The second is that when scheduling X = curried_pred(A1, ... An) but fails,
we record more information about the reason, to print it later in the hope that
it may help the user diagnose the problem.
compiler/mode_errors.m:
Change the representation of the errors resulting for not being able
to schedule rhs_lambda unifications of the form X = curried_pred(Ai).
Merge the previous two separate errors into one, and add a parameter
that that distinguishes the three (not two) possible different causes
of the error. Print better diagnostics for all three, based on a common
template.
Change the representation of the errors that say a variable is not
sufficiently instantiated, to make it possible (but of course not
compulsory) to record what error of the X = curried_pred(Ai) kind
may be responsible for it. Include the error message for this cause
in the error message about the insufficiently instantiated variable.
compiler/mode_info.m:
Add a field to the mode_info that allows a failed attempt to schedule
X = curried_pred(Ai) to record the error it generates as a possible
cause of the later insufficient instantiation of X.
compiler/modecheck_unify.m:
Gather the extra information now needed by the representation of mode
errors for failed attempts to schedule X = curried_pred(Ai).
Record the errors for such attempts in the new mode_info field.
compiler/modecheck_util.m:
When generating "variable is not sufficiently instantiated" errors,
see if the new mode_info field say that the insufficiently instantiated
variable was, in a previous conjunct, involved in a failed
X = curried_pred(Ai) unification, and if yes, record this fact
as a possible cause of the error.
compiler/modecheck_goal.m:
Reset the new field at the start of every branched control structure,
to prevent us from using information about X = curried_pred(Ai)
unifications in one branch in other, parallel branches.
Avoid allocating a context at every goal.
library/term.m:
Add a utility predicate to enable that avoidance.
NEWS:
Mention the new utility predicate.
Fix some no-longer-valid entries.
compiler/modecheck_call.m:
Make some code need less stack space.
Fix some comments.
compiler/modecheck_conj.m:
Clarify some code.
tests/invalid/uint_bitwise_xor_mode.{m,err_exp}:
A new test case for both improvements. It is a version of
tests/hard_coded/uint_bitwise.m cut down to contain just the bug
that previously we generate only a misleading error message for.
tests/invalid/Mmakefile:
Enable the new test.
tests/invalid/multimode_addr_problems.err_exp:
Update this expected output to account for the second improvement.
|
||
|
|
73ef502981 | Delete unneeded imports. | ||
|
|
c6ab550db8 |
Remove the code for automatic initialization of solver vars.
We haven't supported it in years, and keeping it in the compiler
is just a maintenance burden and a performance problem.
mdbcomp/prim_data.m:
Delete the spec_pred_init functor, since we don't support special
"init" predicates anymore.
compiler/prog_data.m:
Delete the slot in solver type details that record the name of the
auto-initialization predicate.
compiler/prog_io_type_defn.m:
Don't allow a type definition to specify an auto-initialization predicate.
compiler/options.m:
compiler/globals.m:
Delete the option that allowed support for auto-initialization to be
turned back on.
compiler/inst_match.m:
compiler/inst_util.m:
Delete comments about auto-initialization.
compiler/mode_info.m:
Delete the record of whether we have variables that can be
auto-initialized (we never do anymore) and the flag that controls whether
auto-initialization is permitted or not.
compiler/modecheck_conj.m:
Simplify the code that modechecks conjunctions, since it no longer
has to figure out where to insert auto-initializations of solver vars.
compiler/modecheck_goal.m:
Delete the code that ensured that if one branch of a branched
control structure auto-initialized a solver variable, then they
all did.
compiler/modecheck_unify.m:
Don't auto-initializate variables before unifications.
compiler/modecheck_util.m:
Delete the code that auto-initialized solver variables at the ends
of procedure bodies if this needed to be done and wasn't done before.
compiler/add_special_pred.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/modecheck_call.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/post_term_analysis.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/term_constr_errors.m:
compiler/term_constr_initial.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_util.m:
compiler/unify_proc.m:
Delete code that handled stuff related to auto-initialization,
and now always take the path that would normally be taken in the
absence of auto-initialization.
deep_profiler/read_profile.m:
runtime/mercury_layout_util.c:
runtime/mercury_stack_trace.c:
util/mdemangle.c:
Remove code that recognized the compiler-generated name of initialization
predicates.
tests/debugger/solver_test.m:
tests/hard_coded/solver_construction_init_test.m:
tests/hard_coded/solver_disj_inits.m:
tests/hard_coded/solver_ite_inits.m:
tests/invalid/missing_init_pred.m:
tests/invalid/zinc2mer_lib.m:
tests/valid/fz_conf.m:
tests/valid/solver_type_bug_2.m:
tests/valid/solver_type_mutable_bug.m:
These tests tested the handling of auto-initialization, which we
no longer support. Keep them around (and a bit more visible than
inside the git repo) in case we need them again, but add a comment
to each saying that the test is disabled.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Disable those tests.
tests/warnings/non_term_user_special.{m,exp}:
Part of this test tested the handling of auto-initialization;
delete that part.
tests/warnings/Mercury.options:
Delete the flag required by the deleted part, since we don't support it
anymore.
|
||
|
|
b2ae55c29c |
Change 'none' to 'none_or_default_func' in ho_inst_info.
This value of ho_inst_info is used for first-order values as well as for functions that have the default inst, and the new name better reflects that. Places using this value have been checked for correctness. Issues that need to be looked at have been marked with XXX, although have not been addressed in this change. compiler/prog_data.m: Update the type. compiler/inst_match.m: Add XXX comments. This module needs to check for non-default function insts in a bunch of places. compiler/inst_util.m: Add XXX comments. We lose information about non-default function insts when merging bound and any. The information needs to be either preserved or disallowed entirely. compiler/float_regs.m: Add XXX comments. This module may miss cases involving default function insts. compiler/modecheck_unify.m: Add XXX comment. We should exclude pred and non-default func lambda non-locals from becoming locked, an addition to default functions. compiler/*.m: No special handling is required for other modules. |
||
|
|
7f5a08eb37 |
Split parts of inst_match.m into a new module, inst_test.m
Most modules that imported inst_match did so in order to use
predicates such as inst_is_ground to test properties of insts.
These predicates are split into a new module, leaving the more
complex parts of inst_match to be imported in fewer places.
This makes it easier to change inst_match (for example, to
address mantis bug 264) without unintentional changes to
the rest of the compiler.
compiler/inst_test.m:
New module containing code from inst_match.m.
compiler/check_hlds.m:
Include the new module.
compiler/inst_match.m:
Move code to the new module.
compiler/inst_util.m:
Move inst_expand and inst_expand_and_remove_constrained_inst_vars
here rather than the new module, since they make more sense here.
compiler/build_mode_constraints.m:
compiler/cse_detection.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_report.m:
compiler/fact_table.m:
compiler/float_regs.m:
compiler/goal_util.m:
compiler/interval.m:
compiler/loop_inv.m:
compiler/modecheck_goal.m:
compiler/pd_util.m:
compiler/prog_rep.m:
compiler/simplify_goal_call.m:
compiler/size_prof.m:
compiler/stm_expand.m:
compiler/structure_sharing.domain.m:
compiler/switch_detection.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/unify_proc.m:
compiler/unneeded_code.m:
Only import inst_test.
compiler/common.m:
compiler/instmap.m:
compiler/mode_util.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/simplify_goal_disj.m:
Import inst_test in addition to inst_match.
compiler/lco.m:
compiler/simplify_goal_switch.m:
Import inst_test and inst_util, but not inst_match.
|
||
|
|
2f1ec6b91c |
Don't abort if a curried predicate has no declared determinism.
compiler/polymorphism.m:
When it sees a curried predicate call, polymorphism converts it to an
explicit lambda expression in order to add the unifications that
construct the type_infos and/or typeclass_infos the call needs.
For this, it needs to know the call's determinism. If the predicate had
no declared determinism, we used to abort the compiler, which is
too drastic a response to a simple programmer error.
Change this so that in this situation, we simply report an error,
and record that it is not safe to continue the compilation process.
In reality, it is not safe to continue the compilation only of the
predicate that the lambda expression occurs in, but in the vast, vast
majority of cases, this should be more than good enough.
I did try to code this change so that we continued the compilation
of other predicates when this error occurs, but it turned out to be
a bit too complicated for the very small potential benefit. Nevertheless,
some of the changes below are the results of this attempt; I kept them
because they are useful in their own right.
Change the code for traversing the procedures of a predicate
to be more direct.
Put the access predicates in the poly_info type in the same order
as the fields they operate on.
compiler/error_util.m:
Allow recording that an error is discovered during the polymorphism pass.
compiler/mercury_compile_front_end.m:
If polymorphism finds errors, print their messages, and then stop;
don't continue to the later passes.
compiler/maybe_error.m:
New module, containing the maybeN types (taken from prog_io_utio.m)
and the safe_to_continue type (taken from modes.m). These are now
needed by polymorphism.m as well.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Mention the new module.
compiler/options.m:
doc/user_guide.texi:
Delete the (undocumented, developer-only) --no-polymorphism option,
since its use cannot lead to anything other than a compiler abort,
and this won't change in the future.
compiler/hlds_pred.m:
Rename the "marker" type to "pred_marker", to clarify its purpose.
Rename the "attribute" type to "pred_attribute", for the same reason.
Make the pred_markers and attributes types true sets, not lists
masquerading as sets.
Add a predicate to add more than one marker at a time to a set of markers.
Delete an unused predicate.
Rename the functors of the can_process type to clarify its purpose.
(I tried to use it to record the presence of errors discovered by
polymorphism.m, and this did not work; these renames should spare
others a similar experience.)
Make the code that construct pred_infos build its components from first
field to last field, not in random order.
compiler/det_analysis.m:
Specialize an exported predicate to its actual uses.
compiler/hlds_out_pred.m:
Dump the cannot_process_yet flag for procedures that have them.
compiler/add_pragma.m:
compiler/add_pred.m:
compiler/complexity.m:
compiler/deforest.m:
compiler/equiv_type_hlds.m:
compiler/field_access.m:
compiler/goal_expr_to_goal.m:
compiler/higher_order.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/lambda.m:
compiler/ml_accurate_gc.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/prog_io.m:
compiler/prog_io_dcg.m:
compiler/prog_io_goal.m:
compiler/prog_io_item.m:
compiler/prog_io_mode_defn.m:
compiler/prog_io_mutable.m:
compiler/prog_io_pragma.m:
compiler/prog_io_sym_name.m:
compiler/prog_io_type_defn.m:
compiler/prog_io_typeclass.m:
compiler/prog_io_util.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/simplify_goal_unify.m:
compiler/ssdebug.m:
compiler/stm_expand.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/try_expand.m:
compiler/unify_proc.m:
Conform to the changes above.
tests/invalid/higher_order_no_detism.{m,err_exp}:
A new test case to test that the compiler does not abort, but generates
an error message when it sees a curried predicate call to a predicate with
no declared determinism.
tests/invalid/Mmakefile:
Enable the new test case.
|
||
|
|
b8af07b583 | Convert (C->T;E) to (if C then T else E). | ||
|
|
62ec97d443 |
Report imports shadowed by other imports.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
|
||
|
|
04dec8c205 |
Carve vartypes.m, prog_detism.m and prog_rename.m out of prog_data.m.
Besides defining most of the types representing the smaller parts of
parse trees (parts smaller than items), prog_data.m also has many utility
predicates that operate on values of these types. Carve the three substantial
clusters of predicates out of prog_data.m, and move them into their own
modules, which are each imported by fewer modules than prog_data.m itself.
compiler/vartypes.m:
New module containing the vartypes type and the predicates that operate
on it. The new module has *much* better cohesion than the old prog_data.m.
The vartypes type does not appear in any parse tree; it is used only
in the HLDS. So make vartypes.m part of the hlds.m package, not
parse_tree.m.
Move three predicates that perform renamings and substitutions on vartypes
here from prog_type_subst.m, since the latter is part of the parse_tree.m
package, and thus doesn't have access to hlds.vartypes. Make private
the service predicate that these three moved predicates used to rely on,
since it has no other callers.
compiler/prog_detism.m:
New module containing utility predicates that operate on determinisms
and determinism components.
compiler/prog_rename.m:
New module containing utility predicates that rename variables in
various data structures.
compiler/prog_data.m:
Remove the stuff now in the three new modules.
compiler/prog_type_subst.m:
Remove the three predicates now in vartypes.m.
compiler/mercury_to_mercury.m:
Delete an unneded predicate, which was the only part of this module
that referred to vartypes.
compiler/prog_type.m:
compiler/builtin_lib_types.m:
compiler/type_util.m:
Move some utility predicates that refer to vartypes from prog_type.m
and builtin_lib_types.m (both part of parse_tree.m) to type_util.m
(part of check_hlds.m).
compiler/parse_tree.m:
compiler/hlds.m:
compiler/notes/compiler_design.html:
Mention the new modules.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_heap_ops.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/arg_info.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/clause_to_proc.m:
compiler/closure_analysis.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/common.m:
compiler/complexity.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/continuation_info.m:
compiler/coverage_profiling.m:
compiler/cse_detection.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/disj_gen.m:
compiler/equiv_type_hlds.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/erl_code_util.m:
compiler/exception_analysis.m:
compiler/float_regs.m:
compiler/follow_code.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/goal_path.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/headvar_names.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_clauses.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_pred.m:
compiler/hlds_rtti.m:
compiler/inlining.m:
compiler/inst_util.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/interval.m:
compiler/lambda.m:
compiler/lco.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/lookup_switch.m:
compiler/make_goal.m:
compiler/mark_tail_calls.m:
compiler/ml_accurate_gc.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_disj_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_unify_gen.m:
compiler/mode_constraints.m:
compiler/mode_info.m:
compiler/mode_util.m:
compiler/modecheck_call.m:
compiler/modecheck_conj.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/par_loop_control.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/quantification.m:
compiler/rbmm.points_to_graph.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_liveness_info.m:
compiler/rbmm.region_transformation.m:
compiler/saved_vars.m:
compiler/set_of_var.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_goal_scope.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/ssdebug.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/switch_detection.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_initial.m:
compiler/term_constr_util.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/try_expand.m:
compiler/tupling.m:
compiler/type_assign.m:
compiler/type_constraints.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/var_locn.m:
Conform to the above changes, mostly by importing some of the
three new modules as well as, or instead of, prog_data.m.
|
||
|
|
89628ae791 |
More speedups of inst handling code.
On tools/speedtest -l -m, my tests show a speedup of about 2%, but
on Dirk's stress test module, for which the compiler (used to) spend
almost all its time handling insts, the speedup is about 40%.
This diff also contains some small incidental changes I stumbled upon
the "need" for while working on the main change.
compiler/prog_data.m:
The existing inst_test_results type used to be able to hold the results
of four tests about a bound inst. Add two more: the set of inst vars that
may occur in the inst, and whether a type constructor has already been
propagated into the cons_ids of the bound insts.
Put the fields of the the unify_inst and merge_inst inst_names into
a more sensible order.
Define types that hold the information stored in specific kinds of
inst_names, for use by hlds_data.m (see below).
compiler/inst_user.m:
For each user defined bound inst that matches exactly one parameterless
type, propagate its type constructor into it, and record the fact that
it has been done. This avoids having to do it many times later.
Also record the set of inst vars in each inst, again to avoid having
to repeat the test many times later.
compiler/mercury_compile_front_end.m:
Invoke the inst_user module as soon after inst_check.m as we can.
compiler/hlds_data.m:
Make the structure of six subtables of the inst table private, to allow
them to be experimented with (and possibly changed) without code changes
being required in other modules.
The unify_inst_table, the ground_inst_table and the any_inst_table
used to be maps whose keys were inst_names, but they were each only ever
used with one kind of inst_name. Change their keys to the new types
unify_inst_info, ground_inst_info and any_inst_info, which each contain
the information in the unify_inst, ground_inst and any_inst inst_names
respectively. That way, the searches in the maps will perform comparisons
that don't need to switch on what kind of inst_name they are dealing with,
and instead go directly to comparing the arguments.
With the unify_inst_table, also go a step further. The unify_inst_info
has two fields that are equivalent to booleans. Comparing these
at every level of the map is wasteful, so switch the representation
of the unify_inst_table from one map to four maps, one map for each
possible combination of those booleans. This way, the two booleans
in the unify_inst_info key are tested just once, when the applicable map
is selected.
The merge_inst_table used to have a pair of insts as keys. Replace that
with the merge_inst_info type, which also holds a pair of insts,
but on which comparisons should be a bit faster, since it is not
polymorphic, and thus does not need an implicit typeinfo passed along.
Provide a combined search_insert operation on each of the inst_tables,
since their pattern of use is exactly that: search the table, and if
the key is not found, insert a marker that says the entry is being
worked on. This avoid one traversal of a possibly-large tree, with
its associated (possibly very expensive) comparisons.
For each inst table, provide conversion predicates to and from
sorted association lists, for use by equiv_type_hlds.m
compiler/equiv_type_hlds.m:
Expand equivalence types in the new structure of the inst tables.
compiler/inst_util.m:
Use the new search_insert predicates for the various inst_tables.
If one of the two insts being unified is free, then avoid using
the unify_inst_table, since just doing the abstract unification
is faster, and does not pollute the unify_inst_table.
If both insts being merged are bound insts, then avoid using the
merge_inst_table, since (a) the lookup is slower than just doing
the merge, and (b) it can pollute the merge_inst_table to the extent
that *all other lookups* in it become very slow.
compiler/inst_match.m:
Use test result information in bound insts to speed up the corresponding
tests.
compiler/set_of_var.m:
Change the representation of sets of vars back to sparse_bitsets.
I changed them to tree_bitsets several years ago to avoid some bad
worst-case behavior with sparse_bitsets (which occurred when repeatedly
appending to the "ends" of sets), but other algorithmic changes have
since avoiding using set_of_vars in ways that induce that behavior,
and now my benchmarking tells me that the bottleneck operation is
conversion of set_of_vars to lists of vars. This is faster with
sparse_bitsets, since unlike tree_bitsets, they don't have to unravel
a tree structure.
compiler/mode_util.m:
Export a predicate now needed by inst_user.m, and clean up the code a bit,
factoring out repeated code.
compiler/modecheck_util.m:
Modify an equality comparison of two insts to compare the instantiation
states themselves, but NOT the test results about those instantiation
states, since these can differ if the two insts have different histories.
compiler/hlds_code_util.m:
compiler/hlds_out_mode.m:
compiler/hlds_out_module.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/polymorphism.m:
compiler/prog_mode.m:
compiler/recompilation.usage.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
The following changes are mostly incidental.
compiler/hlds_args.m:
Speed up a predicate by avoiding the materialization of a list
that is needed only for a test.
compiler/instmap.m:
Clarify some code.
compiler/liveness.m:
Avoid computing some value when it is not needed.
compiler/mode_errors.m:
Avoid referring to "arguments" (plural) for errors involving *one*
argument.
compiler/mode_info.m:
Move the documentation of some predicates to their declarations.
compiler/modecheck_unify.m:
Compute some data closer to where it is needed, to reduce the number
of stack slots needed.
tests/invalid/constrained_poly_insts2.err_exp:
Expect the updated error message from mode_errors.m (with "argument"
in singular), as well as module qualified insts, since having inst_user.m
push type_ctors into the definitions of named inst module qualifies
the bound_insts inside those definitions.
|
||
|
|
85da715041 |
Generate a specific warning for X = f(X).
This warning is for when X is ground. When X is free (or otherwise nonground),
such unifications have always gotten an error.
compiler/mode_errors.m:
Add a warning type for occur check violations with ground vars.
Fix the grammar in the other two warnings generated by mode analysis.
compiler/modecheck_unify.m:
Generate the new warning when appropriate.
To make this possible, rewrite a previously 280-line predicate
that was hard to understand because of its structure as well as its
length into a smaller, better structured predicate less than half the size
(a) by moving coherent pieces of it out into other predicates,
some of which are now called more than once, thus reducing code
duplication, and (b) by avoiding redundant work, to wit, optimizing
the form of a unification when we have already decided that it has
a mode error, and thus cannot be scheduled now.
compiler/prog_mode.m:
Add a det version of an existing predicate.
compiler/inst_util.m:
Remove a comment on a predicate implementation that duplicates the
comment on the predicate's declaration.
compiler/modecheck_util.m:
Minor fixes of comments.
compiler/superhomogeneous.m:
Fix some bit rot: update the name of a predicate to match
the name of the data it works on, which was changed a few
years ago.
tests/invalid/occurs.err_exp:
tests/invalid/qualified_cons_id2.err_exp:
tests/warning/simple_code.exp:
tests/warning/unify_f_g.exp:
Conform to the error message format we generate after the change
to mode_errors.m.
tests/warning/unify_x_f_x.{m,exp}:
A new test case to test the new functionality.
tests/warning/Mmakefile:
Enable the new test case.
|