compiler/indent.m:
compiler/parse_tree_out_misc.m:
Move indent operations from parse_tree_out_misc.m to a new module,
indent.m.
Include a "2" in the names of these operations, because
- these operations print two spaces per level of indentation, but
- some other, similar operations in the compiler use four spaces per level,
and they should be moved here later as well.
compiler/libs.m:
Add the new module to the libs package.
compiler/notes/compiler_design.html:
Document the new module, as well as some other modules in the libs
package that weren't documented before.
compiler/hlds_out_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_type_table.m:
Try to use the indent2_string function instead of the write_indent2
predicate, since this allows the indent to printed as part of a call
to io.format.
Fix the printing of loop control scope reasons. Make slight improvements
in the format of some other parts of the output.
compiler/hlds_out_typeclass_table.m:
Try to use the indent2_string function instead of the write_indent2
predicate, since this allows the indent to printed as part of a call
to io.format.
Several fields of class and instance infos that contain lists of stuff
(e.g. method_infos) were being written out on a single line, even though
the lists could be quite long. Fix this by writing out each list item
on its own line. Indent these lines, to separate them visually from
the heading lines preceding them.
Print more information about method_infos to help make sense of them.
compiler/hlds_out_util.m:
Try to use the indent2_string function instead of the write_indent2
predicate, since this allows the indent to printed as part of a call
to io.format.
Write each proof in a constraint proof map on its line.
compiler/parse_tree_out_sym_name.m:
Add a function version of a predicate, which returns a string
without writing it out.
compiler/hlds_out_mode.m:
Improve variable names.
compiler/write_error_spec.m:
Conform to the function renames in indent.m.
compiler/maybe_util.m:
Move the maybe_changed type from several modules of the compiler
to maybe_succeeded.m, and rename it to maybe_util.m.
compiler/libs.m:
compiler/notes/compiler_design.html:
Implement and document the rename.
compiler/common.m:
compiler/compile_target_code.m:
compiler/decide_type_repn.m:
compiler/det_analysis.m:
compiler/det_util.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/file_util.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.top_level.m:
compiler/make.track_flags.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
compiler/module_cmds.m:
compiler/parse_tree_out.m:
compiler/process_util.m:
compiler/recompilation.version.m:
compiler/write_module_interface_files.m:
Conform to the changes above.
... as a preliminary for extending the emulation to sized ints and uints.
compiler/int_emu.m:
Move all the emulation operations from uint_emu.m to int_emu.m,
moving each uint operation next to its int equivalent. To make this
possible without naming conflicts, add a distinguishing prefix
to the name of each emulation predicate. (The emulations of each op
for signed and unsigned ints are related though somewhat different,
and both the similarities and differences are easily visible and checkable
when their code is next to each other.)
On the other hand, the emulation code for an operation for e.g.
int/int8/int16/int32/int64 can be *identical* when the number of bits
is a parameter of that code, and the next diff will exploit this fact.
Unify the target_bits_per_int predicate from int_emu.m and the
target_bits_per_uint predicate from uint_emu.m, which had exactly
the same logic, and call it target_word_bits.
compiler/uint_emu.m:
Delete this module.
compiler/libs.m:
Delete both int_emu.m and uint_emu as a submodule of this package.
compiler/parse_tree.m:
Move int_emu.m to become a submodule of this package, to allow the next
change to it to use the some_int_const type in prog_data.m.
compiler/notes/compiler_design.html:
Generalize the description of int_emu.m. Note that the description
of uint_emu.m cannot be deleted, because it didn't exist :-(
compiler/const_prop.m:
compiler/simplify_goal_call.m:
Conform to the changes above.
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/mercury_to_mercury.m:
Delete this module, and replace it with ...
compiler/parse_tree_out_cons_id.m:
compiler/parse_tree_out_sym_name.m:
compiler/parse_tree_out_type.m:
compiler/parse_tree_out_misc.m:
... these four modules. The first three write out the entities
in their names: cons_ids, sym_names, and types. The fourth contains
the rest of the old mercury_to_mercury.m, plus a few predicates
moved there from prog_out.m that deal with indentation.
compiler/parse_tree.m:
Include the four new modules, and stop including the deleted module.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/prog_out.m:
Delete the code moved to parse_tree_out_misc.m.
compiler/*.m:
Adjust the imports as needed. Most modules need only one, maybe two
of mercury_to_mercury's four successor modules.
compiler/notes/coding_standards.html:
Document our usual initial comment block.
Document vim modelines a bit more extensively.
Document short %---% lines.
Fix bad formatting results caused by tabs in the HTML code.
Fix documentation rot.
compiler/notes/compiler_design.html:
Explain the terms HLDS, LLDS and MLDS just after their first occurrences.
Fix incorrect references to "passes".
Describe the components of the LLDS and MLDS backends the same way
where possible.
Fix documentation rot.
Fix bugs in English expression.
compiler/notes/developer_intro.html:
Fix documentation rot.
compiler/notes/glossary.html:
Explain that functions also have pred_infos.
compiler/notes/overall_design.html:
Fix bugs in English expression.
compiler/notes/reviews.html:
Fix documentation rot.
Fix bugs in English expression.
compiler/notes/work_in_progress.html:
Use a more accurate name for this page.
The resulting modules have much better cohesion.
compiler/typecheck_error_overload.m:
New module containing predicates that report type overloading errors.
compiler/typecheck_error_undef.m:
New module containing predicates that report references to undefined
predicates, functions, data constructors, and events.
compiler/typecheck_error_type_assign.m:
New module containing predicates that print and process type_assigns
and args_type_assigns.
compiler/typecheck_error_util.m:
New module containing general utility predicates for dealing with
type errors.
compiler/check_hlds.m:
compiler/notes/compiler_design.html:
Include and document the new modules.
compiler/typecheck_errors.m:
Delete the code that this diff moves to the new modules.
Reorder the remaining predicates to put related predicates
next to each other. Give some predicates new names to reflect
these groupings.
Mark as such one predicate that has been unused for a while.
Use different names for variables used for different purposes.
compiler/typecheck.m:
Conform to the changes in predicate names.
Move some utility predicates to the end of the module.
compiler/error_spec.m:
This new module contains the part of the old error_util.m that defines
the error_spec type, and some functions that can help construct pieces
of error_specs. Most modules of the compiler that deal with errors
will need to import only this part of the old error_util.m.
This change also renames the format_component type to format_piece,
which matches our long-standing naming convention for variables containing
(lists of) values of this type.
compiler/write_error_spec.m:
This new module contains the part of the old error_util.m that
writes out error specs, and converts them to strings.
This diff marks as obsolete the versions of predicates that
write out error specs to the current output stream, without
*explicitly* specifying the intended stream.
compiler/error_sort.m:
This new module contains the part of the old error_util.m that
sorts lists of error specs and error msgs.
compiler/error_type_util.m:
This new module contains the part of the old error_util.m that
convert types to format_pieces that generate readable output.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Include and document the new modules.
compiler/error_util.m:
The code remaining in the original error_util.m consists of
general utility predicates and functions that don't fit into
any of the modules above.
Delete an unneeded pair of I/O states from the argument list
of a predicate.
compiler/file_util.m:
Move the unable_to_open_file predicate here from error_util.m,
since it belongs here. Mark another predicate that writes
to the current output stream as obsolete.
compiler/hlds_error_util.m:
Mark two predicates that wrote out error_spec to the current output
stream as obsolete, and add versions that take an explicit output stream.
compiler/Mercury.options:
Compile the modules that call the newly obsoleted predicates
with --no-warn-obsolete, for the time being.
compiler/*.m:
Conform to the changes above, mostly by updating import_module
declarations, and renaming format_component to format_piece.
compiler/polymorphism.m:
compiler/polymorphism_clause.m:
compiler/polymorphism_goal.m:
As above. Each of these three modules now has better cohesion
than the original polymorphism.m.
Put the predicates in all three modules into a top-down order.
Give some predicates more meaningful names.
Fix some comment rot.
compiler/check_hlds.m:
compiler/notes/compiler_design.html:
Add and document the new modules.
compiler/modecheck_unify.m:
Conform to the change above.
When specified, this option causes the compiler to output,
to <module>.local_call_tree, a flattened form of the part of the
module call tree restricted to local predicates and functions, like this:
pred polymorphism_process_module/5
pred maybe_polymorphism_process_pred/7
pred polymorphism_update_arg_types/5
pred maybe_polymorphism_process_pred/7
pred polymorphism_process_pred_msg/7
pred polymorphism_process_pred_msg/7
pred polymorphism_process_pred/6
pred polymorphism_process_pred/6
pred polymorphism_process_clause_info/6
pred add_extra_arg_modes_to_proc/3
This output consists of a list of entries, with each entry naming
a predicate or function, and listing all the local predicates and functions
it calls. Both the callees in a single entry and the entries themselves
are in the order in which a depth-first left-to-right traversal of the
module, starting at the exported predicates and functions, would encounter
them. That order is also output to <module>.local_call_tree_order.
This information can give useful guidance about how the contents
of a module should be ordered.
doc/user_guide.texi:
compiler/options.m:
As above.
NEWS:
Announce the new option.
compiler/hlds_call_tree.m:
A new module to implement the new option.
compiler/hlds.m:
compiler/notes/compiler_design.html:
Add and document the new module.
compiler/mercury_compile_front_end.m:
Invoke the new module if the new option is set.
compiler/hlds_desc.m:
Add describe_pred and describe_pred_from_id. Reimplement
describe_proc and describe_proc_from_id in terms of those.
Allow callers of all four to decide whether we want the descriptions
to include the names of the defining module.
compiler/dead_proc_elim.m:
compiler/ml_proc_gen.m:
compiler/proc_gen.m:
Conform to the change to hlds_desc.m.
compiler/hlds_goal.m:
Document when it is ok for traversals of goals to assume that
they won't find any rhs_lambda_goals or complicated_unifys
in unifications.
Change the documentation of the five classes of unifications
(construct/deconstruct/assign/simple_test/complicated_unify)
to refer to the LHS as X and the RHS as Y, since pretty much
all the modules focusing on unifications (such as superhomoneous.m)
use that naming convention. Having the opposite convention here
was not a good idea.
compiler/prog_data.m:
Fix comment rot.
doc/reference_manual.texi:
NEWS:
Document and announce the new pragma.
compiler/prog_data_pragma.m:
compiler/prog_item.m:
Provide a representation for the new pragma. The part that ends up
being referred to from the HLDS goes into prog_data_pragma.m,
the part that is not needed once the HLDS has been constructed
goes into prog_item.m.
compiler/hlds_pred.m:
Add a slot to pred_infos for info from the new pragma.
Fix a bug in the comment on marker_has_format_call.
compiler/add_pragma.m:
Add the information in these pragmas to the HLDS.
compiler/check_pragma_format_call.m:
A new module to check the validity of format_call pragmas.
These checks test whether the arguments named in such pragmas
have the expected types and modes, which means that
the check must be done after both type and mode checking.
compiler/check_hlds.m:
compiler/notes/compiler_design.html:
Add and document the new module.
compiler/hlds_module.m:
Add a field to the module_info that records the set of pred_ids
that have format_call pragmas.
compiler/mercury_compile_front_end.m:
Invoke the check_pragma_format_call pass *provided* that
the new field in the module_info says it has any pragmas to check.
compiler/parse_pragma.m:
Add code to parse the new pragma.
compiler/format_call.m:
Check calls to predicates and functions with the new pragma
the same way as we check calls to string.format, io.format,
and stream.string_writer.format.
This required separating the code that checked calls to such predicates
from the code that optimized calls to such predicates, since
- a predicate or function with a format_call pragma that specifies
more than one argument pair has to have its correctness checked
for each pair, and
- a predicate or function with a format_call pragma does not actually
do any formatting, so that formatting cannot be optimized.
Fix an old bug, where we included the function result in the function's
reported arity, which meant that an error message could mention a call
to a nonexistent function. As part of that fix, the error message
now specifies whether it is complaining about a call to a predicate
or a function.
Change the exported interface of this module a bit
in order to allow the factoring out of repeated code.
compiler/parse_string_format.m:
Separate the parsing of format strings from their optimization,
again because calls to predicates and functions with format_call
pragmas need to be checked but cannot be optimized.
compiler/polymorphism.m:
Record the effect on argument numbers of any type_info and/or
typeclass_info arguments added by this pass.
compiler/convert_parse_tree.m:
compiler/det_analysis.m:
compiler/direct_arg_in_out.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/hlds_out_pred.m:
compiler/item_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_item_stats.m:
compiler/recompilation.version.m:
compiler/simplify_proc.m:
Conform to the changes above.
tests/invalid/bad_format_call.{m,err_exp}:
A new test case to see whether check_pragma_format_call.m detects
and reports invalid format_call pragmas as expected.
tests/warnings/format_call_warning.{m,exp}:
tests/warnings/format_call_warning_helper.m:
A new test case to see whether we generate the expected set of error
messages for incorrect calls to a predicate with a format_call pragma.
tests/invalid/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
Enable the new test cases.
tests/invalid/string_format_bad.err_exp:
tests/invalid/string_format_unknown.err_exp:
tests/warnings/disabled_warning.exp:
Expect the predicate vs function distinction to the printed in
error messages about bad calls to formatting predicates and functions.
In the process, restrict the use of these types to just those modules
that need to provide services both other modules that use var_tables,
and modules that do not. The latter are modules that either can,
or always do, execute before var_tables are set up.
In some cases, code that previously operated on e.g. var_name_sources
had all its callers converted to use var_tables. In those cases, replace
the use of var_name_sources with var_tables directly.
In other cases, code that previously operated on e.g. var_name_sources
still has some callers that use varsets. In those cases,
- provide versions using var_tables if most callers use var_tables,
renaming predicates/functions to make this the version seem the default,
- leave the operation to work on var_name_sources if some its callers
also have only var_name_sources,
- if there are no such callers, keep just the two versions operating
on varsets and var_tables respectively.
compiler/var_db.m:
compiler/var_table.m:
Move the part of var_table.m that contains the definitions
of the above three types, and the operations on them, to the
new module var_db.m. Only 25 modules currently need var_db.m,
compared to 176 for var_table.m.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Add and document the new module.
compiler/parse_tree_out_term.m:
Add a "_vs" suffix to the names of operations that print variables
or terms using varsets, and reuse their old names for versions
that use var_table arguments. For the operations that need var_name_source
versions, make it just select between the varset and var_table versions.
compiler/hlds_out_goal.m:
compiler/instmap.m:
compiler/hlds_out_mode.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/pd_info.m:
Change some predicates that used to operate on var_{name,type}_sources
to operate on var_tables.
In hlds_out_mode.m, delete some unused predicates, and stop exporting
a predicate whose only caller is local.
compiler/*.m:
Conform to the changes above.
Move the function quote_arg/1, which is used to quote arguments to shell
commands, out of options.m and into its own module. It is called from
several other places other than options.m and its implementation details
have nothing to do with the other contents of options.m.
Rename the function to quote_shell_cmd_arg/1.
compiler/shell_util.m:
New module for quote_arg/1 and its supporting predicates.
compiler/libs.m:
Include the new module.
compiler/options.m:
compiler/compile_target_code.m:
compiler/file_util.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Import the new module where necessary.
compiler/notes/compiler_design.m:
Update this document.
compiler/rbmm.m:
compiler/rbmm.region_analysis.m:
Move all the code (one predicate) out of rbmm.m to the new module
rbmm.region_analysis.m, leaving it containing nothing but
include_module declarations.
Delete the unneeded !IO argument pair of that predicate.
compiler/mercury_compile_middle_passes.m:
Don't pass the !IO arguments to that predicate.
compiler/notes/compiler_design.html:
This file has not mentioned the rbmm package until now.
Add a short description of the package itself, but since I don't
really know what each of its component modules do, I cannot add
even short descriptions of them.
compiler/rbmm.condition_renaming.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.interproc_region_lifetime.m:
compiler/rbmm.live_region_analysis.m:
compiler/rbmm.live_variable_analysis.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_arguments.m:
compiler/rbmm.region_instruction.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/rbmm.region_transformation.m:
Conform to the changes above.
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.m:
As above.
Note some comment rot.
compiler/top_level.m:
compiler/Mercury.options:
Add the new module.
compiler/notes/compiler_design.html:
Document the new module.
library/list.m:
Add a new variant of an existing utility predicate that can simplify
some of the moved code, together with some variants (for symmetry
with the existing code).
NEWS:
Announce the additions to the library.
compiler/module_baggage.m:
This reflects the changes to this module over the last year.
compiler/parse_tree.m:
Change the module name in the include_module declaration.
compiler/deps_map.m:
compiler/generate_dep_d_files.m:
compiler/grab_modules.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/mercury_compile_main.m:
compiler/module_dep_info.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.used_file.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
Change the module name in import_module declarations.
compiler/notes/compiler_design.html:
Change the module name in the module description.
compiler/check_module_interface.m:
As above. This module has not worked on raw compilation units for a while.
compiler/mercury_compile_main.m:
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Conform to the change above.
compiler/make_hlds.m:
This module used to both
- include several submodules, and
- define several types and predicates.
For some years now, we have preferred to do these two kinds of things
in separate modules, with package modules containing *only* include_module
declarations, and other modules containing *no* include_module
declarations. The reason is that submodules of a package automatically
get the imports of their parent, which creates unwanted coupling
between the submodule and its parent. This problem vanishes if
the parent module contains no imports, but the only practical way
to sustain that over time is for the parent to define nothing.
This diff therefore moves the definitions of types and predicates
out of make_hlds.m. It moves the types to a new submodule,
make_hlds_types.m. Since the predicates it defined were only
forwarding predicates, they can be deleted without replacement,
provided that the predicates they forwarded to are in *public*
submodules of make_hlds.m. This diff therefore arranges that.
It does the same with a forwarding type.
compiler/make_hlds_types.m:
A new submodule of make_hlds.m that contains the type definitions
that used to be in make_hlds.m itself.
compiler/instance_method_clauses.m:
A new submodule of make_hlds.m that contains the parts of add_class.m
that generate the clauses that define predicates that implement
instance methods. This part of add_class.m was completely separate
from the rest of add_class.m (it wasn't even invoked from there),
so putting it in its own module eliminates unnecessary coupling.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/add_class.m:
Delete the code that has been moved to instance_method_clauses.m.
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/goal_expr_to_goal.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_main.m:
compiler/qual_info.m:
compiler/state_var.m:
compiler/superhomogeneous.m:
Conform to the changes above, mostly by adding explicit import_module
declarations to replace a subset of the import_module declarations
that these modules used to implicitly inherit from their parent.
Most compiler passes need to know both the names and the types
of the variables they operate on. Until now, they had to pass along
two separate data structures for that, the varset and the vartypes,
and many operations required looking a variable up in both of these.
The var table is a single data structure that records for each variable
- its name, as the varset has traditionally done,
- its type, as the vartypes has traditionally done,
- the is_dummy_type flag which says whether its type is a dummy type,
which traditionally had to computed afresh at each lookup.
Switch the MLDS code generator to use var_tables instead of varsets and
vartypes. The code generator often needs to know the name and the type
of a variable at the same time, and it often needs to know which variables'
types are dummies, often enough that precomputing this info should be a win.
compiler/var_table.m:
Add this new module which defines the var_table.
Its operations are modelled after the operation in var_types.m.
compiler/hlds.m:
compiler/notes/compiler_design.html:
Add the new module to the hlds package.
compiler/prog_type.m:
compiler/type_util.m:
Move the is_dummy_type from type_util.m, which is in the
check_hlds package, to prog_type.m, which in the parse_tree package,
to avoid having this part of the hlds package depend on check_hlds.
(It already depends on parse_tree, for a lot of different things.)
Given a function and a predicate that each took a vartypes arg,
make new versions that take a var_table arg instead.
Rationalize the argument list of the function.
compiler/ml_gen_info.m:
Replace the varset and vartypes fields of the ml_gen_info with a
var_table field.
compiler/ml_code_util.m:
Replace code that used to operate on varsets and vartypes with code
that operates on var_tables.
Create new versions of a few operations to exploit the info in var_tables.
Give some predicates more meaningful names.
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_commit_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.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:
Replace code that used to operate on varsets and vartypes with code
that operates on var_tables.
In ml_switch_gen.m and ml_tag_switch.m, put some predicates' arguments
into an reasonable order by moving related args next to each other.
compiler/vartypes.m:
Delete an operation that was only needed in the MLDS backend,
in code that this diff replaces.
compiler/switch_util.m:
Put the larger input first in the arg list of a predicate.
compiler/closure_gen.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/export.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds.m:
compiler/llds_out_instr.m:
compiler/mark_tail_calls.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/tag_switch.m:
compiler/term_constr_util.m:
compiler/tupling.m:
compiler/unify_gen.m:
compiler/unify_gen_deconstruct.m:
compiler/var_locn.m:
Conform to the changes above.
compiler/introduced_call_table.m:
Move the tables of predicates that compiler passes may introduce
calls to here from direct_arg_in_out.m, simplify_proc.m and try_expand.m.
Start checking some of the arities of introduced predicates
(those I am sure of).
compiler/hlds.m:
Add the new module to the hlds package.
compiler/notes/compiler_design.html:
Document the new module.
compiler/dead_proc_elim.m:
Invoke the one exported predicate of the new module, instead
of three predicates exported by the three source modules.
Clarify some related code.
Delete code that became unneeded when we stopped supporting
automatic initialization of solver type variables.
compiler/direct_arg_in_out.m:
compiler/simplify_proc.m:
compiler/try_expand.m:
Delete the code moved to
compiler/pred_table.m:
Clarify some code used by dead_proc_elim.m.
compiler/pred_name.m:
compiler/prog_util.m:
As above.
compiler/notes/compiler_design.html:
Document the new module.
compiler/accumulator.m:
compiler/dep_par_conj.m:
compiler/distance_granularity.m:
compiler/lambda.m:
compiler/loop_inv.m:
compiler/par_loop_control.m:
compiler/parse_pragma.m:
compiler/parse_tree.m:
compiler/pd_info.m:
compiler/structure_reuse.versions.m:
compiler/tupling.m:
compiler/untupling.m:
compiler/unused_args.m:
Conform to the change above.
compiler/module_dep_info.m:
As above. The only change is added documentation.
compiler/parse_tree.m:
Include the new module in the parse_tree package.
compiler/notes/compiler_design.html:
Document the new module, and update the documentation of module_imports.m.
compiler/module_imports.m:
Delete the moved code, put the main data structure at the top,
and add some documentation for it.
compiler/compile_target_code.m:
compiler/generate_dep_d_files.m:
compiler/make.dependencies.m:
compiler/make.make_info.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/module_deps_graph.m:
Import module_dep_info.m, usually instead of module_imports.m,
sometimes beside module_imports.m.
compiler/make.top_level.m:
compiler/make.track_flags.m:
compiler/make.make_info.m:
Carve these three modules out of make.m.
make.top_level.m contains the top level of the mmc --make algorithm.
make.track_flags.m contains code for keeping track of which options
were used to compile which modules.
make.make_info.m defines the make_info structure used by all the
submodules of make.m, as well as a few other utility types.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/make.m:
Delete the code that has been moved to the new modules, leaving
make.m as purely a package.
Include make.build.m in the interface, so we can delete the forwarding
predicate we used to have here for use by mercury_compile_main.m.
compiler/Mercury.options:
Make make.top_level.m and make.track_flags inherit make.m's old
-no-warn-implicit-stream-calls option.
compiler/file_names.m:
Move a utility function about extensions here from make.m.
This also allows the removal of an undesirable module import of make.m
in write_deps_file.m.
compiler/make.build.m:
Move a type here from make.m, since it is needed to allow
mercury_compile_main.m call this module directly (i.e. not through
a forwarding predicate in make.m).
compiler/make.dependencies.m:
compiler/make.deps_set.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/options_file.m:
compiler/write_deps_file.m:
Conform to the changes above. This mostly means having each module make.X
actually import the modules it uses, instead of relying on make.m
importing them, and getting those imports via make.int0.
In a few cases, it means having each module make.X NOT import the modules
it does NOT use, since after the "package-ification" of make.m,
we now get warnings about these imports being unused.
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.
compiler/intermod_analysis.m:
compiler/intermod_order_pred_info.m:
Carve these two new moduiles out of intermod.m.
intermod_analysis.m contains the parts of the old intermod.m that
deal with collecting program analysis results in the forms of
compiler-generated pragmas, and writing them out. These pragmas make up
the second half of .opt files, and the entirety of .trans_opt files.
intermod_order_pred_info.m contains some utilities that are needed
by both intermod_analysis.m and the code that is left in intermod.m.
compiler/intermod.m:
Remove the code moded to the new modules.
compiler/transform_hlds.m:
Include the new modules in the transform_hlds package.
compiler/notes/compiler_design.html:
Describe the new arrangement.
compiler/item_util.m:
Move a utility function here from intermod.m, since it is (a) now needed
by intermod_analysis.m as well, and (b) this is its natural home.
compiler/exception_analysis.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_middle_passes.m:
compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
Conform to the changes above.
... to check_type_inst_mode_defns.m.
compiler/parse_tree.m:
Change the name in the include_module declaration.
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/decide_type_repn.m:
compiler/prog_foreign_enum.m:
compiler/prog_item.m:
Change the name in import_module declarations.
compiler/notes/compiler_design.html:
Change the name in the documentation.
compiler/recompilation.used_file.m:
compiler/recompilation.usage.m:
Move the code that writes out .used files from recompilation.usage.m
to the new file recompilation.used_file.m.
compiler/recompilation.m:
Include the new module in the recompilation package.
compiler/notes/compiler_design.html:
Document the new module.
compiler/mercury_compile_main.m:
compiler/recompilation.check.m:
Import the new module.
compiler/maybe_succeeded.m:
The new module.
compiler/libs.m:
Include the new module in the libs package.
compiler/notes/compiler_design.html:
Document the new module.
compiler/check_libgrades.m:
compiler/compile_target_code.m:
compiler/file_util.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
compiler/module_cmds.m:
compiler/process_util.m:
Conform to the move.
compiler/typecheck_debug.m:
A new module containing code to help debug typechecking, carved
out of type_assign.m.
compiler/check_hlds.m:
compiler/notes/compiler_design.html:
Add the new module to the check_hlds package, and document it.
compiler/typecheck_errors.m:
Move functions that are only ever called from this module to this module
from type_assign.m.
compiler/type_assign.m:
Delete the code moved to other modules.
compiler/typecheck.m:
compiler/typeclasses.m:
Import the new module.
compiler/hlds_out_inst_table.m:
compiler/hlds_out_type_table.m:
compiler/hlds_out_typeclass_table.m:
The three new modules.
compiler/hlds_out_module.m:
Delete the code moved to the new modules.
compiler/hlds_out.m:
Include the new modules in the hlds_out package.
compiler/notes/compiler_design.html:
Update the documentation of the hlds_out*.m modules.
compiler/prog_foreign_enum.m:
This new module contains
- code that used to be duplicated in add_foreign_enum.m and
check_parse_tree_type_defns.m, and
- utility predicates called by that common code.
Moving all this code into a new module in the parse_tree package
allows check_parse_tree_type_defns.m which is also in the parse_tree
package, to avoid importing add_foreign_enum.m, which is in the hlds
package.
compiler/parse_tree.m:
Include the new module in the parse_tree package.
compiler/notes/compiler_design.html:
Document the new module.
compiler/add_foreign_enum.m:
compiler/check_parse_tree_type_defns.m:
Delete the code moved to prog_foreign_enum.m.
compiler/polymorphism_post_copy.m:
compiler/polymorphism_type_class_info.m:
Those two new modules. The first contains the code of the part of the
polymorphism transformation that is done as a separate pass, after
copying code to procedures. The second builds and manipulates
type_class_infos.
compiler/check_hlds.m:
Include the new modules in the check_hlds package.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/builtin_lib_types.m:
Move four utility predicates here from polymorphism.m, since
(a) they are now needed by more than one polymorphism*.m module, and
(b) they belong here. To match the functions already here, turn
two of them into functions, and delete an unused argument from one.
compiler/make_goal.m:
Move two utility predicates here from polymorphism.m, since
(a) they are now needed by more than one polymorphism*.m module, and
(b) they belong here. Give them names that follow the naming schemes
of the predicates already here.
library/list.m:
Move delete_nth here from polymorphism.m, to join the existing
replace_nth.
NEWS:
Announce delete_nth.
compiler/polymorphism.m:
Delete the code moved elsewhere.
compiler/float_regs.m:
compiler/higher_order.m:
compiler/mercury_compile_front_end.m:
compiler/ml_type_gen.m:
compiler/saved_vars.m:
Conform to the changes above.
compiler/typecheck_msgs.m:
New module containing code that handles the non-type-error messages
that typechecking may generate.
compiler/typecheck.m:
compiler/typecheck_errors.m:
Move such code to the new module.
compiler/check_hlds.m:
Add the new module to the check_hlds package.
compiler/notes/compiler_design.html:
Document the role of the new module.
The remaining code of polymorphism.m is still less cohesive than
it ought to be, and could probably benefit from further reorganization
and/or breakup, but this diff is definitely a step in the right direction.
compiler/polymorphism_info.m:
A new module carved out of polymorphism.m, that defines
- the poly_info type,
- the types used in the fields in the poly_info type,
- the basic operations on the poly_info type and its component types,
- some very basic utility predicates used by several of polymorphism*.m.
It also contains the infrastructure needed for debugging the polymorphism
pass. This consists mainly of the mutables accessed from trace goals
in that pass.
Replace the bool type of one of these mutables with a bespoke type.
Attach the mutables to the I/O state, to avoid the need to make code
using those mutables semipure or impure.
compiler/polymorphism_type_info.m:
A new module carved out of polymorphism.m, that defines operations
that create type_infos, or extract type_infos from other type_infos
or typeclass_infos.
Add two new preds, polymorphism_make_type_info_{var,vars}_raw.
Unlike their old non-raw equivalents, these allow their callers to supply
module_infos, pred_infos and proc_infos without having to first construct
a poly_info from them.
compiler/polymorphism_lambda.m:
A new module carved out of polymorphism.m that manipulates lambda goals.
compiler/polymorphism.m:
Delete the code moved to the new modules.
Make the definition order of predicates in match their declaration order.
compiler/check_hlds.m:
Add the new modules to the check_hlds package.
compiler/notes/compiler_design.html:
Document the new modules. Fix some out-of-date and/or repetitive
existing documentation.
compiler/Mercury.options:
Require polymorphism.m to have matching declaration and definition orders
for its predicates.
compiler/complexity.m:
compiler/equiv_type_hlds.m:
compiler/higher_order.m:
compiler/ml_accurate_gc.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/simplify_goal_unify.m:
compiler/size_prof.m:
compiler/ssdebug.m:
compiler/stm_expand.m:
compiler/table_gen.m:
compiler/try_expand.m:
Conform to the changes above.
Call polymorphism_make_type_info_{var,vars}_raw instead of their
non-raw equivalents.
This fix uses the approach discussed on m-dev 2020 nov 16/17 for fixing
github issue #72, whose core problem is a need for information flow
back to a the caller from a callee when the callee fills in the
argument of a function symbol whose representation is a direct_arg tag.
In most cases when the callee fills in the value of an argument,
the caller can see it because the argument is in a word on the heap,
but when the function symbol uses a direct_arg tag, that is not the case.
compiler/direct_arg_in_out.m:
A new module that implements the transformation proposed on m-dev.
It creates a fresh clone variable every time an argument of a direct_arg
tag function symbol is (or may be) updated. This can happen several
times if a type has more than one function symbol with a direct_arg tag.
Since the affected variable can be bound to only one function symbol
at the start, its argument can be filled in only once, but the
compiler cannot know in advance what function symbol the variable
contains, and therefore which of the possibly several fill-in sites
(which fill in the arguments of different function symbols) executed
in sequence will actually update the variable.
The transformation ensures that once a variable is cloned, it is
never referred to again. It also ensures that in a branched control
structure (if-then-else, disjunction or switch), all branches will use
the *same* variable to represent the latest version of each cloned
variable at the end, so that following code has a consistent view
regardless of through which branch execution has reached it.
There are three situations that the transformation cannot and does not
handle.
1. Situations in which the mode of an argument is either an inst variable,
or an abstract inst. In either case, the pass cannot know whether
it should apply its transformation to the argument.
2. Situations where a procedure that has such an argument is
exported to C code as a function. In that case, the C signature
of the function we would generate would be different from what
the user would normally expect. We could modify the documentation
of the export pragma, but I don't think there much point due to
lack of demand. (The problem cannot arise when targeting any language
other than C, because we use direct_arg tags only with the low level
data representation, which we only use for C.)
3. Situations where a procedure that has such an argument is defined
by foreign_proc. Again, dealing with the problem would require
nontrivial changes to the documented interface between code in
foreign_procs and the surrounding Mercury code, and I see no demand
for code that could benefit from that.
In these cases, this module generates error messages.
compiler/transform_hlds.m:
Include the new module in the transform_hlds package.
Delete unnecessary module qualification on some existing inclusions.
Put some existing inclusions into a more meaningful order.
compiler/notes/compiler_design.html:
Document the new pass. Fix some nearby prose.
compiler/lambda.m:
compiler/simplify_proc.m:
Use a predicate exported by direct_arg_in_out.m to test, for each
procedure, whether the procedure has any argument positions that are
subject to the problem that direct_arg_in_out.m addresses.
simplify_proc.m does this for all procedures it processes;
lambda.m does this for all the procedures it creates from
lambda expressions.
Give a predicate in simplify_proc.m a better name.
Sort a list of predicate names.
compiler/hlds_module.m:
Add a field to the module_info that simplify_proc.m and lambda.m
can use to tell direct_arg_in_out.m what work (if any) it needs to do.
compiler/mercury_compile_middle_passes.m:
Invoke direct_arg_in_out.m if the new field in the HLDS indicates
that it has some work to do. (In the vast majority of compiler invocations,
it won't have any.)
compiler/hlds_pred.m:
The new code in direct_arg_in_out.m creates a clone of each procedure
affected by the problem, before deleting the originals (to make sure that
no references to the unfixed versions of now-fixed procedures remain.)
Make it possible to create exact clones of both predicates and procedures
by adding two pairs of predicates, {pred,proc}_prepare_to_clone and
{pred,proc}_create.
Add the direct_arg_in_out transformation as a possible source
of transformed predicates.
library/private_builtin.m:
Add a new builtin operation, partial_inst_copy, that the new module
generates calls to.
configure.ac:
Require the installed compiler to recognize partial_inst_copy
as a no_type_info builtin.
compiler/builtin_ops.m:
Recognize the new builtin. (This was committed before the rest; the diff
to private_builtin.m can be done only once the change to builtin_ops.m
is part of the installed compiler.)
compiler/options.m:
Add a way to test whether the builtin_ops.m in the installed compiler
recognizes the new builtin.
compiler/dead_proc_elim.m:
Do not delete the new primitive before direct_arg_in_out.m has had
a chance to generate calls to it.
Add an XXX.
compiler/error_util.m:
Recognize the new module as a source of error messages.
compiler/pred_table.m:
Add a pair of utility predicates to be used when looking up
builtin predicates, for which the compiler writer knows that
there should be exactly one match. These are used in direct_arg_in_out.m.
compiler/simplify_goal_call.m:
Replace some existing code with calls to the new predicates
in pred_table.m.
compiler/hlds_goal.m:
Add modes to rename_vars_in_goal_expr that express the fact
that when an atomic goal_expr has some variables renamed inside it,
it does not suddenly become some *other* kind of goal_expr.
New code in direct_arg_in_out.m relies on this.
compiler/hlds_out_goal.m:
When the HLDS we are dumping out is malformed because it contains
calls to predicates that have been deleted, the compiler used to abort
at such calls. (I ran into this while debugging direct_arg_in_out.m.)
Fix this. When such calls are encountered, we now print out as much
information we can about the call, and prefix the call with an
unmistakable prefix to draw attention to the problem.
compiler/inst_util.m:
Fix a bug that prevented direct_arg_in_out.m from even being invoked
on some test code for it.
The bug was in code that we use to unify a headvar's initial inst
with its final inst. When the initial inst was a non-ground bound_inst
such as the ones used in tests/hard_coded/gh72.m, and the final inst
was simply "ground", this code quite properly returned a bound_inst
(which, unlike ground, can show the exact set of function symbols
that the headvar could be bound to). The problem was that it
reused the original bound_inst's test results, including the one
that said the final inst is NOT ground, which of course is wrong
for any inst unified with ground. Fix two instances of this bug.
compiler/modes.m:
Make some of the code I had to traverse to find the bug in inst_util.m
easier to read and understand.
Replace some uses of booleans with bespoke enum types.
Change the argument lists of some predicates to put related arguments
next to each other.
Give some variables more descriptive names.
compiler/layout_out.m:
Conform to the change in hlds_pred.m.
compiler/var_locn.m:
Fix a code generation bug. When filling-in the value of the argument
of a function symbol represented by a direct_arg tag, the code we
generated for it worked only if the direct_arg tag used 0
as its ptag value. In the test cases we initially used for
github issue 72, that was the case, but the new tests/hard_coded/gh72.m
has direct_tag args that use other ptag values as well.
Document the reason why the updated code works.
compiler/term_constr_initial.m:
Add the new primitive predicate added to private_builtin.m,
partial_inst_copy, to a table of builtins that do not take type_infos,
even though their signatures contain type variables.
Fix a bunch of old bugs: most other such primitives were not listed
either.
mdbcomp/program_representation.m:
Add partial_inst_copy to the master list of builtins that do not take
type_infos even though their signatures contain type variables. (Done
by an earlier commit.)
Document the fact that any updates here require updates to
term_constr_initial.m.
library/multi_map.m:
We have long had multi_map.add and multi_map.set as synonyms,
but we only had multi_map.reverse_set. Add multi_map.reverse_add
as a synonym for it.
Define the "set" versions in terms of the "add" versions,
instead of vice versa.
NEWS:
Document the new predicates in multi_map.m.
tests/hard_coded/gh72a.m:
Fix typo.
tests/hard_coded/gh72.{m,exp}:
A new, much more comprehensive test case than gh72a.m.
This one tries to tickle github issue 72 in as many forms of code
as I can think of.
tests/invalid/gh72_errors.{m,err_exp}:
A test case for testing the generation of error messages for
two out of the three kinds of situations that direct_arg_in_out.m
cannot handle. (Proposals for how to test the third category welcome.)
tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
Enable the two new test cases, as well as two old ones, gh72[ab].m,
that previously we didn't pass.
tests/invalid/Mercury.option:
Do not compile gh72_error.m with --errorcheck-only, since its errors
are reported by a pass that --errorcheck-only does not invoke.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_backend.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
compiler/erlang_rtti.m:
compiler/mercury_compile_erl_back_end.m:
Delete these modules, which together constitute the Erlang backend.
compiler/notes/compiler_design.html:
Delete references to the deleted modules.
compiler/parse_tree_out_type_repn.m:
Update the format we use to represent the sets of foreign_type and
foreign_enum declarations for a type as part of its item_type_repn_info,
now that Erlang is no longer a target language.
compiler/parse_type_repn.m:
Accept both the updated version of the item_type_repn_info and the
immediately previous version, since the installed compiler will
initially generate that previous version. However, stop accepting
an even older version that we stopped generating several months ago.
compiler/parse_pragma_foreign.m:
When the compiler finds a reference to Erlang as a foreign language,
add a message about support for Erlang being discontinued to the error
message.
Make the code parsing foreign_decls handle the term containing
the foreign language the same way as the codes parsing foreign
codes, procs, types and enums.
Add a mechanism to help parse_mutable.m to do the same.
compiler/parse_mutable.m:
When the compiler finds a reference to Erlang as a foreign language,
print an error message about support for Erlang being discontinued.
compiler/compute_grade.m:
When the compiler finds a reference to Erlang as a grade component,
print an informational message about support for Erlang being discontinued.
compiler/pickle.m:
compiler/make.build.m:
Delete Erlang foreign procs and types.
compiler/add_foreign_enum.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/const_struct.m:
compiler/convert_parse_tree.m:
compiler/dead_proc_elim.m:
compiler/decide_type_repn.m:
compiler/deps_map.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/foreign.m:
compiler/globals.m:
compiler/granularity.m:
compiler/handle_options.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_module.m:
compiler/inlining.m:
compiler/int_emu.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/lco.m:
compiler/llds_out_file.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/ml_code_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_target_util.m:
compiler/ml_top_gen.m:
compiler/mlds.m:
compiler/mlds_dump.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_type.m:
compiler/module_imports.m:
compiler/parse_pragma_foreign.m:
compiler/parse_tree_out.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/prog_data.m:
compiler/prog_data_foreign.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/simplify_goal_scope.m:
compiler/special_pred.m:
compiler/string_encoding.m:
compiler/top_level.m:
compiler/uint_emu.m:
compiler/write_deps_file.m:
Remove references to Erlang as a backend or as a target language.
tests/invalid/bad_foreign_code.{m,err_exp}:
tests/invalid/bad_foreign_decl.{m,err_exp}:
tests/invalid/bad_foreign_enum.{m,err_exp}:
tests/invalid/bad_foreign_export.{m,err_exp}:
tests/invalid/bad_foreign_export_enum.{m,err_exp}:
tests/invalid/bad_foreign_import_module.{m,err_exp}:
tests/invalid/bad_foreign_proc.{m,err_exp}:
tests/invalid/bad_foreign_type.{m,err_exp}:
Add a test for Erlang as an invalid foreign language. Expect both the
new error message for this new error, and the updated list of now-valid
foreign languages on all errors.
It was one of the largest modules in the compiler, and it had low cohesion.
This diff contains no algorithmic changes.
compiler/parse_pragma_analysis.m:
compiler/parse_pragma_foreign.m:
compiler/parse_pragma_tabling.m:
Add these three modules carved out of parse_pragma.m. They handle
- pragmas that record the results of analyses,
- pragmas that deal with foreign languages, and
- tabling pragmas
respectively.
compiler/parse_tree.m:
Include the three new modules.
compiler/notes/compiler_design.html:
Document the three new modules.
compiler/parse_pragma.m:
Delete the code moved to the new modules. Group related predicates
together. Rename a few predicates.
Move the utility predicates that are needed both b parse_pragma.m
and one of the new modules to parse_util.m
compiler/parse_util.m:
Add the modules moved from parse_pragma.m.
Rename some existing predicates to differentiate them from the moves
predicates.
compiler/parse_item.m:
compiler/parse_mutable.m:
compiler/parse_type_repn.m:
Conform to the changes above.
compiler/make.build.m:
compiler/make.util.m:
As above. Make.build.m contains the parts of the old make.util.m
that deal with executing the actions that bring targets up to date.
This change improves the cohesion of both modules (though make.util.m's
still isn't great).
compiler/notes/compiler_design.html:
Document the new module.
compiler/make.m:
Include the new submodule.
compiler/Mercury.options:
Insist that all submodules of make.m have definitions in the same order
as declarations.
compiler/make.dependencies.m:
compiler/options_file.m:
Fix the order mismatches that Mercury.options used to cover up.
compiler/mercury_compile_main.m:
Import make.build instead of make.util.
compiler/make.deps_set.m:
New module containing the parts of the old make.dependencies.m
that define the module_index and dependency_file_index types,
and the operations on them.
compiler/make.dependencies.m:
Delete the code moved to make.deps_set.m, and import make.deps_set.m
instead. This increases the cohesion of this module.
compiler/make.m:
Include and import make.deps_set.m.
compiler/notes/compiler_design.html:
Document the new module.
compiler/convert_interface.m:
As above. I am about to add code to convert optimization files as well.
compiler/parse_tree.m:
Include the module under its new name.
compiler/notes/compiler_design.html:
Document the module under its new name.
compiler/comp_unit_interface.m:
compiler/intermod.m:
compiler/parse_module.m:
Import the module under its new name.
The non-style changes include
- Replacing outdated information with up to date information.
- Deleting fully obsolete information, such as references to the IL backend.
- Replacing list entries that were just bare words or phrases
with full sentences, where this is useful.
- Improvements to make documents easier to read and understand.
However, the bulk of the diff consists of style changes. The initial main
of these changes are to eliminate, or at least reduce, inconsistencies
- between the styles of the different parts of each document, and
- between the styles of differents documents.
This applies both as they appear in a browser, and in the source .html file.
The main style changes are
- Add a vim mode line to each file.
- Do not specify a color for the page background; let the browser decide.
- Add a heading to the top of each page that echoes the title.
- Avoid SHOUTING in headings.
- Avoid the unneeded use of <hr>.
- Avoid the use of headings (e.g. h5) that are so low in the hierarchy that
browsers render them in a font that is *smaller* than the usual font.
- Replace definition lists with standard unordered lists
when the list items are not definitions.
- Replace ordered lists with standard unordered lists
when the list items have no meaningful order.
- Do not indent the contents of unordered lists, with the exception of
nested lists.
- Unless all entries in a list are extremely short,
do not try to put anything next to <li>.
- Fix violations reported by weblint.
compiler/notes/compiler_design.html:
The changes described above.
Explicitly introduce the notion of the middle end.
compiler/notes/bootstrapping.html:
Rewrite this almost from scratch.
compiler/notes/work_in_progress.html:
Rename the page to make it clear that these issues are NOT being
worked on.
compiler/notes/release_checklist.html:
compiler/notes/todo.html:
Note that these lists are quite out of date.
compiler/notes/allocation.html:
compiler/notes/analysis.html:
compiler/notes/bytecode.html:
compiler/notes/c_coding_standard.html:
compiler/notes/coding_standards.html:
compiler/notes/developer_intro.html:
compiler/notes/failure.html:
compiler/notes/gc_and_c_code.html:
compiler/notes/glossary.html:
compiler/notes/grade_library.html:
compiler/notes/index.html:
compiler/notes/interface_files.html:
compiler/notes/mlds_tail_recursion.html:
compiler/notes/overall_design.html:
compiler/notes/promise_ex.html:
compiler/notes/reviews.html:
compiler/notes/trailing.html:
compiler/notes/type_class_transformation.html:
compiler/notes/upgrade_boehm_gc.html:
compiler/notes/Mmakefile:
Add a target to run weblint on all the HTML files.
Move the library grade install check out of the make package and into its own
module in the libs package. This is in preparation for performing the check
when building single source file programs.
compiler/check_libgrades.m:
New module containing the code that implements the library grade install
check.
compiler/libs.m:
Include the new module.
compiler/make.program_target.m:
Conform to the above change.
compiler/notes/compiler_design.html:
Mention the new module.