compiler/parse_tree_out_cons_id.m:
Move the predicates and functions in prog_out.m that deal with cons_ids
to this module.
compiler/parse_tree_out_sym_name.m:
Move the predicates and functions in prog_out.m that deal with sym_names
and similar entities to this module.
compiler/parse_tree_out_type.m:
Move the predicates and functions in prog_out.m that deal with types
to this module.
compiler/parse_tree_out_misc.m:
Move the predicates and functions in prog_out.m that deal with simple
types to this module.
Delete mercury_output_det and mercury_format_det, replacing all their
uses with calls to mercury_det_to_string.
compiler/prog_out.m:
Delete this module.
compiler/parse_tree.m:
Delete prog_out from the parse_tree package.
compiler/Mercury.options:
compiler/notes/compiler_design.html:
Delete references to prog_out.m.
compiler/*.m:
Update imports and any explicit module qualifications to account
for the moved code.
tools/filter_sort_imports:
Automatically filter out any repeated imports. This can help with
changes like this that redistribute the contents of one module to other
modules. In this case, after a global replacement of prog_out's import
with the import of parse_tree_out_misc, this updated script could
remove this changed import from modules that already imported
parse_tree_out_misc.
compiler/hlds_clauses.m:
The clauses_info type used to have two fields whose type is "vartypes".
One contained type information we knew before typechecking, e.g. from
explicit "Var : type" annotations, while the other contained the
*results* of typechecking. Keep the former, but replace the latter
with a var_table.
Allow compiler passes that construct clauses to fill in the first field
with the types of the head variables, because for the clauses of some
kinds of predicates (such as predicates implementing builtins) that are
"constructed correct" and do not need typechecking, this is all we need.
Put the fields of clauses_info that deal with variables and their types
next to each other, in the order in which they are filled in.
compiler/add_clause.m:
Don't construct the context pieces needed for parsing mode annotations
on arguments in the clause head unless the clause head's arguments
*have* mode annotations, which they virtually never do.
compiler/add_pred.m:
compiler/add_special_pred.m:
Put the types of the head variables into the var_table in the clauses_info
we create for clauses for builtin predicates and unify/compare/index
predicates respectively, for use by unused_imports.m.
compiler/typecheck.m:
Fill in the var_table field in
- predicates we have typechecked,
- predicates for which we have created stub clauses that are
"born type-correct", and
- predicates for class methods whose code will be created later,
during the polymorphism pass.
In the last case, we fill in only the types of the head variables,
preserving old behavior.
Give some predicates more meaningful names. Inline a predicate at its
only call site.
compiler/post_typecheck.m:
Switch to using the var_tables computed by typechecking.
Reset varsets in clauses_infos to empty, to tell hlds_out_pred.m
not use it as the source of variable name info.
compiler/hlds_pred.m:
Provide functionality to record the types of head variables
in both vartypes and in var_tables.
compiler/hlds_out_pred.m:
Get information about variable names from either the clauses_info's
varset field (if the varset is nonempty, not yet having been reset
by post_typecheck.m), or from its var_table field (if the varset
*has* been reset to empty).
Likewise, get information about variable types from either the
clauses_info's var_table field (if it is not empty, having been filled in
either by typechecking or by code created the type clauses "type-correct"
at the start), or from its explicit_vartypes field (if the var_table field
has not yet been filled in).
It is possible that in the future, we may want to dump out the
contents of the explicit_vartypes field even if the var_table
has also been filled in. However, since the old code of write_pred
had no such functionality, the chance we will need that in the future
is small, and we can deal with it when the issue does arise.
compiler/goal_path.m:
compiler/hlds_out_goal.m:
compiler/intermod.m:
compiler/unify_proc.m:
Convert these modules to use var_tables.
compiler/prog_type.m:
compiler/type_util.m:
Record the fact that the builtin type "store_at_ref_type" is not a dummy
type. Without this special-casing, the creation of a var_table containing
a variable of this type would crash the compiler, because
- unlike other builtin types, this one *has* a definition, in
private_builtin.m, but
- since it is a builtin type, its "definition" in the type table
has no representation information, so the code of is_type_a_dummy
cannot tell if that "definition" is a dummy or not.
compiler/prog_util.m:
Provide the var_table equivalent of an existing utility predicate
for varsets.
compiler/qual_info.m:
Give a field of the qual_info type a more meaningful name.
compiler/typecheck_errors.m:
Fix argument order and variable names.
compiler/vartypes.m:
compiler/var_table.m:
Add a predicate to check whether a variable has a user-given name.
Replace the varset_vartypes type in vartypes.m with the type_qual type
in var_table.m, which uses var_tables, since its user, hlds_out_goal.m,
has been converted to use var_tables. (Most variables of this type
have been named TypeQual, which is why the type now has that name.)
compiler/inst_graph.m:
Conform to the changes above.
Export the definition of the inst_graph_info type, instead of exporting
a getter and a setter for every one of its fields.
compiler/higher_order.m:
Conform to the changes above, by calling clauses_info_init,
instead of repeating its code here.
compiler/accumulator.m:
compiler/add_foreign_proc.m:
compiler/add_pragma_type_spec.m:
compiler/build_mode_constraints.m:
compiler/check_promise.m:
compiler/clause_to_proc.m:
compiler/format_call.m:
compiler/hhf.m:
compiler/instance_method_clauses.m:
compiler/lambda.m:
compiler/mode_constraints.m:
compiler/old_type_constraints.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/polymorphism_info.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/stm_expand.m:
compiler/structure_reuse.versions.m:
compiler/table_gen.m:
Conform to the changes above.
tests/invalid/illtyped_compare.err_exp:
Expect an improved variable name from unify_proc.m.
tests/invalid/try_detism.err_exp:
Expect a different variable number for an unnamed variable.
Packages are modules whose only job is to serve as a container for submodules.
Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages
in this (informal) sense.
Besides the include_module declarations for their submodules, most of the
packages in the compiler used to import some modules, mostly other packages
whose component modules their submodules may need. For example, ll_backend.m
used to import parse_tree.m. This meant that modules in the ll_backend package
did not have to import parse_tree.m before importing modules in the parse_tree
package.
However, this had a price. When we add a new module to the parse_tree package,
parse_tree.int would change, and this would require the recompilation of ALL
the modules in the ll_backend package, even the ones that did NOT import ANY
of the modules in the parse_tree package.
This happened even at one remove. Pretty much all modules in every one
of the backend have to import one or more modules in the hlds package,
and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m,
any addition of a new middle pass to the transform_hlds package required
the recompilation of all backend modules, even in the usual case of the two
having nothing to do with each other.
This diff removes all import_module declarations from the packages,
and replaces them with import_module declarations in the modules that need
them. This includes only a SUBSET of their child modules and of the non-child
modules that import them.
compiler/error_util.m:
Add a format piece for identifying cons_ids.
compiler/hlds_out_util.m:
compiler/prog_out.m:
Add a version of the predicate that convert cons_ids to string
that quotes appropriately for error messages.
Move this predicate, and some existing predicates for converting
cons_ids to strings from hlds_out_util.m to prog_out.m, so that
error_util.m, which is part of the parse_tree.m package, can use them.
Since cons_ids are defined in prog_data, a part of parse_tree, they
should always have been here.
Make the same move for some other predicates that also convert to strings
values of other types defined in prog_data.m.
compiler/prog_mode.m:
compiler/prog_util.m:
Move a predicate dealing with cons_ids from prog_mode.m to prog_out.m,
since prog_out needs it now.
compiler/det_report.m:
compiler/post_typecheck.m:
Use the new format piece where relevant.
compiler/typecheck_errors.m:
Use the new format piece where relevant.
Avoid prevarication about singular vs plural when not necessary.
tests/compiler/*.m:
Conform to the above.
tests/invalid/*.err_exp:
Update these to expect the new error messages.
library/varset.m:
Mark merge_subst and merge_subst_without_names with `pragma obsolete'.
The comments on them have been requesting people to use merge_renaming
and merge_renaming_without_names instead for about seven years, which
I think is enough warning :-)
Avoid using the obsolete predicates in varset.m itself.
library/term.m:
To make it possible to avoid using the obsolete predicates in varset.m
itself, add predicates that apply renamings, not substitutions, to a
term or a list of terms. Provide a renaming type to make this more
convenient.
Note that when term.apply_renaming actually does a renaming, the context
on the new term will be the original context, while term.apply_substitution
would have replaced this with the context on the replacement term.
I expect that in the vast majority of cases, the context does not matter.
In cases where it does, I expect that which context is better depends
on the situation; both choices have points in favor and against.
compiler/inst_graph.m:
compiler/prog_mode.m:
compiler/recompilation.version.m:
Use merge_renaming instead of merge_subst, and thus avoid shenanigans
with converting general terms back to variables.
compiler/rbmm.region_resurrection_renaming.m:
Add an "rbmm_" prefix to some types, to avoid the type "renaming"
being defined both by this module and (now) by library/term.m.
compiler/rbmm*.m:
Conform to the type name changes in rbmm.region_resurrection_renaming.m..
compiler/*.m:
Module qualify the end_module declarations. In some cases, add them.
compiler/table_gen.m:
Remove an unused predicate, and inline another in the only place
where it is used.
compiler/add_pragma.m:
Give some predicates more meaningful names.
Estimated hours taken: 6
Branches: main
compiler/*.m:
Convert almost all remaining modules in the compiler to use
"$module, $pred" instead of "this_file" in error messages.
In a few cases, the old error message was misleading, since it
contained an incorrect, out-of-date or cut-and-pasted predicate name.
tests/invalid/unresolved_overloading.err_exp:
Update an expected output containing an updated error message.
Branches: main
Change the argument order of many of the predicates in the map, bimap, and
multi_map modules so they are more conducive to the use of state variable
notation, i.e. make the order the same as in the sv* modules.
Prepare for the deprecation of the sv{bimap,map,multi_map} modules by
removing their use throughout the system.
library/bimap.m:
library/map.m:
library/multi_map.m:
As above.
NEWS:
Announce the change.
Separate out the "highlights" from the "detailed listing" for
the post-11.01 NEWS.
Reorganise the announcement of the Unicode support.
benchmarks/*/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
extras/*/*.m:
mdbcomp/*.m:
profiler/*.m:
tests/*/*.m:
ssdb/*.m:
samples/*/*.m
slice/*.m:
Conform to the above change.
Remove any dependencies on the sv{bimap,map,multi_map} modules.
Estimated hours taken: 2
Branches: main
Add the predicates sorry, unexpected and expect to library/error.m.
compiler/compiler_util.m:
library/error.m:
Move the predicates sorry, unexpected and expect from compiler_util
to error.
Put the predicates in error.m into the same order as their
declarations.
compiler/*.m:
Change imports as needed.
compiler/lp.m:
compiler/lp_rational.m:
Change imports as needed, and some minor cleanups.
deep_profiler/*.m:
Switch to using the new library predicates, instead of calling error
directly. Some other minor cleanups.
NEWS:
Mention the new predicates in the standard library.
Estimated hours taken: 12
Branches: main
Split up three big compiler modules: llds_out.m, hlds_out.m (5000+ lines each)
and deep_profiling.m (3000+ lines). Put the predicates in the resulting
smaller modules into cohesive groups where possible. A few of the predicates
in the original modules were unused; this diff deletes them.
There are no algorithmic changes.
compiler/llds_out_code_addr.m:
New module containing the part of llds_out.m that outputs
code addresses and labels.
compiler/llds_out_data.m:
New module containing the part of llds_out.m that outputs
lvals, rvals and their components.
compiler/llds_out_global.m:
New module containing the part of llds_out.m that generates
global static C data structures.
compiler/llds_out_instr.m:
New module containing the part of llds_out.m that outputs
instructions
compiler/llds_out_file.m:
New module containing the top level part of llds_out.m,
which coordinates the generation of a whole C source file.
compiler/llds_out_util.m:
New module containing the utility parts of llds_out.m.
compiler/llds_out.m:
Replace everything in this file with just the includes of the
submodules that now have all its previous contents.
compiler/hlds_llds.m:
Move a predicate here from llds_out.m, since it is a utility
predicate operating on a type defined here.
compiler/rtti_out.m:
Move a predicate here from llds_out.m, since it is a predicate
generating output from a rtti type.
compiler/hlds_out_mode.m:
The part of hlds_out.m that deals with writing out insts and modes.
compiler/hlds_out_goal.m:
The part of hlds_out.m that deals with writing out goals.
compiler/hlds_out_pred.m:
The part of hlds_out.m that deals with writing out predicates and
procedures.
compiler/hlds_out_module.m:
The part of hlds_out.m that deals with writing out module-wide tables.
compiler/hlds_out_util.m:
Parts of hlds_out.m that don't fit in anywhere else.
compiler/hlds_out.m:
Replace everything in this file with just the includes of the
submodules that now have all its previous contents.
compiler/simplify.m:
compiler/hlds_goal.m:
Move some insts from simplify.m to hlds_goal.m to allow
hlds_out_goal.m to use them also.
compiler/coverage_profiling.m:
The part of deep_profiling.m that deals with coverage profiling.
compiler/deep_profiling.m:
Remove the code moved to coverage_profiling.m, and export the utility
predicates needed by coverage_profiling.m.
Remove the things moved to prog_data.m and hlds_goal.m.
Put the predicates into a more logical order.
compiler/hlds_goal.m:
Move some predicates here from deep_profiling.m, since they
belong here.
compiler/prog_data.m:
Move a type from deep_profiling.m here, since it belongs here.
compiler/add_pragma.m:
Add a predicate from llds_out.m that is used only here.
compiler/*.m:
Conform to the changes above.
Estimated hours taken: 4
Branches: main
Further compiler speedups.
library/varset.m:
Speed up predicates by avoding making the same decisions over and over
again.
library/tree234.m:
library/map.m:
NEWS:
Add tree234.map_values_only and map.map_values_only.
compiler/add_pragma.m:
compiler/analysis.m:
compiler/code_info.m:
compiler/cse_detection.m:
compiler/cse_detection.m:
compiler/equiv_type_hlds.m:
compiler/global_data.m:
compiler/hlds_out.m:
compiler/hlds_rtti.m:
compiler/inst_graph.m:
compiler/lp_rational.m:
compiler/hlds_out.m:
compiler/mlds_to_il.m:
compiler/modules.m:
compiler/par_conj_gen.m:
compiler/polymorphism.m:
compiler/prog_data.m:
compiler/prog_type_subst.m:
compiler/recompilation.version.m:
compiler/simplify.m:
compiler/stack_layout.m:
compiler/type_util.m:
compiler/unneeded_code.m:
Use the new predicates.
compiler/mark_static_terms.m:
Do not bother traversing from_ground_term_construct scopes.
Remove a redundant test.
compiler/ml_unify_gen.m:
Speed up a predicate by avoding making the same decisions over and over
again.
compiler/mlds.m:
Factor out some code.
compiler/typecheck_info.m:
Operate on vartypes directly as maps; don't transform them
unnecessarily into association lists.
Do not bother to apply empty substitutions.
Estimated hours taken: 32
Branches: main
Include the type_ctor in cons_ids for user-defined types. The intention is
two-fold:
- It prepares for a future in which we allow more than one function symbol to
with the same name to be defined in a module.
- It makes the HLDS code more self-contained. In many places, processing
construction and deconstruction unifications required knowing which type
the cons_id belongs to, but until now, code couldn't know that unless it
kept track of the type of the variable unified with the cons_id.
With this diff, user-defined cons_ids are represented as
cons(SymName, Arity, TypeCtor)
The last field is filled in during post-typecheck. After that time, any module
qualification in the SymName (which may initially be partial) is redundant,
since it is also available in the TypeCtor.
In the future, we could make all those SymNames be just unqualified(_) at that
time. We could also replace the current maps in HLDS type definitions with
full cons_id keys with just name/arity keys (since the module qualifier is a
given for any given type definition), we could also support partially
qualified cons_ids in source code using a map from name/arity pairs to a list
of all the type_ctors that have function symbols with that name/arity, instead
of our current practice of inserting all possible partially module qualified
version of every cons_id into a single giant table, and we could do the same
thing with the field names table.
This diff also separates tuples out from user-defined types, since in many
respects they are different (they don't have a single type_ctor, for starters).
It also separates out character constants, since they were alreay treated
specially in most places, though not in some places where they *ought* to
have been treated specially. Take the opportunity to give some other cons_ids
better names.
compiler/prog_data.m:
Make the change described above, and document it.
Put the implementations of the predicates declared in each part
of this module next to the declarations, instead of keeping all the
code until the very end (where it was usually far from their
declarations).
Remove three predicates with identical definitions from inst_match.m,
inst_util.m and mode_constraints.m, and put the common definition
in prog_data.m.
library/term_io.m:
Add a new predicate that is basically a reversible version of
the existing function espaced_char, since the definition of char_consts
needs reversibilty.
compiler/post_typecheck.m:
For functors of user-defined types, record their type_ctor. For tuples
and char constants, record them as such.
compiler/builtin_lib_types.m:
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
New module to centralize knowledge about builtin types, specially
handled library types, and their function symbols. Previously,
the stuff now in this module used to be in several different places,
including prog_type.m and stm_expand.m, and some of it was duplicated.
mdbcomp/prim_data.m:
Add some predicates now needed by builtin_lib_types.m.
compiler/builtin_ops.m:
Factor out some duplicated code.
compiler/add_type.m:
Include the relevant type_ctors in the cons_ids generated in type
definitions.
compiler/hlds_data.m:
Document an existing type better.
Rename a cons_tag in sync with its corresponding cons_id.
Put some declarations into logical order.
compiler/hlds_out.m:
Rename a misleadingly-named predicate.
compiler/prog_ctgc.m:
compiler/term_constr_build.m:
Add XXXs for questionable existing code.
compiler/add_clause.m:
compiler/add_heap_ops.m:
compiler/add_pragma.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/assertion.m:
compiler/bytecode_gen.m:
compiler/closure_analysis.m:
compiler/code_info.m:
compiler/complexity.m:
compiler/ctgc_selector.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/delay_partial_inst.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/distance_granularity.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
compiler/export.m:
compiler/field_access.m:
compiler/foreign.m:
compiler/format_call.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_desc.m:
compiler/hlds_goal.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/inst_graph.m:
compiler/inst_match.m:
compiler/inst_util.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/interval.m:
compiler/lambda.m:
compiler/lco.m:
compiler/make_tags.m:
compiler/mercury_compile.m:
compiler/mercury_to_mercury.m:
compiler/middle_rec.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
compiler/mode_constraints.m:
compiler/mode_errors.m:
compiler/mode_ordering.m:
compiler/mode_util.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/polymorphism.m:
compiler/prog_ctgc.m:
compiler/prog_event.m:
compiler/prog_io_util.m:
compiler/prog_mode.m:
compiler/prog_mutable.m:
compiler/prog_out.m:
compiler/prog_type.m:
compiler/prog_util.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/rbmm.add_rbmm_goal_infos.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.usage.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/simplify.m:
compiler/simplify.m:
compiler/special_pred.m:
compiler/ssdebug.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/stratify.m:
compiler/structure_reuse.direct.detect_garbagem:
compiler/superhomoegenous.m:
compiler/switch_detection.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_constr_build.m:
compiler/term_norm.m:
compiler/try_expand.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unify_modes.m:
compiler/untupling.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Minor changes, mostly to ignore the type_ctor in cons_ids in places
where it is not needed, take the type_ctor from the cons_id in places
where it is more convenient, conform to the new names of some cons_ids,
conform to the changes in hlds_out.m, and/or add now-needed imports
of builtin_lib_types.m.
In some places, the handling previously applied to cons/2 (which
included tuples and character constants as well as user-defined
function symbols) is now applied only to user-defined function symbols
or to user-defined function symbols and tuples, as appropriate,
with character constants being handled more like the other kinds of
constants.
In inst_match.m, rename a whole bunch of predicates to avoid
ambiguities.
In prog_util.m, remove two predicates that did almost nothing yet were
far too easy to misuse.
Estimated hours taken: 20
Branches: main
Add a new compiler option. --inform-ite-instead-of-switch. If this is enabled,
the compiler will generate informational messages about if-then-elses that
it thinks should be converted to switches for the sake of program reliability.
Act on the output generated by this option.
compiler/simplify.m:
Implement the new option.
Fix an old bug that could cause us to generate warnings about code
that was OK in one duplicated copy but not in another (where a switch
arm's code is duplicated due to the case being selected for more than
one cons_id).
compiler/options.m:
Add the new option.
Add a way to test for the bug fix in simplify.
doc/user_guide.texi:
Document the new option.
NEWS:
Mention the new option.
library/*.m:
mdbcomp/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
Convert if-then-elses to switches at most of the sites suggested by the
new option. At the remaining sites, switching to switches would have
nontrivial downsides. This typically happens with the switched-on type
has many functors, and we treat one or two specially (e.g. cons/2 in
the cons_id type).
Perform misc cleanups in the vicinity of the if-then-else to switch
conversions.
In a few cases, improve the error messages generated.
compiler/accumulator.m:
compiler/hlds_goal.m:
(Rename and) move insts for particular kinds of goal from
accumulator.m to hlds_goal.m, to allow them to be used in other
modules. Using these insts allowed us to eliminate some if-then-elses
entirely.
compiler/exprn_aux.m:
Instead of fixing some if-then-elses, delete the predicates containing
them, since they aren't used, and (as pointed out by the new option)
would need considerable other fixing if they were ever needed again.
compiler/lp_rational.m:
Add prefixes to the names of the function symbols on some types,
since without those prefixes, it was hard to figure out what type
the switch corresponding to an old if-then-else was switching on.
tests/invalid/reserve_tag.err_exp:
Expect a new, improved error message.
Estimated hours taken: 1
Branches: main
compiler/table_gen.m:
compiler/unused_args.m:
Instead of printing each error message immediately, pass them back to
mercury_compile.m to print them all at once.
compiler/mercury_compile.m:
Do the printing.
compiler/hlds_goal.m:
compiler/inst_graph.m:
library/float.m:
library/int.m:
library/math.m:
Rename some predicates to avoid ambiguity.
compiler/*.m:
Conform to the changes above.
Estimated hours taken: 3
Branches: main
Clean up in unused module imports in the Mercury system detected
by --warn-unused-imports.
analysis/*.m:
browser/*.m:
deep_profiler/*.m:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
profiler/*.m:
slice/*.m:
Remove unused module imports.
Fix some minor departures from our coding standards.
analysis/Mercury.options:
browser/Mercury.options:
deep_profiler/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
profiler/Mercury.options:
slice/Mercury.options:
Set --no-warn-unused-imports for those modules that are used as
packages or otherwise break --warn-unused-imports, e.g. because they
contain predicates with both foreign and Mercury clauses and some of
the imports only depend on the latter.
Estimated hours taken: 1
Branches: main
Change the representation of some types used by mmc --make.
Minor formatting and style cleanups for mmc --make. There are no changes
to any algorithms.
compiler/make.m:
Delete the compilation_task type; it is unused.
Convert the target_file and linked_target_file types into
du's with named fields. This is nicer in mdb then pairs.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/options_file.m:
Conform to the above changes.
Make a bunch of minor formatting and style changes.
compiler/make.util.m:
Add a predicate make_target_file_list required by the above.
compiler/inst_graph.m:
Replace DCGs with state variables.
compiler/common.m:
Fix some typos.
Estimated hours taken: 24
Branches: main
Generate an XML representation of the du types in the current module.
The XML representation contains all the information about the type,
as well as associating with each type, data constructor and data field
any comments located near the comment.
The current strategy associates the comment starting on the same line
as the type declaration, and if there is none then the comment directly
above. At a later date, this strategy needs to be made more flexible.
This required two main changes to the compiler.
Change one was to associate with a term.variable the context
of that variable.
Then the constructor and constructor_arg types had to have their
context recorded.
compiler/xml_documentation.m:
Add a pass that generates an XML documentation
for the du types in the current module.
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/options.m:
Call the xml_documentation phase and stop afterwards.
compiler/error_utils.m:
Add a utitily predicate for reporting errors where
a file is unable to be opened.
library/term.m:
Add the term.context to term.variables.
Remove the backwards mode of var_list_to_term_list as it
no longer works.
Make the predicate version of term_list_to_var_list
semidet as we can no longer use the backwards version
var_list_to_term_list.
NEWS:
Mention the changes to the term module.
library/parser.m:
Fill in the term.context of term.variables while parsing.
compiler/prog_data.m:
Add the context to the constructor and constructor_arg types.
compiler/prog_io.m:
Fill in the context fields in the constructor and constructor_arg
types.
compiler/add_clause.m:
compiler/prog_io.m:
compiler/prog_io_typeclass.m:
compiler/typecheck.m:
Call the correct version of term_list_to_var_list,
to deal with the fact that we removed the reverse
mode of var_list_to_term_list.
compiler/notes/compiler_design.html:
doc/user_guide.texi:
Document the new module.
compiler/add_clause.m:
compiler/det_util.m:
compiler/fact_table.m:
compiler/hlds_out.m:
compiler/inst_graph.m:
compiler/intermod.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/prog_ctgc.m:
compiler/prog_io.m:
compiler/prog_io_dcg.m:
compiler/prog_io_goal.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/prog_io_util.m:
compiler/prog_io_util.m:
compiler/prog_util.m:
compiler/state_var.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/typecheck_errors.m:
library/term_io.m:
library/varset.m:
Handle the context in the term.variable structure.
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/equiv_type.m:
compiler/hhf.m:
compiler/hlds_out.m:
compiler/inst_check.m:
compiler/make_tags.m:
compiler/mercury_to_mercury.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mode_util.m:
compiler/module_qual.m:
compiler/post_typecheck.m:
compiler/prog_io.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/special_pred.m:
compiler/term_constr_build.m:
compiler/term_norm.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_proc.m:
compiler/untupling.m:
compiler/unused_imports.m:
Handle the context field in the constructor and constructor_arg
types.
compiler/check_hlds.m:
Add the xml_documentation module.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 6
Branches: main
compiler/*.m:
Convert almost all the compiler modules to use . instead of __ as
the module qualifier.
In some cases, change the names of predicates and types to make them
meaningful without the module qualifier. In particular, most of the
types that used to be referred to with an "mlds__" prefix have been
changed to have a "mlds_" prefix instead of changing the prefix to
"mlds.".
There are no algorithmic changes.
Estimated hours taken: 4
Branches: main
Various cleanups for the modules in the compiler directory. The are
no changes to algorithms except the replacement of some if-then-elses
that would naturally be switches with switches and the replacement of
most of the calls to error/1.
compiler/*.m:
Convert calls to error/1 to calls to unexpected/2 or sorry/2 as
appropriate throughout most or the compiler.
Fix inaccurate assertion failure messages, e.g. identifying the
assertion failure as taking place in the wrong module.
Add :- end_module declarations.
Fix formatting problems and bring the positioning of comments
into line with our current coding standards.
Fix some overlong lines.
Convert some more modules to 4-space indentation. Fix some spots
where previous conversions to 4-space indentation have stuffed
the formatting of the code up.
Fix a bunch of typos in comments.
Use state variables in more places; use library predicates
from the sv* modules where appropriate.
Delete unnecessary and duplicate module imports.
Misc. other small cleanups.
Estimated hours taken: 8
Branches: main
Improve the error messages generated for determinism errors involving committed
choice contexts. Previously, we printed a message to the effect that e.g.
a cc pred is called in context that requires all solutions, but we didn't say
*why* the context requires all solutions. We now keep track of all the goals
to the right that could fail, since it is these goals that may reject the first
solution of a committed choice goal.
The motivation for this diff was the fact that I found that locating the
failing goal can be very difficult if the conjunction to the right is
a couple of hundred lines long. This would have been a nontrivial problem,
since (a) unifications involving values of user-defined types are committed
choice goals, and (b) we can expect uses of user-defined types to increase.
compiler/det_analysis.m:
Keep track of goals to the right of the current goal that could fail,
and include them in the error representation if required.
compiler/det_report.m:
Include the list of failing goals to the right in the representations
of determinism errors involving committed committed choice goals.
Convert the last part of this module that wasn't using error_util
to use error_util. Make most parts of this module just construct
error message specifications; print those specifications (using
error_util) in only a few places.
compiler/hlds_out.m:
Add a function for use by the new code in det_report.m.
compiler/error_util.m:
Add a function for use by the new code in det_report.m.
compiler/error_util.m:
compiler/compiler_util.m:
Error_util is still changing reasonably often, and yet it is
included in lots of modules, most of which need only a few simple
non-parse-tree-related predicates from it (e.g. unexpected).
Move those predicates to a new module, compiler_util.m. This also
eliminates some undesirable dependencies from libs to parse_tree.
compiler/libs.m:
Include compiler_util.m.
compiler/notes/compiler_design.html:
Document compiler_util.m, and fix the documentation of some other
modules.
compiler/*.m:
Import compiler_util instead of or in addition to error_util.
To make this easier, consistently use . instead of __ for module
qualifying module names.
tests/invalid/det_errors_cc.{m,err_exp}:
Add this new test case to test the error messages for cc contexts.
tests/invalid/det_errors_deet.{m,err_exp}:
Add this new test case to test the error messages for unifications
inside function symbols.
tests/invalid/Mmakefile:
Add the new test cases.
tests/invalid/det_errors.err_exp:
tests/invalid/magicbox.err_exp:
Change the expected output to conform to the change in det_report.m,
which is now more consistent.
Estimated hours taken: 4
Branches: main
compiler/*.m:
Convert a bunch of modules to four-space indentation.
In the process, fix departures from our coding standards.
In some cases, do minor other cleanups such as changing argument orders
to be friendly to state variables.
There are no algorithmic changes.
Estimated hours taken: 4
Branches: main
compiler/*.m:
Change a bunch of modules to import only one module per line, even
from the library.
compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
Convert these modules to our current coding style. Use state variables
where appropriate. Use predmode declarations where possible.
Estimated hours taken: 8
Branches: main
This is a cleanup diff; there are no changes in algorithms.
compiler/delay_info.m:
compiler/instmap.m:
compiler/inst_match.m:
compiler/inst_util.m:
compiler/make.module_target.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/mode_util.m:
compiler/process_util.m:
compiler/prog_io_goal.m:
compiler/prog_io.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/recompilation.check.m:
compiler/recompilation.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/unique_modes.m:
Bring these modules up to date with our current style guidelines.
Switch to predmode syntax and state variable notation where
appropriate. Switch argument orders where this makes it possible
to use state variable notation. Use the svmap and svset modules
where appropriate. Fix inconsistent indentation; in some places,
fix inconsistent placement of comments.
compiler/passes_aux.m:
compiler/modecheck_unify.m:
compiler/mercury_compile.m:
compiler/post_typecheck.m:
compiler/prog_io_dcg.m:
compiler/mode_ordering.m:
compiler/inst_graph.m:
compiler/polymorphism.m:
compiler/prog_io_util.m:
compiler/mode_debug.m:
compiler/mode_robdd.check.m:
compiler/transform.m:
Minor changes to conform to the changed argument orders of some
predicates in the cleaned up modules. Also, some minor cleanups.
Estimated hours taken: 0.1
Branches: main
compiler/hhf.m:
compiler/inst_graph.m:
compiler/mode_constraint_robdd.m:
compiler/mode_constraints.m:
Module qualify calls to predicates as necessary in
order to avoid ambiguous overloadings (and the resulting
type ambiguites) when compiling with intermodule-optimization
enabled.
Estimated hours taken: unknown, but months (almost all by dmo)
Branches: main
Move changes in the compiler on the mode-constraints branch onto the trunk.
compiler/top_level.m:
Add the new package mode_robdd.
compiler/check_hlds.m:
Add the new modules within the check_hlds.m package:
mode_constraints, mode_constraint_robdd and mode_ordering.
compiler/hlds.m:
Add the new modules within the hlds.m package, hhf and inst_graph.
compiler/hhf.m:
This new module implements the transformation from our usual
superhomogeneous form to the hyperhomogeneous form required by
constraint based mode analysis.
compiler/inst_graph.m:
This new module computes the instantiation graphs required by
constraint based mode analysis.
compiler/hlds_goal.m:
Add an extra slot into goal_infos for use by constraint based mode
analysis, and the predicates required to manipulate it.
compiler/hlds_pred.m:
Add two extra slots into pred_infos and one extra slot into proc_infos
for use by constraint based mode analysis, and the predicates
required to manipulate them.
compiler/mercury_compile.m:
Invoke the constraint based mode analysis pass if the options call for
it.
compiler/mode_constraints.m:
This new module implements the top level of the constraint based
mode analysis algorithm: it finds the constraints and adds them
to the constraint store, and invokes other modules to find solutions
and process them.
compiler/mode_ordering.m:
This new module processes solutions of constraint systems by
trying to find execution orders for conjunctions that are consistent
with the assignment of producers represented by a such a solution.
compiler/mode_constraint_robdd.m:
This new module provides a useful interface to operations on robdds
used for constraint based mode analysis. The actual implementation
uses one or two of the mode_robdd.X.m modules.
compiler/mode_robdd.m:
New top-level package to hold the modules listed below, which deal
with robdd based solvers for the constraint systems generated by mode
analysis.
compiler/mode_robdd.check.m:
This new module invokes two of the modules below and compares their
results. If one of the modules is known to be good, this is useful
for debugging the other.
compiler/mode_robdd.r.m:
compiler/mode_robdd.tfeir.m:
compiler/mode_robdd.tfeirn.m:
compiler/mode_robdd.tfer.m:
compiler/mode_robdd.tfern.m:
compiler/mode_robdd.tfr.m:
These new modules each implement robdd based constraint solvers.
They differ in the amount of information they keep in the robdd
versus how much information they keep in Mercury data structures.
The naming scheme assigns a letter to each kind of information
we are concerned about, and includes that letter in the name the
Mercury data structure has a separate field for that kind of
information. The mapping is:
r: robdd (present in all variants)
tf: variables known to be true or false
e: variable equivalences
i: variable implications.
n: normalization
Normally only one of these would be linked in, or two if
mode_robdd.check.m is being used to compare two of these modules.
compiler/mode_robdd.equiv_vars.m:
This module implements utility operations involving sets of equivalent
variables.
compiler/mode_robdd.implications.m:
This module implements utility operations involving implications
among variables.
compiler/mode_robdd.prop.m:
Experimental module; currently unused. Committed only to preserve
its history.
compiler/goal_path.m:
Add a variant of an existing predicate needed by constraint based mode
analysis.
compiler/hlds_out.m:
Print out the components added to the HLDS by this change if the
appropriate signal character is present in the revelant option.
compiler/handle_options.m:
Add the signal for printing mode constraints to the names of the usual
dumping aliases. They have no effect unless constraint based mode
analysis is enabled.
compiler/options.m:
Add the options controlling the experimental mode constraints pass.
doc/user_guide.texi:
Document the options controlling the experimental mode constraints
pass for implementors.
compiler/notes/compiler_design.html:
Document the new modules, and fix some old errors.