mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 10:23:46 +00:00
083d376e6598628362ee91c2da170febd83590f4
38 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dfab7a6bc9 | Improve some comments, and add some new ones. | ||
|
|
f355497087 |
Delete include context maps from parse_tree_int[012].
compiler/prog_item.m:
We used to record information about include declarations
in parse_tree_int[012] in two forms:
- as a pair of maps from module names to contexts (one each for
includes in the interface and implementation sections), and
- as a single map from module names to an include_module_info, which
recorded the section of its appearance along with its context.
The second of these data structures is derived from the first,
in a process that can result in the generation of diagnostic messages.
In the absence of any issues reported by these diagnostics, the two forms
contain the same information.
Avoid this redundancy by keeping only the second form in the parse trees
of .int0, .int and .int2 files. (.int3 files cannot contain include_module
declarations.)
Since .int2 files may contain include_module declarations only in
the interface section, change the representation of the second form
to a type that expresses this invariant: int_include_module_map,
which is a subtype of the existing type include_module_map.
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.collect_mq_info.m:
compiler/parse_tree_out.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the change above.
compiler/item_util.m:
Add a utility predicate for use by new code above.
|
||
|
|
5ae7d25740 |
Delete import/use context maps from parse_tree_int[012].
compiler/prog_item.m:
We used to record information about import and use declarations
in parse_tree_int[012] in two forms:
- as a quartet of maps from module names to contexts (one each for
int imports, int uses, imp imports and imp uses), and
- as a single map from module names to a section_import_and_or_use,
which recorded the section and kind (import or use) of its appearance
along with its one context, except for the case of modules that have
an use_module declaration in the interface section and an import_module
declaration in the implementation section.
The second of these data structures is derived from the first,
in a process that can result in the generation of diagnostic messages.
In the absence of any issues reported by these diagnostics, the two forms
contain the same information.
Avoid this redundancy by keeping only the second form in the parse trees
of .int0, .int and .int2 files. (For .int3 files, which can contain
only import_modules, and only in the interface section, this redundancy
has not been present even before now.)
Since .int and .int2 files may contain only use_module declarations
and not import_module declarations, change the representation of the
second form to a type that expresses this invariant: the new type
section_use_map, which is a subtype of the existing type
section_import_and_or_use_map.
For .int2 files, we could use an even tighter type right now, but
a fix for Mantis bug #563 would have to undo such a change, so
don't bother.
compiler/comp_unit_interface.m:
Delete the code that used to construct the first form above
for these interface file kinds. Conform to the changes above.
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.collect_mq_info.m:
compiler/parse_tree_out.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the changes above.
compiler/item_util.m:
Add new, specialized versions of existing utility predicates
to make that conformance possible.
|
||
|
|
faf9ebf5e3 |
Don't provide for implicit imports in .intN parse trees.
compiler/prog_item.m:
The ptiN_import_use_map fields in the representations of .int0, .int
and .int2 files had the same type as the ptms_import_use_map field
in the parse trees of .m files, which is where they were derived from.
However, while the ptms_import_use_map field needs to be able to represent
implicit imports, the parse trees of .int0, .int and .int2 files
should never include any implicit imports, and in fact any implicit
imports in these fields were already ignored.
Encode the invariant that interface files never include implicit imports
in the types of these fields.
compiler/comp_unit_interface.m:
Discard the implicit part of the source file's import_and_or_use_map
when computing the contents of .int0, .int and .int2 files.
compiler/item_util.m:
Provide the facilities used by the updated code in the modules above.
compiler/convert_parse_tree.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
Conform to the changes above.
|
||
|
|
307b1dc148 |
Split up error_util.m into five modules.
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.
|
||
|
|
0f75764e41 |
Pinpoint more actual/expected type differences.
compiler/typecheck_errors.m:
When there is a difference between actual and expected types
in predicate calls, do not just print the actual and expected types,
but if possible, point out the specific part(s) that cause the difference.
For example, report differences in arities, purity, determinism etc.
Also point out cases where the code is trying to specify the value
of an existentially quantified type variable.
When higher order types are printed as part of an error message,
strip any builtin qualifiers not just from the names of types,
but also from the names of the argument modes.
Start each part of an actual/expected pair at the same level of
indentation.
compiler/error_util.m:
Add a way to print out small integers as english names (one, two etc)
instead as numerals (1, 2 etc).
Add a way to print out purity descriptions.
Add a component, treat_next_as_first, that specifies that the next
format_component should be treated as the first part of a sentence
with respect to (de)capitalization by lower_next_if_not_first,
even if it is preceded by other format_components in a message.
This is useful in cases where the code that generates part of an
error message does not know whether that part will end up at the start
of the sentence, as the
<preceding sentence, ending in a period>
treat_next_as_first <context> lower_next_if_not_first, Words ...
sequence will keep Words capitalized if <context> is empty,
but will decapitalize it if <context> is not empty.
Rename {qual,unqual}_pf_sym_name_orig_arity as
{qual,unqual}_pf_sym_name_pred_form_arity, since this is clearer.
compiler/prog_out.m:
Apply the same s/orig_arity/pred_form_arity/ rename to some functions.
compiler/module_qual.qual_errors.m:
Fix an unrelated problem I came across while working on the changes above:
stray spaces at the ends of words(...) format_components, which screwed up
some error messages.
Simplify the description of classes and predicates by using facilities
in error_util.m that did not yet exist when this code was converted
to use error_util.m.
compiler/prog_type.m:
When stripping builtin qualifiers from types, strip them from the
modes stored in the higher_order inst into of higher order types as well,
for the same reason: to eliminate clutter in error messages.
Make the strip_kind_annotation function return a value that
shows in its type that the result will *not* be a kinded_type.
THIS IS THE FIRST USE OF SUBTYPES IN THE COMPILER.
compiler/type_assign.m:
Fix a long-standing documentation problem.
The type_assign type has long had a field named ta_external_type_params,
whose type was external_type_params, which was defined as equivalent
to a list of type variables. The name does not say what kinds of type
variables it contains, but the only two places that add type vars to
this field add type vars that are existentially quantified, either
by a predicate, or a cons_id. This diff therefore renames this field
to ta_existq_tvars, and changes its type to be just plain list(tvar).
(The external_type_params type has no documentation, so it may be used
to store different kinds of type variables in different places,
some of which may *not* be existentially quantified. Using the same name
for different purposes may be confusing.)
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/check_promise.m:
compiler/check_typeclass.m:
compiler/convert_parse_tree.m:
compiler/hhf.m:
compiler/hlds_desc.m:
compiler/hlds_out_util.m:
compiler/make_hlds_error.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/module_qual.qualify_items.m:
compiler/post_typecheck.m:
compiler/pred_table.m:
compiler/typecheck.m:
compiler/typecheck_debug.m:
compiler/typeclasses.m:
Conform to the changes above.
tests/invalid/fbnf.{m,err_exp}:
The motivating test case for this diff, slightly modified
from the code posted to m-users.
tests/invalid/type_diff.{m,err_exp}:
A test case to test the parts of the new code in typecheck_errors.m
that are not covered by other tests.
tests/invalid/Mmakefile:
Enable the new test cases.
tests/invalid/ext_type_bug.{m,err_exp}:
Extend this test case to test the pinpointing of errors that try to bind
existentially quantified type variables, at both the top level
and nested inside other type constructors.
tests/invalid/bug197.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
Expect pinpointed type differences in these error messages.
tests/invalid/abstract_eqv.err_exp:
tests/invalid/integral_constant_no_suffix.err_exp:
tests/invalid/method_impl.err_exp:
tests/invalid/mixed_up_streams.err_exp:
tests/invalid/try_bad_params.err_exp:
tests/invalid/type_error_ambiguous.err_exp:
tests/invalid/types2.err_exp:
tests/invalid_nodepend/errors2.err_exp:
Expected updated formatting in these error messages.
|
||
|
|
a32d6a16f4 |
Add the format_call pragma to the language.
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.
|
||
|
|
30cb4f0ba3 |
Tighten representation of include/import/use decls.
compiler/prog_item.m:
Change the representation of include, import and use declarations
in the data structures of .int0 and .int3 files.
For both .int0 and .int3 files, switch from data structures that can
associate one or more contexts with each such declaration with
data structures that can associate just one. Any duplicates would be
errors, and we don't want to allow the representation of errors in
compiler-generated interface files. (Similar updates to .int/.int2
files are coming soon.)
For .int3 files, delete two fields that hold information about include
declarations and import/use declarations respectively in a fully checked
form. They are not needed, because with invariants that .int3 files
are subject to (no uses, no implementation section, no implicit imports),
they contain just the same info as the new data structures mentioned
in the paragraph above.
compiler/comp_unit_interface.m:
Update the code that computes the contents of .int0/.int3 files.
Fix some out-of-sequence variable names.
compiler/convert_parse_tree.m:
Update the code that converts the generic parsed representation of
interface files to the specific representations of .int0/.int3 files.
compiler/item_util.m:
Update the utility predicates that comp_unit_interface.m and
convert_parse_tree.m use to do their jobs. Add new variants
of some existing predicates.
compiler/grab_modules.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/recompilation.check.m:
|
||
|
|
ea4f95a7ed |
Use var_tables in lco.m, and when dumping goals.
Since this is the first converted module that dumps out goals when
debugging trace flags are enabled, this required generalizing the code
that does that, to take either varsets or var_tables as a means of
specifying the names of variables. We do this via a new type,
var_name_source, which contains either a varset or a var_table.
Almost all of this diff is there to implement this generalization.
A large part of it affects code in the parse_tree package that we use
to write out the parts of HLDS goals that are defined by types defined
in that package. Since we want to avoid making any part of the parse_tree
package dependent on the hlds package, this required defining the
var_name_source type in the parse_tree package, which in turn requires
var_table.m to be in that same package.
compiler/lco.m:
Convert this module to use var_tables instead of varsets and vartypes.
compiler/var_table.m:
Move this module from the hlds package to the parse_tree package.
To make this, possible, move the parts that required access to the HLDS
to hlds_pred.m, from where it was usually invoked.
Export some utility predicates to allow the moved code to work
in hlds_pred.m without access to the actual definition of the
var_table type.
Define the var_name_source type.
Add some utility functions for use by code writing out variable names.
compiler/hlds_pred.m:
Add the code moved from var_table.m.
compiler/vartypes.m:
Move this module from the hlds package to the parse_tree package,
for symmetry with var_table.m. It did not depend on being in hlds
in any way.
compiler/hlds.m:
compiler/parse_tree.m:
Move vartypes.m and var_table.m from the hlds package
to the parse_tree package.
compiler/hlds_out_goal.m:
Change all the predicates in this module to take a var_name_source
instead of a prog_varset.
Fix some comments.
compiler/hlds_out_util.m:
Change some of the predicates in this module (those called from
hlds_out_goal.m) to take a var_name_source instead of a prog_varset.
compiler/parse_tree_out_term.m:
Provide variants of some existing predicates and functions that take
var_name_sources instead of varsets. The code of the copies
duplicates the logic of the originals, though I hope that this
duplication can be done away with at the end of the transition.
(The best solution would be to use a typeclass with methods
that convert vars to their names, but we would want to ensure
that the compiler can specialize all the affected predicates
and functions to the two instances of this typeclass, which is
something that we cannot do yet. In the meantime, the lack of
any generalization in the old versions preserves their performance.)
tools/sort_imports:
tools/filter_sort_imports:
A new tool that automatically sorts any occurrences of consecutive
":- import_module" declarations in the named files. The sorting is done
in filter_sort_imports; sort_imports loops over the named files.
After automatically replacing all occurrences of hlds.{vartypes,var_table}
in import_module declarations with their parse_tree versions, the updated
import_module declarations were usually out of order with respect to
their neighbours. I used this script to fix that, and some earlier
out-of-order imports.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_heap_ops.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/analysis.m:
compiler/arg_info.m:
compiler/build_mode_constraints.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/check_promise.m:
compiler/closure_analysis.m:
compiler/closure_gen.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/continuation_info.m:
compiler/convert_parse_tree.m:
compiler/coverage_profiling.m:
compiler/cse_detection.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/direct_arg_in_out.m:
compiler/disj_gen.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/file_names.m:
compiler/float_regs.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/goal_mode.m:
compiler/goal_path.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_clauses.m:
compiler/hlds_code_util.m:
compiler/hlds_error_util.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/hlds_out_pred.m:
compiler/hlds_rtti.m:
compiler/hlds_statistics.m:
compiler/inlining.m:
compiler/inst_check.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/instance_method_clauses.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_analysis.m:
compiler/interval.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/lookup_switch.m:
compiler/loop_inv.m:
compiler/make.module_target.m:
compiler/make.util.m:
compiler/make_goal.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_types.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_commit_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_unify_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mmc_analysis.m:
compiler/mode_comparison.m:
compiler/mode_constraints.m:
compiler/mode_debug.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_ordering.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/module_cmds.m:
compiler/old_type_constraints.m:
compiler/opt_debug.m:
compiler/optimize.m:
compiler/options_file.m:
compiler/ordering_mode_constraints.m:
compiler/par_loop_control.m:
compiler/parse_item.m:
compiler/parse_string_format.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/parse_util.m:
compiler/pd_debug.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/peephole.m:
compiler/polymorphism.m:
compiler/polymorphism_info.m:
compiler/polymorphism_lambda.m:
compiler/polymorphism_type_class_info.m:
compiler/polymorphism_type_info.m:
compiler/post_typecheck.m:
compiler/pragma_c_gen.m:
compiler/pred_name.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/quantification.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_graph.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.used_file.m:
compiler/recompilation.version.m:
compiler/recompute_instmap_deltas.m:
compiler/resolve_unify_functor.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/set_of_var.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_goal_scope.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/smm_common.m:
compiler/ssdebug.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.domain.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_data.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/term_constr_util.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/try_expand.m:
compiler/tupling.m:
compiler/type_assign.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_debug.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/var_locn.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
Conform to the changes above.
|
||
|
|
eeb5951a55 |
Move raw_compilation_unit to convert_parse_tree.m.
compiler/convert_parse_tree.m:
We used have many operations that worked on the raw_compilation_unit
representation of the module(s) being compiled, but in the last year,
we have converted all remaining such algorithms to operate on other
representations instead. Now, the only thing we use raw_compilation_units
for is to transfer information from split_parse_tree_src.m to
convert_parse_tree.m. Therefore move the definition of the
raw_compilation_unit type, and its raw_item_block component,
to convert_parse_tree.m. Also, make raw_item_block the only kind
of item_block; we don't use any other kind of item block anymore.
compiler/prog_item.m:
Delete the type definitions moved to convert_parse_tree.m.
Adjust the description of aug_compilation_units accordingly.
compiler/item_util.m:
Delete unused operations on item blocks.
compiler/prog_item_stats.m:
Comment out predicates that gathered statistics on item blocks,
and add "consider_used" pragmas for the predicates that this leaves
unused. They can be replaced the next time we need statistics
on item kinds. (For many statistics, e.g. the count of pred_decls,
the replacement could be as simple as list.length.)
|
||
|
|
7424f93a30 |
Use one error msg for undeclared mode references.
compiler/add_clause.m:
compiler/make_hlds_passes.m:
We used to have two separate predicates for generating error messages
about references to undeclared modes of predicates and functions.
One, in add_clause.m, was for undeclared modes in mode-specific clauses,
and generated messages that were as informative as possible.
The other, in make_hlds_passes.m, which was used for undeclared modes
in type_spec in foreign_export pragmas, was perfunctory, and gave
no details.
Act on an old XXX and delete the second predicate, replacing its uses
by calls to the first. To make this possible, move the first predicate,
which used to be private to add_clause.m, to make_hlds_passes.m.
compiler/add_pragma.m:
compiler/add_pragma_type_spec.m:
Call the first predicate, not the second.
compiler/prog_item.m:
The first predicate requires access to a varset that describes the names
of any inst variables in the undeclared mode. Include a varset for this
purpose in foreign_export pragmas. (type_spec pragmas already had the
required varset.)
compiler/convert_parse_tree.m:
compiler/get_dependencies.m:
compiler/item_util.m:
compiler/make_hlds_error.m:
compiler/module_qual.qualify_items.m:
compiler/parse_pragma_foreign.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_mutable.m:
Conform to the change in prog_item.m.
tests/invalid/pragma_qual_error.err_exp:
tests/invalid/type_spec.err_exp:
Expect updated error messages.
|
||
|
|
f83f44c954 |
Delete an unnecessary pass over item blocks.
compiler/convert_parse_tree.m:
Move the code that checks for non-abstract instances in interface sections
here from split_parse_tree_src.m, because the conversion code here has
to process every item in every item block anyway.
Effectively inline a call to avoid repeating a test.
Delete a predicate that has a duplicate in get_dependencies.m.
compiler/split_parse_tree_src.m:
Delete a whole pass over all item blocks of a source module
whose only job is now done by convert_parse_tree.m.
compiler/get_dependencies.m:
Export a predicate to make the change to convert_parse_tree.m possible.
|
||
|
|
068fc20006 |
Improve error management in convert_parse_tree.m.
compiler/hlds_module.m:
compiler/prog_item.m:
Record the identity of predicates and functions that have misplaced
attempts at definition in the interface section using the
pred_pf_name_arity type instead of the pf_sym_name_arity type.
They both specify an arity, but only in pred_pf_name_arity is it clear
*which kind* of arity this is.
compiler/convert_parse_tree.m:
Record external declarations and foreign_procs in the interface
as misplaced attempts at predicate or function definition using
pred_pf_name_arity, so that the code obviously has no arity bugs,
whereas the old code merely had no obvious bugs. (It did actually work.)
Record fact_table pragmas in the interface as similar misplaced attempts
as predicate or function definition, *if* the pragma contains
a pred_or_func indication.
Factor out some common code.
compiler/hlds_pred.m:
Add predicates to return a pred_info's arity as pred_form_arity
and as user_arity.
compiler/make_hlds_separate_items.m:
compiler/typecheck_errors.m:
Conform to the changes above.
tests/invalid_nodepend/external_in_interface.{m,err_exp}:
tests/invalid_nodepend/foreign_proc_in_interface.{m,err_exp}:
tests/invalid_nodepend/fact_table_in_interface.{m,err_exp}:
Three new test cases to test the
tests/invalid_nodepend/Mmakefile:
Enable the new tests.
tests/invalid/external2.m:
Fix typo in comment.
|
||
|
|
d64961d79d |
Use checked types/insts/modes in parse_tree_module_src.
This means that we can do the exact same checks (and, if needed, generate
the exact same error messages) when generating interface files as when
generating target language code.
This should also allow us to simplify the process of adding type, inst
and mode definitions to the HLDS.
compiler/prog_item.m:
As above.
Delete unused function.
compiler/error_util.m:
Add mechanisms that allow us to distinguish (a) error specs that represent
a type, inst or mode name definition being invalid, from (b) other error
specs.
compiler/check_type_inst_mode_defns.m:
Improve the error messages we generate, in several ways.
First, for each message, specify a real severity. When the messages
could be seen only when generating interface files, making them all
warnings was fine and preserved old behavior, but since soon these
will be the only place for these checks, we need to call errors errors.
Second, specify, in the phase, which errors represent a invalid type,
inst or mode definition, and which don't.
Third, improve the wording of messages. In some places, do this by
being clearer about the distinction between declarations and definitions.
In others, do it by including more information in the message. In yet
others, do it by recovering some kinds of mistakes (mostly items being
in the wrong section) enough to avoid avalanche errors.
Fourth, fix a bug. If a type ctor has an exported *declaration*,
then it is ok for any foreign type definitions for that type_ctor
being in the implementation section, but if the type_ctor has an
exported Mercury *definition*, then any foreign_type definitions
must be in the interface section as well. The code that handled
both these situations did not enforce that.
Fifth, fix another bug: do not include foreign type definitions
in the source definitions of a type_ctor twice, once as a "du" (sic)
definition, and once as itself.
compiler/convert_parse_tree.m:
Check type, inst and mode definitions in raw_compilation_units
when creating parse_tree_module_srcs.
compiler/comp_unit_interface.m:
Make the code constructing interface files work from the checked maps
in parse_tree_module_srcs.
compiler/make_hlds_passes.m:
Set the flags that say we have found invalid type, inst or mode definitions
from the error specs constructed during the creation of the checked
type, inst and mode maps.
compiler/add_type.m:
Comment out an error message for a condition that will be detected and
reported by check_type_inst_mode_defns.m.
compiler/make_hlds_separate_items.m:
For now, turn checked maps of type, inst and mode definitions
back to item lists for addition to the HLDS. Adding whole checked
definitions to the HLDS will be done by a future change.
compiler/make_hlds_error.m:
Fix misleading indentation in an error message.
compiler/parse_tree_out.m:
Conform to the changes above.
Generate output whose indentation does not depend on tab settings.
compiler/check_raw_comp_unit.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
Conform to the changes above.
compiler/parse_type_defn.m:
Fix misleading error message for ":- type <name> = <type>".
tests/debugger/foreign_type.{m,exp}:
Delete a redundant type declaration to avoid a warning, and update
the .exp file to expect the new line numbers.
tests/invalid/any_mode.err_exp:
tests/invalid/bug436.err_exp:
tests/invalid/bug476.err_exp:
tests/invalid/exported_foreign_enum.err_exp:
tests/invalid/fe_unmapped_nonverbose.err_exp:
tests/invalid/fe_unmapped_verbose.err_exp:
tests/invalid/foreign_enum_invalid.err_exp:
tests/invalid/foreign_solver_type.err_exp:
tests/invalid/foreign_type_visibility.err_exp:
tests/invalid/pragma_qual_error.err_exp:
tests/invalid/repeated_field_name.err_exp:
tests/invalid/subtype_foreign.err_exp:
tests/invalid/type_with_no_defn.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/user_field_access_decl_conflict.err_exp:
tests/invalid_nodepend/bad_foreign_type.err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/invalid_typeclass.err_exp:
tests/invalid_nodepend/types.err_exp:
tests/invalid_nodepend/uu_type.err_exp:
tests/invalid_nodepend/where_abstract_enum.err_exp:
Expect the new error messages.
tests/invalid/abstract_solver_type.{m,err_exp}:
tests/warnings/abstract_solver_type.{m,exp}:
Move the abstract_solver_type test case from invalid to warnings, because
this diff changes its only error to be only a warning.
tests/invalid/Mmakefile
|
||
|
|
4548706b85 |
Switch to checked type/inst/mode maps for .int0.
compiler/prog_item.m:
As above.
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.collect_mq_info.m:
compiler/parse_tree_out.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the change above.
|
||
|
|
4126519139 |
Separate subtypes from du types in parse trees.
compiler/prog_data.m:
Split type_details_sub from type_details_du, and separate
parse_tree_sub_type from parse_tree_du_type. This gets us two things:
- It allows us to encode the prohibition on user-specified equality and
comparison predicates, and "where direct_arg is" clauses,
on subtype definitions.
- It gives us data types we can use to represent (a) only subtype
definitions, and (b) only non-subtype du definitions.
Note that this diff deliberately leaves the HLDS representation
of subtypes unchanged. This is because while a subtype *definition*
may not specify e.g. equality and comparison predicates, a subtype *can*
have equality and comparison predicates; it just has to get them from
its base type. And the same applies to direct args.
compiler/parse_type_defn.m:
Enforce the invariant that subtypes may not have user-specified equality
and comparison predicates, or "where direct_arg is" clauses.
If we find a subtype definition that does have one or both of these
non-allowed and now-nonrepresentable components, we do still want to
return the rest of the type definition, in order to avoid misleading
error messages about that type having no definition at all. To make this
possible, allow the parsing predicate to return error_specs "alongside",
as well as "instead of", the item or marker being parsed.
compiler/parse_item.m:
compiler/parse_module.m:
compiler/parse_class.m:
Handle these "alongside" error messages.
compiler/prog_item.m:
Separate out subtypes from other du types in type definition maps.
compiler/add_type.m:
Delete a semantic check that is now in parse_type_defn.m.
Conform to the change to the representations of subtypes/du types
in the parse tree.
compiler/item_util.m:
Add a new utility function for subtypes.
compiler/check_type_inst_mode_defns.m:
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/decide_type_repn.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/intermod.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the change to the representations of subtypes/du types
in the parse tree.
|
||
|
|
12605f8c10 |
Use checked type/inst/modes in parse_tree_int[123]s.
With this change, we guarantee that if any type, inst or mode
has inconsistent definitions in its defining module, those inconsistencies
will not make it into the the module's .int/.int2/.int3 files, where
they would confuse any compiler invocation that reads them in.
compiler/prog_item.m:
Replace {type,inst,mode}_ctor_defn_maps, which are unchecked,
with {type,inst,mode}_ctor_checked_maps in parse_tree_int[123]s.
To make this possible,
- generalize the items containing inst and mode definitions the way that
items containing type definitions have been generalized previously,
to allow them to store particular *kinds* of inst or mode definitions;
- move the definitions of type_ctor_checked_map and its components
here from check_type_inst_mode_defns.m; and
- add similar, but simpler, definitions for {inst,mode}_ctor_checked_map.
compiler/check_type_inst_mode_defns.m:
Delete the type definitions moved to prog_item.m.
Modify the checking process slightly to allow it to check properly
the definitions we now put into .int, .int2 and .int3 files.
Add code to check inst and mode definitions as well as type definitions.
Since insts and modes have only one non-abstract kind of definition,
these codes are much simpler than the code for checking types.
compiler/comp_unit_interface.m:
Construct checked type, inst and mode definitions to put into
.int, .int2 and .int3 files. The .int2 and .int3 parts were
reasonably simple, but the .int part requires some detailed
case-by-case analysis.
compiler/convert_parse_tree.m:
Check the type, inst and mode definitions read in from .int/.int2/.int3
files when creating their parse trees. If those files were generated
by a compiler that has this diff, then this checking process should
not find any problems.
compiler/equiv_type.m:
Operate on checked type, inst and mode definitions instead of their
unchecked versions.
Delete an unneeded field from a structure.
compiler/error_util.m:
Add {qual,unqual}_{inst,mode}_ctor as format components, so that
any error messages about inst and mode definitions do not have to convert
inst_ctors and mode_ctors to symname/arity pairs.
compiler/item_util.m:
Add some utility predicates and functions needed by the changes above.
compiler/module_qual.collect_mq_info.m:
Since checked type, inst and mode definitions can contain info that is
derived from both the interface and implementation sections of a module,
add the capability to get only the *publicly* declared types, insts and
modes from their respective kinds of checked definitions.
compiler/module_qual.qualify_items.m:
Module qualify checked type, inst and mode definitions.
compiler/module_qual.qual_errors.m:
Treat references to inst_ctors and mode_ctors in qualification error
messages the same way as we treat type_ctors.
Also replace mq_ids that are intended to represent classes with class_ids,
to represent the intent better.
compiler/parse_tree_out.m:
Output the updated parse_trees of .int/.int2/.int3 files.
compiler/prog_data.m:
Add an XXX about a future change.
compiler/decide_type_repn.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/pred_table.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the changes above.
library/maybe.m:
Add utility predicates needed by the code above.
NEWS:
Announce the new predicates in maybe.m.
tools/intdiffall:
A script that shows differences between the automatically generated
interface files between stage 1 and stage 2, which helped debug this diff.
|
||
|
|
22038a5b28 |
Rename check_parse_tree_type_defns.m ...
... 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.
|
||
|
|
d065635c81 |
Record source items in type_ctor_checked_defns.
Within each type_ctor_checked_defn, record the original items
(mostly type definition items, and maybe some foreign enum items)
from which that type_ctor_checked_defn was constructed.
This will consist of all the type and foreign enum definition items
recorded for the given type constructor, MINUS the erroneous items
for which the checking process generates error messages.
The intention is to enable a future diff to replace the type_ctor_defn_map
fields in parse_tree_intN with type_ctor_checked_map fields.
Currently, if e.g. module_a.m has inconsistent definitions for a type t,
those definitions get put into module_a.intN. If module_a is imported
by M modules, then these inconsistencies will be reported M times,
once for each import. Generating .intN files from a type_ctor_checked_map
would allow us to report such inconsistencies just when compiling module_a.
It is to make this step possible that we need the consistent (sub)set of the
original items in each type_ctor_checked_defn. (Testing of the changes
in this diff will require the presence of that future diff.)
The simplest way to ensure that we report any of these inconsistencies
the same way when generating target code as when generating interface files
(which is suppressed by default at the moment) would be for a later change
to also replace the lists of item_type_defn_infos and item_foreign_enum_infos
with a type_ctor_checked_map in parse_tree_module_src.
compiler/check_parse_tree_type_defns.m:
A du type that is a subtype may not have foreign type definitions for it.
Encode this invariant in the status of such types.
Generate error messages for foreign type items, as well as foreign enum
items, for du types that are subtypes.
Put the definitions of the status types into the same order as the
corresponding checked type kinds.
Simplify some code.
compiler/decide_type_repn.m:
Ignore the extra information in type_ctor_checked_defns.
compiler/convert_parse_tree.m:
compiler/item_util.m:
Move some utility functions from convert_parse_tree.m to item_util.m,
to allow check_parse_tree_type_defns.m to use them.
|
||
|
|
3a1d21cc3a |
Move parse_tree_opt to convert_parse_tree.m.
compiler/prog_item.m:
compiler/convert_parse_tree.m:
Move the parse_tree_opt type from prog_item.m to convert_parse_tree.m,
because it is now used only as an intermediate step in parse_module.m.
compiler/read_modules.m:
Delete an unused field that used to contain parse_tree_opts.
compiler/mercury_compile_main.m:
Delete a now-unneeded import.
|
||
|
|
6622e5fbb9 |
Process parse_tree_int[012], not parse_tree_int.
compiler/recompilation.version.m:
Compute version numbers for parse_tree_int[012], not parse_tree_int.
Group gathered items and gathered instances into a single type.
Change argument lists to consistently put old things (gathered items,
gathered instances, version numbers) before new.
compiler/write_module_interface_files.m:
Compare new version numbers vs old for parse_tree_int[012],
not parse_tree_int.
compiler/prog_item.m:
Move the parse_tree_int type to convert_parse_tree.m, since now
it is used only by the parser, which them immediately converts
the generic parse_tree_int to parse_tree_intN for the required N.
compiler/convert_parse_tree.m:
Move the parse_tree_int type here.
Delete the predicates that convert parse_tree_int[0123] to parse_tree_int,
since they are not needed anymore.
compiler/parse_module.m:
compiler/read_modules.m:
Delete the predicates that read in parse_tree_int,
since they are not needed anymore.
|
||
|
|
b3748a367b |
Separate self-FIM languages by module section.
compiler/prog_item.m:
Split the parse_tree_module_src that holds the languages for which
the module needs a self-foreign-import into two, depending on the
section (interface or implementation) into which the self-FIM should go.
compiler/convert_parse_tree.m:
When computing the self-FIM languages, put each one into its section.
compiler/comp_unit_interface.m:
Don't compute the interface self-FIMs, since they are now available
in the parse_tree_module_src.
Document why we *do* compute the implementation self-FIMs
for the interface file we are constructing.
compiler/check_raw_comp_unit.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
Conform to the changes above.
|
||
|
|
e2abe444f4 |
Always compute the self-import FIMs.
compiler/convert_parse_tree.m:
Always compute the set of foreign languages for which
the current module needs a self-import FIM. Use the algorithm
that grab_unqual_imported_modules_make_int used to use to fill in
that slot in the parse_tree_module_src.
Stop computing some values whose only user was a sanity check.
If it hasn't triggered by now, it won't.
Delete an unused predicate that won't be needed.
compiler/prog_item.m:
Since that field in the parse_tree_module_src is now always filled in
when the parse_tree_module_src is created, delete the maybe wrapper
around it.
compiler/grab_modules.m:
Don't fill in the already-filled-in field.
compiler/comp_unit_interface.m:
Conform to the changes above, and add an XXX.
compiler/parse_tree_out.m:
Conform to the changes above.
|
||
|
|
f1927afe0b |
Break a source file info parse_tree_module_srcs ...
... instead of into raw_compilation_units. Besides being more convenient to
work on, a parse_tree_module_src encodes in its type a significant number
of invariants that a raw_compilation unit does not.
compiler/split_parse_tree_src.m:
Immediately after creating a raw_compilation_unit for one of the modules
in a potentially multi-module source file, convert it to a
parse_tree_module_src.
Fix an old problem that can come up in contrived erroneous code.
Specifically, when a submodule is both nested inside its parent module,
*and* it also has an explicit include_module declaration, we used to
record the contexts of both "inclusions", after generating an error
message. The more rigorous checking that later code now does on the
resulting inclusion map would look at this "duplicate inclusion"
and generate *another* error message. To avoid this redundant message,
do not record the contexts of erroneous inclusions for which a message
has already been generated.
compiler/grab_modules.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
This allows us to avoid having code for doing what converting the
raw_compilation_unit to a parse_tree_module_src has already done.
In fact, that conversion code does a better job. The old code assumed
that all implicitly available modules are used in the interface,
whereas in fact only some should be used in the interface, with
the rest being used in the implementation section.
compiler/module_imports.m:
Make the predicates that create module_and_imports structures
take a parse_tree_module_src instead of a raw_compilation_unit
as input. For now, we convert the parse_tree_module_src back to
a raw_compilation_unit for further processing, but I intend
a later diff to change this. Nevertheless, one immediate change
is that init_module_and_imports now stores the *actual*
parse_tree_module_src in the module_and_imports structure,
not a dummy.
compiler/prog_item.m:
Do not include a list of foreign_enum items in the interface section
of a parse_tree_module_src, since such items are not allowed to occur
in interface sections.
For the same reason, delete the field for foreign_enums in the interface
sections of .int0 and .int files.
compiler/check_raw_comp_unit.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
compiler/comp_unit_interface.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
Do not expect any foreign_enum items in interface sections, since
they are not allowed there.
compiler/read_modules.m:
Provide a mechanism to remember having read a parse_tree_module_src.
compiler/write_module_interface_files.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
compiler/get_dependencies.m:
Add a new version of an existing utility predicate. The old one operated
on raw item lists, the new one operates on parse_tree_module_srcs.
To make this possible, factor out the code pieces that operate on
each non-ignored kind of item.
compiler/item_util.m:
Add some new utility predicates/functions.
compiler/convert_parse_tree.m:
Conform to the change in prog_item.m. (We already generated an error
message for a foreign_enum item in the interface, but still passed around
a list of foreign_enum items that was guaranteed to be stay empty.)
compiler/make.module_dep_file.m:
Conform to the changes above.
Use explicit streams in one place.
Do not pass an unneeded argument.
compiler/check_parse_tree_type_defns.m:
compiler/equiv_type.m:
compiler/make_hlds_separate_items.m:
Conform to the change in prog_item.m.
compiler/mercury_compile_main.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
Conform to the changes above.
library/map.m:
library/tree234.m:
Add foldl6, foldl6_values and foldr6 predicates. An earlier version
of this diff needed foldl6, and I added the others for symmetry.
NEWS:
Announce the new library predicates.
tests/invalid/bad_mutable.m:
Export something, to avoid a warning about not exporting anything.
tests/invalid_submodules/duplicate_module.m:
tests/invalid_submodules/duplicate_module_test.m:
Update programming style.
|
||
|
|
d3a8ae1d32 |
Delete the cl_maybe_attrs field from clauses.
compiler/prog_item.m:
Delete the cl_maybe_attrs field from clauses, because it was never used.
Put the pred_or_func field before the name field, as we do in other items.
compiler/add_class.m:
compiler/convert_parse_tree.m:
compiler/get_dependencies.m:
compiler/make_hlds_passes.m:
compiler/parse_class.m:
compiler/parse_dcg_goal.m:
compiler/parse_item.m:
compiler/parse_tree_out_clause.m:
compiler/prog_item_stats.m:
compiler/state_var.m:
Conform to the changes above.
compiler/recompilation.version.m:
Conform to the changes above, and fix an old bug that had wrong names
for item_clause_info's fields, and thus tested the wrong set of fields
for equality.
|
||
|
|
8355718b16 |
Allow pred pragmas to specify pred_or_func.
Pragmas that apply to a pred_info have traditionally specified that
pred_info by a symname/arity pair. However, this can be ambiguous
if there is both a predicate and a function with that symname/arity pair.
This diff therefore allows pragmas that previously took "symname/arity"
to also take "pred(symname/arity)" and "func(symname/arity").
If e.g. there is both a pred foo/2 and a func foo/2 accessible from
the current module, the old form applied to both, while the new forms
apply to just one.
Later, we could change the behavior of the old form to insist on a
unique match, but before we do, we should have a mechanism that allows
programmers to resolve the ambiguity. (They could rename either the
pred or the func, but it is less intrusive for the compiler not to
insist on that.) This is that mechanism.
In the process of implementing this change, I had to update lots of code
that dealt with arities, since one main difference between predicates
and functions is that for the latter, the user visible arity and
the internal compiler arity are different, in that the former does not
count the return value, and the latter does. The existing "arity" type
is an equivalence to int, and thus does not indicate which notion is meant.
I therefore added two notag types, user_arity and pred_form_arity,
for the two notions above respectively, and made a start on using them,
though for now, only in the code sections affected by the main change above.
compiler/prog_item.m:
Change the types that represent the specifications of predicates
(in the sense of pred_infos) and functions to allow the representation
of not just "symname/arity," but also "pred(symname/arity)" and
"func(symname/arity"). There is one exception: for the oisu (order
independent state update) pragma, require the presence of either
a pred() vs func() wrapper. This is not a breaking change, since oisu
pragmas are neither publicly documented or really implemented.
Pragmas that allow the representation of argument modes implicitly
specify pred vs func by taking the mode list either as
(m1, m2, ... mn) or as (m1, m2, ...) = mn. Encode this invariant
in the representation type. Make this type also include an arity
only in the absence of a mode list, to make unrepresentable
any inconsistent state in which the stated arity and the length
of the mode list disagree.
Give the new types used for these updated representations names
that state whether they specify a pred_info or a proc_info
(or in one case that we should later fix, that they can specify either).
Put the pred or func indication before the symname and arity
both in these new types, and in some old types. Do this both because
the pred or func indication comes before the name in Mercury declarations,
and to help the compiler find all the places where code using the old
forms had to be revisited and checked for any needed updates.
Provide utility operations on the new types involved in the
updated representations.
compiler/prog_data.m:
Add the user_arity and pred_form_arity types, as mentioned above.
Add a type that is mostly used in item representations, but is also
useful elsewhere.
compiler/parse_pragma.m:
compiler/parse_pragma_analysis.m:
compiler/parse_pragma_foreign.m:
compiler/parse_pragma_tabling.m:
compiler/parse_util.m:
Accept the pred() or func() wrappers mentioned above, and generate
the updated representations when parsing terms containing pragmas.
compiler/parse_tree_out_pragma.m:
Accept the updated representations of pragmas when printing them out.
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
Use the updated representations when adding pragmas to the HLDS.
compiler/error_util.m:
Provide mechanisms for use above when printing references to pred_infos
using user arities, to complement the existing mechanisms which use
arities that they treat as pred form arities. The latter is what
you want when generating error messages about pred_infos that
already included functions' return types in the argument list;
the former is what you want when generating error messages
about user input that has not yet been subject to that treatment,
such as a pragma that has just been read in. (The difference is
only in what form of arity these mechanisms take as *input*;
the output is always user arity, which after all is what users
are interested in.)
compiler/hlds_error_util.m:
Provide a user_arity equivalent to a piece of existing pred_form_arity
functionality, for use by the modules above.
Provide utility functions used when generating error messages.
compiler/fact_table.m:
Replace most uses of the "arity" type with the "user_arity" type.
Done mostly in the process of figuring out which kind of arity
the top predicates took as arguments.
Put argument lists into a sensible order.
compiler/prog_out.m:
compiler/prog_util.m:
Add utility functionality needed above.
compiler/add_mutable_aux_preds.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make_hlds_passes.m:
compiler/module_qual.qualify_items.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/typecheck_errors.m:
compiler/unused_args.m:
Conform to the changes above.
compiler/hlds_pred.m:
Add an XXX.
compiler/notes/order_indep_state_update:
Fix typos.
tests/hard_coded/bad_direct_reuse.m:
tests/hard_coded/bad_indirect_reuse.m:
tests/hard_coded/bitmap_simple.m:
tests/hard_coded/constraint_order.m:
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/fact_table_test_1.m:
tests/hard_coded/float_consistency.m:
tests/hard_coded/foreign_enum_rtti.m:
tests/hard_coded/foreign_enum_switch.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/gh72.m:
tests/hard_coded/gh72a.m:
tests/hard_coded/heap_ref_mask_tag.m:
tests/hard_coded/intermod_multimode.m:
tests/hard_coded/mode_check_clauses.m:
tests/hard_coded/multimode_addr.m:
tests/hard_coded/type_spec_ho_term.m:
tests/hard_coded/user_defined_equality2.m:
Add pred() or func() wrappers to symname/arity pairs in pragmas,
to test whether the parser accepts them.
Fix deviations from our current coding standards.
tests/hard_coded/oisu_check_db.m:
tests/invalid/oisu_check_add_pragma_errors.{m,err_exp}:
tests/invalid/oisu_check_semantic_errors.m:
Add the pred() wrappers now required in oisu pragmas.
Expect the improved wording of an error message.
|
||
|
|
719c3f5e31 |
Use inst_ctor and mode_ctor as keys.
compiler/prog_item.m:
Use inst_ctor and mode_ctor respectively as the key type
in inst_ctor_defn_map and mode_ctor_defn_map respectively.
compiler/convert_parse_tree.m:
compiler/module_qual.collect_mq_info.m:
Conform to the change above.
|
||
|
|
6a345ff5dc |
Make subtypes share low-level data representation with base type.
Make subtypes share data representation with base type when using
low-level data. High-level data grades are unchanged, so subtypes
are still represented with distinct classes from their base types.
----------------
compiler/prog_data.m:
Add abstract_subtype option for type_details_abstract.
Correct XXX comment.
compiler/prog_item.m:
Add type item_type_repn_info_subtype.
Add tcrepn_is_subtype_of option for type_ctor_repn_info.
compiler/equiv_type.m:
Replace equivalences in tcrepn_is_subtype_of.
compiler/module_qual.qualify_items.m:
Module qualify in tcrepn_is_subtype_of.
compiler/prog_type.m:
Rename some predicates that can only work on non-subtype du types.
Update comments.
compiler/check_parse_tree_type_defns.m:
Classify subtype type definitions as std_mer_type_du_subtype
instead of std_mer_type_du_all_plain_constants or
std_mer_type_du_not_all_plain_constants.
Update some comments.
compiler/du_type_layout.m:
Add two sub-passes to handle subtypes.
compiler/comp_unit_interface.m:
Extend this module to handle subtype type definitions,
analogous to the way equivalence type definitions are handled.
Rename some predicates to clarify that they must not be used
to test subtypes.
Record an abstract version of a subtype type definition using
the abstract_subtype option in type_details_abstract.
This allows the super type ctor of the subtype to be known,
and hence the base type ctor, when a subtype is abstract exported.
Update comments.
compiler/decide_type_repn.m:
Extend this module to handle subtype type definitions.
Generate type_representation items for subtype type definitions
which include the super type ctor of the subtype.
compiler/parse_tree_out.m:
Write out abstract_subtype as
"where type_is_abstract_subtype(Name/Arity)" on type definitions.
compiler/parse_type_defn.m:
Parse "type_is_abstract_subtype(Name/Arity)" declarations.
compiler/parse_tree_out_type_repn.m:
Write type_representation items with "is_subtype_of(TypeCtor/Arity)".
compiler/parse_type_repn.m:
Parse "is_subtype_of(TypeCtor/Arity)" in type_representation items.
compiler/add_type.m:
compiler/convert_parse_tree.m:
compiler/opt_debug.m:
compiler/type_util.m:
Conform to changes.
Update comments.
compiler/direct_arg_in_out.m:
Delete XXX, nothing to do.
compiler/parse_util.m:
Rename overly specific variable.
----------------
runtime/mercury_type_info.h:
Add a flag in MR_TypeCtorInfo to indicate if the enum/du layout
array may be indexed by an enum value or du ptag value.
Subtypes break the invariant that the layout array contains entries
for every enum/ptag value from 0 up to the maximum value.
The presence of the flag MR_TYPE_CTOR_FLAG_LAYOUT_INDEXABLE tells
the runtime that it can directly index the layout array instead of
searching through it (which is the common case, for non-subtypes).
Add a field MR_du_ptag to MR_DuPtagLayout. This is necessary to find
an entry for a given primary tag value in a MR_DuPtagLayout array.
Add a field MR_du_ptag_flags to MR_DuPtagLayout, currently with one
possible flag MR_DU_PTAG_FLAG_SECTAG_ALTERNATIVES_INDEXABLE.
As with primary tags, subtypes break the invariant that the
sectag_alternatives array contains entries for every secondary tag
value from 0 up to the maximum value. The presence of the flag tells
the runtime that it can directly index the sectag_alternatives array
(which is the common case, for non-subtypes).
The two fields added to MR_DuPtagLayout occupy space that was
previously padding, so the size of MR_DuPtagLayout is unchanged.
In MR_EnumFunctorDesc, replace the MR_enum_functor_ordinal field by
MR_enum_functor_value, i.e. the integer value representing the
functor in memory. Storing *both* the functor ordinal and enum value
would increase the size of the MR_EnumFunctorDesc struct, and would
be redundant in the common case of non-subtype enums (both fields
would contain equal values). We forgo having the functor ordinal
directly available, at the cost of needing to search through an
MR_EnumFunctorDesc array when a functor ordinal is required for a
subtype enum, which should be rare.
compiler/rtti.m:
Swap enum "functor ordinal" and "value" in places.
Use a type 'enum_value' to try to ensure we do not mix up enum
functor ordinals and enum values.
Add code to encode the MR_TYPE_CTOR_FLAG_LAYOUT_INDEXABLE flag.
Add code to encode the MR_DU_PTAG_FLAG_SECTAG_ALTERNATIVES_INDEXABLE
flag.
compiler/rtti_out.m:
Write out "enum_ordinal_ordered_tables" ordered by functor ordinals
instead of "enum_value_ordered_tables" ordered by enum values.
Output the enum value for MR_EnumFunctorDesc instead of functor
ordinal.
Output the MR_du_ptag and MR_du_ptag_flags fields for
MR_DuPtagLayout.
Relax sanity check on primary tags. A subtype may not necessarily
use ptag 0, and may skip ptag values.
compiler/rtti_to_mlds.m:
Generate "enum_ordinal_ordered_tables" instead of
"enum_value_ordered_tables".
Fill in the enum value for a MR_EnumFunctorDesc instead of
the functor ordinal.
compiler/type_ctor_info.m:
Add predicate to generate the MR_du_ptag_flags field.
Add the MR_TYPE_CTOR_FLAG_LAYOUT_INDEXABLE flag to type_ctor_infos
when appropriate.
Bump the type_ctor_info_rtti_version.
----------------
runtime/mercury_ml_expand_body.h:
Search through an enum layout array to find the matching enum value,
unless the array can be indexed.
Search through a ptag layout array to find the matching ptag value,
unless the array can be indexed.
Search through a sectag_alternatives array to find the matching
secondary tag value, unless the array can be indexed.
Factor out the code to search through a foreign enum layout array
into a separate macro.
runtime/mercury_construct.c:
runtime/mercury_construct.h:
Add a functor_ordinal field to the MR_Construct_Info_Struct.
This will hold the functor ordinal now that it is not available in
MR_EnumFunctorDesc.
Make MR_get_functors_check_range take an argument to indicate if the
functor_ordinal field needs to be filled in properly. Most callers
do not need the field.
library/construct.m:
Conform to changes to MR_get_functors_check_range and
MR_EnumFunctorDesc.
-------------------
runtime/mercury_dotnet.cs.in:
Modify RTTI classes for C# backend, analogous to the changes for the
C runtime.
Add methods to index/search through enum layout arrays, ptag layout
arrays, and sectag_alternatives arrays.
java/runtime/DuPtagLayout.java:
java/runtime/EnumFunctorDesc.java:
java/runtime/TypeCtorInfo_Struct.java:
Modify RTTI classes for Java backend, analogous to the changes for the
C runtime.
Add methods to index/search through enum layout arrays, ptag layout
arrays, and sectag_alternatives arrays.
library/rtti_implementation.m:
Conform to MR_EnumFunctorDesc field change.
Index or search through the enum layout array or ptag layout array
based on the MR_TYPE_CTOR_FLAG_LAYOUT_INDEXABLE flag.
Index or search through the sectag_alternatives array depending on
the MR_DU_PTAG_FLAG_SECTAG_ALTERNATIVES_INDEXABLE flag.
Add separator lines.
Slightly reorder some code.
----------------
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/subtype_pack.m:
tests/hard_coded/subtype_pack_2.m:
tests/hard_coded/subtype_pack.exp:
tests/hard_coded/subtype_rtti.m:
tests/hard_coded/subtype_rtti.exp:
tests/hard_coded/subtype_rtti.exp2:
Add test cases.
|
||
|
|
b0d147b057 |
Don't compute has_main/no_main.
That info hasn't been used in a long time (since we deleted the IL backend,
according to an old comment).
compiler/module_imports.m:
Delete the has_main field from the module_and_imports structure.
compiler/convert_parse_tree.m:
compiler/get_dependencies.m:
Don't look for main/2.
compiler/make.module_dep_file.m:
When reading in module_dep structures, ignore the contents of the
no_main/has_main field. The value in that field used to be stored
elsewhere, but it was never used.
When writing out module_dep structures, always put "no_main"
into the no_main/has_main field.
Add comments describing possible changes to the on-disk module_dep
structure.
compiler/grab_modules.m:
Conform to the changes above.
|
||
|
|
a19a5f0267 |
Delete the Erlang backend from the compiler.
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.
|
||
|
|
4ec34ffcbb |
Delete default names from clauses in .opt files.
library/varset.m:
Provide a capability to delete the names of variables,
either individually, or en masse.
Unrelated change: replace two clauses with a switch.
NEWS:
Document the new functionality in varset.m.
compiler/convert_parse_tree.m:
Use the new functionality to delete the name of every variable
that has a default name in a clause in a .opt file. Document why
we do this.
|
||
|
|
ac466a3531 |
Avoid almost all conversions to parse_tree_int.
For a while now, we have been generating interface files into
file-kind-specific parse trees, but we then converted those into
the generic parse_tree_int type for further processing, because
the old code for doing that further processing operated on
parse_tree_ints. This diff replaces most of that "further processing"
code with code that operates on int-file-kind-specific parse trees,
thus avoiding the cost of conversion. The main cost is not performance
(the effect of this change on compiler speed is negligible), but loss
of code clarity through the loss of invariants.
compiler/comp_unit_interface.m:
After generating a parse_tree_intN for N in {0,1,2,3}, do NOT convert it
to a generic parse_tree_int.
When constructing a parse_tree_int3 from a raw_compilation_unit,
guard against a situation where we could unintentionally create
a duplicate of an abstract type definition. The solution here
is not the most elegant possible, but a better one requires other
changes that don't really fit in this diff.
compiler/canonicalize_interface.m:
Put two large blocks of code (dealing with the canonicalization
of pred and mode declarations respectively) into their own predicates.
Expose a mechanism to standardize not the contents of a whole
interface file, but just the predicate and mode declarations in it.
(These are the tricky kinds of items to canonicalize, because sorting
a set of mode declarations can change the meaning of the program.)
This mechanism is just a specialized version of the existing machinery.
Since this diff leaves the existing machinery unused, the next diff
will delete it, and since that will probably leave a too-small module,
delete the whole module, after moving the remaining small piece of code
to the only module that uses it, parse_tree_out.m.
compiler/parse_module.m:
Instead of implementing actually_read_module_intN in terms of
actually_read_module_int, do the reverse, which avoids the unnecessary
conversion from parse_tree_intN to parse_tree_int.
compiler/parse_tree_out.m:
Provide predicates, output_parse_tree_intN, to write out parse_tree_intN,
not just a generic parse_tree_int.
Change the existing service routines, mercury_output_parse_tree_intN,
that do all the work of the above new predicates to write out the contents
of each parse tree in the canonical order, using the newly exposed
functionality in canonicalize_interface.m where needed. (Previously,
write_module_interface_files.m invoked canonicalize_interface.m to do this
before calling parse_tree_out.m.)
These service routines were originally written for debugging; make them
suitable for creating proper .intN files by removing unneeded output.
compiler/write_module_interface_files.m:
Call the newly provided predicates in parse_tree_out.m to output
interface files. To make this possible, break up the old predicate
actually_write_interface_file into smaller predicates, so that the
new predicates actually_write_interface_fileN can each call whichever
of these are relevant for the given interface-file-kind. (Some pieces
are relevant to only a subset of these kinds.)
compiler/convert_parse_tree.m:
Note the reason why this diff is not deleting the functions that convert
parse_tree_intN to parse_tree_int.
compiler/read_modules.m:
Note the reason why this diff is not deleting the functions that read in
generic parse_tree_ints.
|
||
|
|
3a1ed2efcb |
Replace simple_call_id with pf_sym_name_arity.
compiler/prog_data.m:
Delete the simple_call_id data type, since it is isomorphic
to the pf_sym_name_arity type, which more clearly specifies
what is stored inside it.
compiler/prog_out.m:
Rename (all three versions of) simple_call_id_to_string to
pf_sym_name_orig_arity_to_string, both to conform to the change
in the input data type, and to emphasize that the resulting string
will contain the *original* arity of functions (which does not include
the return value), which is one less than the arity in the
pf_sym_name_arity structure (which, in accordance with the
convention inside the compiler that the arity is the length
of the argument list, *does* include the return value).
Delete the provision inside simple_call_id_to_string, now
pf_sym_name_orig_arity_to_string, for special handling of the names
of the predicates we use to implement promises, because it seems that
*none* of the call sites to any of the three versions of this function
can actually pass to it the identity of such a predicate. These calls
refer to a predicate or mode declaration item (which promise predicates
do not have), to clause or foreign_proc items (which again, promise
predicates cannot have) or calls to the predicate (promise predicates
cannot be called).
Delete the exported predicate simple_call_id_to_sym_name_arity.
It was called from exactly one place, inside prog_out.m itself,
and this diff inlines that call.
Avoid unnecessary forwarding of work from prog_out.m to error_util.m.
Delete (all three versions of) write_simple_call_id. The changes
below replace all their (few) uses with calls to
pf_sym_name_orig_arity_to_string.
compiler/error_util.m:
Replace the simple_call() error piece with qual_pf_sym_name_orig_arity,
and add a new version unqual_pf_sym_name_orig_arity. Their names
explicitly say that they print the original arities of functions,
also say whether they strip away any module qualification on the
sym_name inside the pf_sym_name_arity. We prefer the unqual version
in situations where the module qualifier is implicit, which usually means
that it must be the same as the name of the module being compiled, because
it reduces visual clutter for readers of error messages.
Put {qual,unqual}_pf_sym_name_orig_arity next to their most closely
related function symbols, {qual,unqual}_sym_name_arity, in the
format_component type. (This yields a few inconsequential changes
in the order of error_specs when sorted.)
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_typeclass.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/goal_expr_to_goal.m:
compiler/hlds_data.m:
compiler/hlds_desc.m:
compiler/hlds_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/inst_util.m:
compiler/llds_out_instr.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_error.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/ml_unify_gen_construct.m:
compiler/mlds_to_c_stmt.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/modecheck_util.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_item.m:
compiler/parse_module.m:
compiler/parse_type_repn.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/pre_quantification.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/recompilation.version.m:
compiler/term_constr_build.m:
compiler/termination.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unused_imports.m:
Conform to the changes above. Where I am pretty sure that in an error
message, the module qualifier of a name must be the current module,
use unqual_pf_sym_name_orig_arity instead of qual_pf_sym_name_orig_arity.
Add some sanity checks where they seem appropriate.
Replace sequences of io.write_strings with uses of io.format where this
yields clearer code. (This is why there were no remaining calls to
write_simple_call_id.)
Shorten some too-long lines.
In add_pred.m, make the order of some predicate definitions match
the order of the calls to them.
tests/invalid/ambiguous_method.err_exp:
tests/invalid/ambiguous_method_2.err_exp:
tests/invalid/bad_pred_arity.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bigtest.err_exp:
tests/invalid/bug113.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug410.err_exp:
tests/invalid/bug476.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/complex_constraint_err.err_exp:
tests/invalid/constrained_poly_insts.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/exported_mode.err_exp:
tests/invalid/field_syntax_error.err_exp:
tests/invalid/foreign_singleton.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/imported_mode.err_exp:
tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/make_opt_error.err_exp:
tests/invalid/missing_det_decls.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/ref_to_implicit_pred.err_exp:
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.err_exp2:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.err_exp2:
tests/invalid/require_tailrec_3.err_exp:
tests/invalid/require_tailrec_3.err_exp2:
tests/invalid/state_vars_test2.err_exp:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_constraint_extra_var.err_exp:
tests/invalid/typeclass_mode_2.err_exp:
tests/invalid/typeclass_test_12.err_exp:
tests/invalid/typeclass_test_2.err_exp:
tests/invalid/typeclass_test_9.err_exp:
tests/invalid/types.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/unbound_type_vars.err_exp:
tests/invalid/with_type.err_exp:
tests/invalid_purity/purity_nonsense.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
tests/warnings/double_underscore.exp:
tests/warnings/pragma_source_file.exp:
tests/warnings/singleton_test.exp:
tests/warnings/singleton_test.exp2:
tests/warnings/singleton_test.exp3:
tests/warnings/singleton_test.exp4:
tests/warnings/singleton_test_state_var.exp:
tests/warnings/warn_return.exp:
tests/warnings/warn_return.exp2:
tests/warnings/warn_return.exp3:
tests/warnings/warn_succ_ind.exp:
tests/warnings/warn_succ_ind.exp2:
tests/warnings/warn_succ_ind.exp3:
tests/warnings/warn_succ_ind.exp4:
Update all these expected output files. Most changes are due to
predicate and function names no longer being module qualified when
the module qualification is obvious. A few changes are due to the
change in the relative ordering of the function symbols of the
format_component type.
For singleton_test, warn_return and warn_succ_ind in warnings,
the changes to the non-C .exp files were done by hand, so they
may have the wrong white space.
|
||
|
|
5c52cf0cde |
Standardize on "sym_name_arity" ...
... replacing "sym_name_AND_arity". |
||
|
|
7ca352eb8e | Delete some unused predicates. | ||
|
|
9789375cc5 |
Make pre-HLDS passes use file-kind-specific parse trees.
Replacing item blocks file-kind-specific kinds of section markers with
file-kind-specific parse trees has several benefits.
- It allows us to encode the structural invariants of each kind of file
we read in within the type of its representation. This makes the detection
of any accidental violations of those invariants trivial.
- Since each file-kind-specific parse tree has separate lists for separate
kinds of items, code that wants to operate on one or a few kinds of items
can just operate on those kinds of items, without having to traverse
item blocks containing many other kinds of items as well. The most
important consequence of this is not the improved efficiency, though
that is nice, but the increased clarity of the code.
- The new design is much more flexible. For example, it should be possible
to record that e.g. an interface file we read in as a indirect dependency
(i.e. a file we read not because its module was imported by the module
we are compiling, but because its module was imported by *another* imported
module) should be used *only* for the purpose it was read in for. This should
avoid situations where deleting an import of A from a module, because it
is not needed anymore, leads the compiler to generate an error message
about a missing import of module B. This can happen if (a) module B
always *should* have been imported, since it is used, but (b) module A's
import of module B lead to module B's interface being available *without*
an import of B.
Specifically, this flexibility should enable us to establish each module's
.int file as the single source of truth about how values of each type
defined in that module should be represented. When compiling each source
file, this approach requires the compiler to read in that module's .int file
but using only the type_repn items from that .int file, and nothing else.
- By recording a single parse tree for each file we have read, instead of
a varying number of item blocks, it should be significantly easier to
derive the contents of .d files directly from the records of those
parse trees, *without* having to maintain a separate set of fields
in the module_and_imports structure for that purpose. We could also
trivially avoid any possibility of inconsistencies between these two
different sources of truth. (We currently fill in the fields used to
drive the generation of .d files using two different pieces of code,
one used for --generate-dependencies and one used for all other invocations,
and these two *definitely* generate inconsistent results, as the significant
differences in .d files between (a) just after an invocation of
--generate-dependencies and (b) just after any other compiler invocation
can witness.)
This change is big and therefore hard to review. Therefore in many files,
this change adds "XXX CLEANUP" comments to draw attention to places that
have issues that should be fixed, but whose fixes should come later, in
separate diffs.
compiler/module_imports.m:
The compiler uses the module_and_imports structure defined here
to go from a raw compilation unit (essentially a module to be compiled)
to an augmented compilation unit (a raw compilation unit together
with all the interface and optimization files its compilation needs).
We used to store the contents of both the source file and of
the interface and optimization files in the module_and_imports structure
as item blocks. This diff replaces all those item blocks with
file-kind-specific parse trees, for the reasons mentioned above.
Separate out the .int0 files of ancestors modules from the .intN
files for N>0 of directly imported modules. (Their item blocks
used to be stored in the same list.)
Maintain a database of the source, interface and optimization files
we have read in so far. We use it to avoid reading in interface files
if we have already read in a file for the same module that contains
strictly more information (either an interface file with a smaller
number as a suffix, or the source file itself).
Shorten some field names.
compiler/prog_item.m:
Define data structures for storing information about include_module,
import_module and use_module declarations, both in a form that allows
the representation of possibly erroneous code in actual source files,
and in checked-and-cleaned-up form which is guaranteed to be free
of the relevant kinds of errors. Add a block comment at the start
of the module about the need for this distinction.
Define parse_tree_module_src, a data structure for representing
the source code of a single module. This is different from the existing
parse_tree_src type, which represents the contents of a single source file
but which may contain *more* than one module, and also different from
a raw_compilation_unit, which is based on item blocks and is thus
unable to express to invariants such as "no clauses in the interface".
Modify the existing parse_tree_intN types to express the distinction
mentioned just above, and to unify them "culturally", i.e. if they
store the same information, make them store it using the same types.
Fix a mistake by allowing promises to appear in .opt files.
I originally ruled them out because the code that generates .opt files
does not have any code to write out promises, but some of the predicates
whose clauses it writes out have goal_type_promise, which means that
they originated as promises, and get written out as promises.
Split the existing pragma item kind into three item kinds, which have
different invariants applying to them.
- The decl (short for declarative) pragmas give the compiler some
information, such as that a predicate is obsolete or that we
want to type specialize some predicate or function, that is in effect
part of the module's interface. Decl pragmas may appear in module
interfaces, and the compiler may put them into interface files;
neither statement is true of the other two kinds of pragmas.
- The impl (short for implementation) pragmas are named so
precisely because they may appear only in implementation sections.
They give the compiler information that is private to that module.
Examples include foreign_decls, foreign_codes, foreign_procs,
and promises of clause equivalence, and requests for inlining,
tabling etc. These will never be put into interface files,
though some of them can affect the compilation of other modules
by being included in .opt files.
- The gen (short for generated) pragmas can never (legally) appear
in source files at all. They record the results of compiler
analyses e.g. about which arguments of a predicate are unused,
or what exceptions a function can throw, and accordingly they
should only ever occur in compiler-generated interface files.
Use the new type differences between the three kinds of pragmas
to encode the above invariants about which kinds of pragmas can appear
where into the various kinds of parse trees.
Make the augmented compilation unit, which is computed from
the final module_and_imports structure, likewise switch from
storing item blocks to storing the whole parse trees of the
files that went into its construction. With each such parse tree,
record *why* we read it, since this controls what permissions
the source module being compiled has for access to the entities
in the parse tree.
Simplify the contains_foreign_code type, since one of three
function symbols was equivalent to one possible use of another
function symbol.
Provide a way to record which method of which class a compiler-generated
predicate is for. (See hlds_pred.m below.)
Move the code of almost all utility operations to item_util.m
(which is imported by many fewer modules than prog_item.m),
keeping just the most "popular" ones.
compiler/item_util.m:
Move most of the previously-existing utility operations here from
prog_item.m, most in a pretty heavily modified form.
Add a whole bunch of other utility operations that are needed
in more than one other module.
compiler/convert_parse_tree.m:
Provide predicates to convert from raw compilation units to
parse_tree_module_srcs, and vice versa (though the reverse
shouldn't be needed much longer).
Update the conversion operations between the general parse_tree_int
and the specific parse_tree_intN forms for the changes in prog_item.m
mentioned above. In doing so, use a consistent approach, based on
new operations in item_util.m, to detect errors such as duplicate
include_module and import/use_module declarations in all kinds
of parse trees.
Enforce the invariants that the types of parse trees of various kinds
can now express in types, generating error messages for their violations.
Delete some utility operations that have been moved to item_util.m
because now they are also needed by other modules.
compiler/grab_modules.m:
Delete code that did tests on raw compilation units that are now done
when that raw compilation unit is converted to a parse_tree_module_src.
Use the results of the checks done during that conversion to decide
which modules are imported/used and in which module section.
Record a single reason for why we reading in each interface and
optimization file. The code of make_hlds_separate_items.m will use
this reason to set up the appropriate permissions for each item
in those files.
Use separate code for handling different kinds of interface and
optimization files. Using generic traversal code was acceptable economy
when we used the same data structure for every kind of interface file,
but now that we *can* express different invariants for different kinds
of interface and optimization file, we want to execute not just different
code for each kind of file, but the data structures we want to work on
are also of different types. Using file-kind-specific code is a bit
longer, but it is significantly simpler and more robust, and it is
*much* easier to read and understand.
Delete the code that separates the parts of the implementation section
that are exported to submodules, and the part that isn't, since that task
is now done in make_hlds_separate_items.m.
Pass a database of the files we have read through the relevant predicates.
Give some predicates more meaningful names.
compiler/notes/interface_files.html:
Note a problem with the current operation of grab_modules.
compiler/get_dependencies.m:
Add operations to gather implicit references to builtin modules
(which have to be made available even without an explicit import_module
or use_module declaration) in all kinds of parse trees. These have
more code overall, but will be at runtime, since we need only look at
the item kinds that may *have* such implicit references.
Add a mechanism to record the result of these gathering operations
in import_and_or_use_maps.
Give some types, function symbols, predicates and variables
more meaningful names.
compiler/make_hlds_separate_items.m:
When we stored the contents of the source module and the
interface and optimization files we read in to augment it
in the module_and_imports structure as a bunch of item blocks,
the job of this module was to separate out the different kinds of items
in the item blocks, returning a single list of each kind of item,
with each such item being packaged up with its status (which encodes
a set of permissions saying what the source module is allowed
to do with it).
Now that the module_and_imports structure stores this info in
file-kind-specific parse trees, all of which have separate lists
for each kind of item and none of which contain item blocks,
the job of this module has changed. Now its job is to convert
the reason why each file was read in into the (one or more) statuses
that apply to the different kinds of items stored in it, wrap up
each item with its status, and return the resulting overall list
of status/item pairs for each kind of item.
compiler/read_modules.m:
Add predicates that, when reading an interface file, return its contents
in the tightest possible file-kind-specific parse tree.
Refine the database of files we have read to allow us to store
more file-kind-specific parse trees.
Don't require that files in the database have associated timestamps,
since in some cases, we read files we can put into the database
*without* getting their timestamps.
Allow the database to record that an attempt to read a file failed.
compiler/split_parse_tree_src.m:
Rearchitect how this module separates out nested submodules from within
the main module in a file.
Another of the jobs of this module is to generate error messages for
when module A includes module B twice, whether via nesting or via
include_module declarations, with one special exception for the case
where A's interface contains nested submodule A.B's interface,
and A's implementation contains nested submodule A.B's implementation.
The problem ironically was that while it reported duplicate include_module
declarations as errors, split_parse_tree_src.m also *generated*
duplicate include_module declarations. Since it replaced each nested
submodule occurrence with an include_module declaration, in the scenario
above, it generated two include_module declarations for A.B. Even worse,
the interface incarnation of submodule A.B could contain
(the interface of) its own nested submodule A.B.C, while its
implementation incarnation could contain (the implementation section of)
A.B.C. Each occurrence of A.B.C would be its only occurrence in the
including part of its parent A.B, which means local tests for duplicates
do not work. (I found this out the hard way.)
The solution we now adopt adds include_module declarations to the
parents of any submodule only once the parse tree of the entire
file has been processed, since only then do we know all the
includer/included relationships among nested modules. Until then,
we just record such relationships in a database as we discover them,
reporting duplicates when needed (e.g. when A includes B twice
*in the same section*), but not reporting duplicates when not needed
(e.g. when A.B includes A.B.C in *different* sections).
compiler/prog_data.m:
Add a new type, pf_sym_name_and_arity, that exactly specifies
a predicate or function. It is a clone of the existing simple_call_id
type, but its name does NOT imply that the predicate or function
is being called.
Add XXXs that call for some other improvements in type names.
compiler/prog_data_foreign.m:
Give a type, and the operations on that type, a more specific name.
compiler/error_util.m:
Add an id field to all error_specs, which by convention should be
filled in with $pred. Print out the value in this field if the compiler
is invoked with the developer-only option --print-error-spec-id.
This allows a person debugging the compiler find out where in the code
an undesired error message is coming from significantly easier
than was previously possible.
Most of the modules that have changes only "to conform to the changes
above" will be for this change. In many cases, the updated code
will also simplify the creation of the affected error_specs.
Fix a bug that looked for a phase in only one kind of error_spec.
Add some utility operations needed by other parts of this change.
Delete a previously internal function that has been moved to
mdbcomp/prim_data.m to make it accessible in other modules as well.
compiler/Mercury.options:
Ask the compiler to warn about dead predicates in every module
touched by this change (at least in one its earlier versions).
compiler/add_foreign_enum.m:
Replace a check for an inappropriately placed foreign_enum declaration
with a sanity check, since with this diff, the error should be caught
earlier.
compiler/add_mutable_aux_preds.m:
Delete a check for an inappropriately placed mutable declaration,
since with this diff, the error should be caught earlier.
compiler/add_pragma.m:
Instead of adding pass2 and pass3 pragmas, add decl and impl and
generated pragmas.
Delete the tests for generated pragma occurring anywhere except
.opt files, since those tests are now done earlier.
Shorten some too-long predicate names.
compiler/comp_unit_interface.m:
Operate on as specific kinds of parse trees as the interface of this
module will allow. (We could operate on more specific parse trees
if we changed the interface, but that is future work).
Use the same predicates for handling duplicate include_module,
import_module and use_module declarations as everywhere else.
Delete the code of an experiment that shouldn't be needed anymore.
compiler/equiv_type.m:
Replace code that operated on item blocks with code that operates
on various kinds of parse trees.
Move a giant block of comments to the front, where it belongs.
compiler/hlds_module.m:
Add a field to the module_info that lets us avoid generating
misleading error messages above missing definitions of predicates
or functions when those definitions were present but were not
added to the HLDS because they had errors.
Give a field and its access predicates a more specific name.
Mark a spot where an existing type cannot express everything
it is supposed to.
compiler/hlds_pred.m:
For predicates which the compiler creates to represent a class method
(the virtual function, in OOP terms), record not just this fact,
but the id of the class and of the method. Using this extra info
in progress messages (with mmc -V) prevents the compiler from printing e.g.
% Checking typeclass constraints on class method
% Checking typeclass constraints on class method
% Checking typeclass constraints on class method
when checking three such predicates.
compiler/make.m:
Provide a slot in the make_info structure to allow the database
of the files we have read in to be passed around.
compiler/make_hlds_error.m:
Delete predicates that are needed in just one other module,
and have therefore been moved there.
compiler/make_hlds_passes.m:
Add decl, impl and generated pragma separately, instead of adding
pass2 and pass3 pragmas separately.
Do not generate error messages for clauses, initialises or finalises
in module interfaces, since with this diff, such errors should be
caught earlier.
compiler/mercury_compile_main.m:
compiler/recompilation.check.m:
Explicitly pass around the expanded database of parse trees
of files that have been read in.
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.m:
compiler/module_qual.qualify_items.m:
Collect module qualification information, and do module qualification
respectively on parse trees of various kinds, not item blocks.
Take information about what the module may do with the contents
of each interface or optimization file from the record of why
we read that file, not from the section markers in item blocks.
Break up some too-large predicates by carving smaller ones out of them.
compiler/options.m:
Add an option to control whether errors and/or warnings detecting
when deciding what should go into a .intN file be printed,
thus (potentially) preventing the creation of that file.
Add commented-out documentation for a previously totally undocumented
option.
doc/user_guide.texi:
Document the new option.
NEWS:
Announce the new option.
Mention that we now generate warnings for unused import_module and
use_module declarations in the interface even if the module has
submodules.
compiler/write_module_interface_files.m:
Let the new option control whether we filter out any messages generated
when deciding what should go into a .intN file.
compiler/parse_item.m:
Delete actually_read_module_opt, since it is no longer needed;
its callers now call actually_read_module_{plain,trans}_opt instead.
Delete unneeded arguments from some predicates.
compiler/parse_module.m:
Delete some long unused predicates.
compiler/parse_pragma.m:
When parsing pragmas, wrap them up in the new decl, impl or generated
pragma kinds.
compiler/parse_tree_out.m:
Add predicates to write out each of the file-kind-specific parse trees.
compiler/parse_tree_out_pragma.m:
Add predicates to write out decl, impl and generated pragmas.
compiler/polymorphism.m:
Add a conditionally-enabled progress message, which can be useful
in tracking down problems.
compiler/prog_item_stats.m:
Conform NOT to the changes above beyond what is needed to let this module
compile. Let that work be done the next time the functionality of
this module is needed, by which time the affected data structures
maybe have changed further.
compiler/typecheck.m:
Fix a performance problem. With intermodule optimization, we read in
.opt files, some of which (e.g. list.opt and int.opt) contain promises.
These promises are read in as predicates with goal_type_promise,
but they do not have declarations of the types of their arguments
(since promises do not have declarations as such). Those argument types
therefore have to be inferred. That inference replaces the original
"I don't know" argument types with their actual types.
The performance problem is that when we change the recorded argument types
of a predicate, we require another loop over all the predicates in the
module, so that any calls to this predicate can be checked against
the updated types. This is as it should be for callable predicates,
but promises are not callable. So if all the *only* predicates whose
recorded argument types change during the first iteration to fixpoint
are promises, then a second iteration is not needed, yet we used to do it.
The fix is to replace the "Have the recorded types of this predicate
changed?" boolean flag with a bespoke enum that says "Did the checking
of this predicate discover a need for another iteration", and not
setting it when processing predicates whose type is goal_type_promise.
compiler/typecheck_errors.m:
Do not generate an error message for a predicate missing its clauses
is the clauses existed but were not added to the HLDS because they were
in the interface section.
When reporting on ambiguities (when a call can match more than one
predicate or function), sort the possible matches before reporting
them.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/canonicalize_interface.m:
compiler/check_for_missing_type_defns.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_raw_comp_unit.m:
compiler/check_typeclass.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/compiler_util.m:
compiler/dead_proc_elim.m:
compiler/deps_map.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/du_type_layout.m:
compiler/field_access.m:
compiler/find_module.m:
compiler/float_regs.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/handle_options.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/introduce_parallelism.m:
compiler/layout_out.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_top_gen.m:
compiler/mmakefiles.m:
compiler/mode_errors.m:
compiler/mode_robdd.equiv_vars.m:
compiler/modes.m:
compiler/module_qual.qual_errors.m:
compiler/oisu_check.m:
compiler/old_type_constraints.m:
compiler/options_file.m:
compiler/parse_class.m:
compiler/parse_dcg_goal.m:
compiler/parse_goal.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_inst_mode_name.m:
compiler/parse_mutable.m:
compiler/parse_sym_name.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_type_repn.m:
compiler/parse_types.m:
compiler/parse_util.m:
compiler/parse_vars.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/prog_event.m:
compiler/prog_mode.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/recompilation.version.m:
compiler/resolve_unify_functor.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_proc.m:
compiler/state_var.m:
compiler/stratify.m:
compiler/style_checks.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_errors.m:
compiler/term_errors.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
Conform to the changes above.
mdbcomp/prim_data.m:
Move a utility function on pred_or_funcs here from a compiler module,
to make it available to other compiler modules as well.
scripts/compare_s1s2_lib:
A new script that helped debug this diff, and may help debug
similar diffs the future. It can compare (a) .int* files, (b) .*opt
files, (c) .mh/.mih files or (d) .c files between the stage 1 and
stage 2 library directories. The reason for the restriction
to the library directory is that any problems affecting the
generation of any of these kinds of files are likely to manifest
themselves in the library directory, and if they do, the bootcheck
won't go on to compile any of the other stage 2 directories.
tests/debugger/breakpoints.a.m:
tests/debugger/breakpoints.b.m:
Move import_module declarations to the implementation section
when they are not used in the interface. Until now, the compiler
has ignored this, but this diff causes the compiler to generate
a warning for such misplaced import_module declarations even modules
that have submodules. The testing of such warnings is not the point
of the breakpoints test.
tests/invalid/Mercury.options:
Since the missing_interface_import test case tests error messages
generated during an invocation of mmc --make-interface, add the
new option that *allows* that invocation to generate error messages.
tests/invalid/ambiguous_overloading_error.err_exp:
tests/invalid/max_error_line_width.err_exp:
tests/warnings/ambiguous_overloading.exp:
Expect the updated error messages for ambiguity, in which
the possible matches are sorted.
tests/invalid/bad_finalise_decl.m:
tests/invalid/bad_initialise_decl.m:
Fix programming style.
tests/invalid/bad_item_in_interface.err_exp:
Expect an error message for a foreign_export_enum item in the interface,
where it should not be.
tests/invalid/errors.err_exp:
Expect the expanded wording of a warning message.
tests/invalid/foreign_enum_invalid.err_exp:
Expect a different wording for an error message. It is more "standard"
but slightly less informative.
tests/invalid_submodules/children2.m:
Move a badly placed import_module declaration, to avoid having
the message the compiler now generates for it from affecting the test.
tests/submodules/parent2.m:
Move a badly placed import_module declaration, to avoid having
the message the compiler now generates for it from affecting the test.
Update programming style.
|
||
|
|
6245b6e54d |
Allow reading parse_tree_{plain,trans}_opt.
compiler/prog_item.m:
Fix a bug: provide a slot for foreign_procs in parse_tree_plain_opts.
Eliminate unnecessary differences between parse_tree_{plain,trans}_opt
and parse_tree_int[0123].
compiler/parse_module.m:
As a temporary measure for testing,
- convert every .opt and .trans_opt file read in from its generic
parse_tree_opt representation to its specific parse_tree_plain_opt
or parse_tree_trans_opt representation, in order to check for
items that should not occur in the purpose-specific representations,
- and then convert it back.
Provide (not yet used) predicates for reading in optimization files
into their specific parse tree formats. These do the first conversion
but not the second.
compiler/parse_tree_out.m:
Add predicates for writing out parse_tree_{plain,trans}_opt directly,
without conversion to a generic opt file.
compiler/convert_parse_tree.m:
Make the above possible by adding conversions to and from
parse_tree_{plain,trans}_opt.
Give exported predicates more expressive names.
compiler/comp_unit_interface.m:
compiler/intermod.m:
Conform to the changes above.
compiler/add_pred.m:
compiler/grab_modules.m:
Minor style improvements.
compiler/add_foreign_proc.m:
Fix the wording of an error message.
tests/invalid/fp_dup_bug.err_exp:
Expect the updated wording.
|
||
|
|
09a95acca2 | Add forgotten file. |