mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
7dccb03be114fbbc0b6c514b7f7fc94696e42487
58 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d5ed3079de |
Carve type_inst_mode_map.m out of convert_parse_tree.m.
compiler/convert_parse_tree.m:
compiler/type_inst_mode_map.m:
As above.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Add the new module to the parse_tree package, and document it.
compiler/comp_unit_interface.m:
compiler/recompilation.version.m:
Conform to the changes above.
|
||
|
|
ca20c38987 |
Split --warn-redundant-code from --warn-simple-code.
compiler/options.m:
Move --warn-simple-code to the "warnings about dodgy code"
category, as
- most of the issues that it warns about are indeed evidence
of dodgy code, and
- its existing documentation also states that it is intended
to report likely-to-be-incorrect code.
Change the internal name of --warn-simple-code, in order to force
all its existing uses to be reclassified.
Let the --warn-redundant-code part stay in the style issues category,
since the code will work just the same if the redundancies are removed.
NEWS.md:
Announce the new option.
compiler/simplify_goal_call.m:
Reclassify all uses of --warn-simple-code.
Add a missing condition in an if-then-else.
compiler/add_clause.m:
compiler/add_type.m:
compiler/check_type_inst_mode_defns.m:
compiler/convert_import_use.m:
compiler/convert_parse_tree.m:
compiler/det_analysis.m:
compiler/det_infer_goal.m:
compiler/mercury_compile_front_end.m:
compiler/mode_errors.m:
compiler/simplify_goal.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_info.m:
compiler/simplify_tasks.m:
compiler/state_var.m:
Reclassify all uses of --warn-simple-code.
tests/warnings/help_text.err_exp:
Expect the updated help text.
|
||
|
|
823de2d37b |
Require warning/info messages to specify an option.
The objective of this step is two-fold:
- to fix --inhibit-warnings, making it shut up all warning
and informational messages; and
- to ensure that it *stays* fixed, even when after new diagnostics
are added.
As part of this fix, this diff adds a whole bunch of new warning
options, in order to control the warnings that previously were
not controlled by any option. (There was no need for new
informational options.)
As it happens, we have long used severity_informational for messages
that did not report any information about the code being compiled,
but to report actions that the compiler was taking. Create a new
option category, oc_report, for the new options that now control
those diagnostics.
---------------------
compiler/error_spec.m:
Change severity_warning and severity_informational to take an option
as as argument. The semantics is that the diagnostic in which
the severity occurs is conditional on that option, meaning that
it is printed only if that option is set to "yes".
Delete the severity_conditional function symbol from the severity
type, since the mechanism just above handles its only use case.
Define subtypes to represent error_specs in a standard form.
compiler/error_sort.m:
Provide operations to convert error specs into their standard form.
Make the sorting operation itself operate on the standard form.
compiler/write_error_spec.m:
Convert error_specs to standard form before writing them out,
in order to avoid duplicating the code for their standardization.
Change the code that writes out error_specs to operate on the
standard form. Implement the test implicit in the warning and
and informational severities in this code.
compiler/error_util.m:
compiler/compiler_util.m:
Delete operations that do not make sense with the new severity type.
---------------------
compiler/options.m:
Add new options to control all the previously-uncontrolled
warning and informational messages.
NEWS.md:
Announce the *public* new options.
compiler/option_categories.m:
compiler/print_help.m:
Add the new option category, and fake-include it in the help text
and the user guide. (The inclusion is fake because none of the
options in the new category are user visible, meaning the section
containing them is not visible either.)
---------------------
compiler/det_infer_goal.m:
Start a severity warning diagnostic with "Warning:"
instead of "Error:".
compiler/mark_trace_goals.m:
Fix an incorrect error message.
compiler/purity.m:
Replace a correct/incorrect color pair with two inconsistent colors,
because there is a reasonable probability of each one being right.
---------------------
compiler/accumulator.m:
compiler/add_clause.m:
compiler/add_mode.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/check_module_interface.m:
compiler/check_type_inst_mode_defns.m:
compiler/check_typeclass.m:
compiler/color_schemes.m:
compiler/common.m:
compiler/convert_import_use.m:
compiler/convert_parse_tree.m:
compiler/dead_proc_elim.m:
compiler/det_check_proc.m:
compiler/det_check_switch.m:
compiler/det_infer_goal.m:
compiler/du_type_layout.m:
compiler/format_call_errors.m:
compiler/grab_modules.m:
compiler/hlds_call_tree.m:
compiler/inst_check.m:
compiler/introduce_parallelism.m:
compiler/make_hlds_error.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/mark_trace_goals.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/module_qual.qual_errors.m:
compiler/opt_deps_spec.m:
compiler/options_file.m:
compiler/parse_goal.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/pre_typecheck.m:
compiler/purity.m:
compiler/read_modules.m:
compiler/recompilation.check.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/split_parse_tree_src.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/typecheck_clauses.m:
compiler/typecheck_error_overload.m:
compiler/typecheck_error_undef.m:
compiler/typecheck_errors.m:
compiler/typecheck_msgs.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/warn_unread_modules.m:
compiler/write_module_interface_files.m:
Conform to the changes above, mostly by either
- adding an option to all warning and informational messages,
sometimes using existing warning options and sometimes new ones,
or
- turning already explicitly-conditional-on-an-option messages
into implicitly-conditional-on-that-option messages.
---------------------
tests/invalid/one_member.m:
Conform to the change in det_infer_goal.m.
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_2.err_exp:
Actually obey the options for these modules in Mercury.options.
tests/invalid_purity/purity.err_exp:
tests/warnings/purity_warnings.err_exp:
Conform to the change in purity.m.
tests/warnings/moved_trace_goal.err_exp:
Conform to the change in mark_trace_goals.m.
tests/warnings/help_text.err_exp:
Expect the documentation of all the new options.
|
||
|
|
60386407ab |
Rename the "type_order_switch" pragma ...
... to "require_switch_arms_in_type_order".
compiler/prog_item.m:
compiler/hlds_markers.m:
Update the names of the parse tree and the HLDS representations
of this pragma.
compiler/parse_pragma.m:
Update the code that parses the pragma.
compiler/det_check_switch.m:
Update the name of the bespoke type control its operation.
s/cases/arms/ in the text of the warning message.
compiler/add_pragma.m:
compiler/convert_parse_tree.m:
compiler/det_check_proc.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/parse_tree_out_pragma.m:
compiler/table_gen.m:
Conform to the changes above.
tests/warnings/bad_type_order_switch.m:
Update the pragma name.
tests/warnings/bad_type_order_switch.err_exp:
Expect arms, not cases.
|
||
|
|
fbed5b6760 |
Add new pred marker pragma "type_order_switch".
compiler/prog_item.m:
Add a new impl_marker pragma, type_order_switch. Its meaning is
to ask the compiler to check all the switches in the predicate
or function named in the pragma to see whether
- the order of function symbols in the definition of type being
switched on (actually, in the definition of the top type constructor
of that type)
- is matched by the order in the text of the cases of the switch.
The intention is to use this on the optdb predicate in options.m.
compiler/hlds_markers.m:
Add a new predicate marker, whose presence indicates this pragma.
compiler/parse_pragma.m:
compiler/add_pragma.m:
Parse the new pragma, and convert it to the new marker.
compiler/det_check_proc.m:
Expand the existing that check whether we need to need to look for
warnings for the switches in a procedure body.
compiler/det_check_switch.m:
Implement the new pragma.
In the process, put the arguments of the affected predicates
into the order required by our coding style.
compiler/error_spec.m:
To help implement the new pragma, add a predicate for constructing
diffs between two string sequences. This factors out two existing
pieces of code. (New code in det_check_switch.m would have contained
a third copy.)
compiler/add_type.m:
compiler/style_checks.m:
Use the new predicate to replace those two old copies, simplifing
existing code.
compiler/convert_parse_tree.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/parse_tree_out_pragma.m:
compiler/table_gen.m:
Conform to the changes above.
tests/warnings/bad_type_order_switch.{m,err_exp}:
A test case for the new pragma.
tests/warnings/Mmakefile:
Enable the new test case.
|
||
|
|
8aaa0a958f |
Carve two new modules out of item_util.m.
compiler/convert_import_use.m:
New module for converting to and from checked representations
of import_module and use_module declarations.
compiler/convert_include.m:
New module for converting to and from checked representations
of include_module declarations.
compiler/item_util.m:
Delete the moved code.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Include and document the new modules.
compiler/check_import_accessibility.m:
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/grab_modules.m:
compiler/make_hlds_separate_items.m:
compiler/parse_module.m:
compiler/parse_tree_out.m:
compiler/unused_imports.m:
Conform to the changes above.
|
||
|
|
a92ae7d9bd | Update copyright notices. | ||
|
|
dcf48e2315 |
Add a new option, --warn-unsorted-import-blocks.
compiler/options.m:
doc/user_guide.texi:
NEWS.md:
Add, document and announce the new option. It is off by default,
but of course I tested its behavior when turned on. Most of this
diff deals with the consequences.
compiler/item_util.m:
Add code to generate the new warnings if requested.
compiler/convert_parse_tree.m:
Request the new warning if the new option is set when processing
source files..
compiler/handle_options.m:
Disable all style warnings, including the new one, when generating
.int* files or .*opt files.
compiler/mercury_compile_main.m:
Fix an unrelated bug I noticed while working on this diff:
report the "unfindability" of a given file at most once.
browser/dl.m:
browser/io_action.m:
compiler/mercury_compile_augment.m:
compiler/mercury_compile_llds_back_end.m:
compiler/unused_args.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/dump.m:
deep_profiler/html_format.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/profile.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/var_use_analysis.m:
library/array2d.m:
library/bit_buffer.read.m:
library/construct.m:
library/edit_distance.m:
library/library.m:
library/mercury_term_lexer.m:
library/one_or_more_map.m:
library/private_builtin.m:
library/set_bbbtree.m:
library/string.parse_runtime.m:
library/thread.future.m:
library/univ.m:
library/version_array.m:
library/version_bitmap.m:
mdbcomp/program_representation.m:
profiler/call_graph.m:
profiler/demangle.m:
profiler/output.m:
profiler/process_file.m:
profiler/propagate.m:
slice/mdice.m:
slice/mslice.m:
Fix unsorted import blocks pointed out by the new option.
tests/invalid/ambiguous_overloading_error.err_exp:
tests/invalid/bad_tscp.err_exp:
tests/invalid/bug10.err_exp:
tests/invalid/gh72_errors.err_exp:
tests/invalid/ho_default_func_2.err_exp:
tests/invalid/require_scopes.err_exp:
tests/invalid/type_error_use_module.err_exp:
tests/invalid/types.err_exp:
tests/invalid_nodepend/errors_2.err_exp:
tests/invalid_nodepend/funcs_as_preds.err_exp:
tests/warnings/ambiguous_overloading.err_exp:
tests/warnings/save.err_exp:
tests/warnings/singleton_test.err_exp:
tests/warnings/unused_interface_import.err_exp:
Update the expected outputs of these test cases to expect the new warning
for unsorted import blocks in their source files.
tests/invalid/Mercury.options:
tests/invalid_nodepend/Mercury.options:
tests/warnings/Mercury.options:
Execute those test cases with the warning enabled.
tests/invalid_nodepend/require_tailrec_invalid.m:
tests/invalid_nodepend/specified.m:
tests/recompilation/pragma_type_spec_r.m.1:
tests/recompilation/type_qual_re.m.1:
tests/recompilation/type_qual_re_2.m.1:
tests/recompilation/type_spec_unname_var_r.m.1:
tests/recompilation/type_spec_unname_var_r_2.m.1:
tests/recompilation/type_spec_unname_var_r_2.m.2:
tests/recompilation/unchanged_pred_nr.m.1:
tests/recompilation/with_type_re.m.1:
Sort the import blocks in these test cases, and where relevant,
import only one module per line.
tests/recompilation/with_type_re.err_exp.2:
Expect updated line numbers after splitting a line that imported
two modules.
tests/warnings/unsorted_import_blocks.{m,err_exp}:
New test case to exercise one nontrivial part of the sortedness check,
numerical non-sortedness. (The other affected test cases already exercise
all the other parts.)
tests/warnings/Mmakefile:
Enable the new test case.
|
||
|
|
79bfb1247f |
Carve prog_parse_tree.m out of prog_item.m.
compiler/prog_item.m:
compiler/prog_parse_tree.m:
Split prog_item.m into two modules, with the new module prog_parse_tree.m
containing the definitions of the file-kind-specific parse trees,
and prog_item.m continuing to contain the definitions of the items
that occur in those parse trees. Specialize the top-of-module comment
to the current contents of each module.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Include and document the new module.
compiler/*.m:
Conform to the changes above.
|
||
|
|
386160f937 |
s/dont/do_not/ in the compiler directory.
compiler/*.m:
Standardize on the do_not spelling over the dont contraction
in the compiler directory. (We used to have a lot of both spellings.)
|
||
|
|
c611a718b7 | Expand a comment. | ||
|
|
1b61fd5c5a |
More tweaks to the text of diagnostics.
compiler/add_pragma.m:
When reporting duplicate require_tail_rec pragmas, specify whether
it is for a whole predicate, or just for one of its modes.
compiler/parse_type_name.m:
Don't just report an "ill-formed type": report exactly what is wrong
with it.
compiler/add_pragma_tabling.m:
compiler/convert_parse_tree.m:
compiler/det_report.m:
compiler/parse_pragma_tabling.m:
Fix the wording of some diagnostics.
library/mercury_term_lexer.m:
Fix the wording of a diagnostic.
tests/invalid_nodepend/Mmakefile:
Reenable two test cases that were accidentally left out
when they were moved here from tests/invalid.
tests/invalid_nodepend/fundeps_vars.err_exp:
tests/invalid_nodepend/instance_bug.err_exp:
tests/invalid_nodepend/invalid_main.err_exp:
tests/invalid_nodepend/kind.err_exp:
tests/invalid_nodepend/null_char.err_exp:
tests/invalid_nodepend/require_tailrec_invalid.err_exp:
tests/invalid_nodepend/reserved_type_name.m:
tests/invalid_nodepend/specified.err_exp:
Expect updated diagnostics.
|
||
|
|
aff575a86f |
Use color in convert_parse_tree.m.
compiler/convert_parse_tree.m:
Add color to the diagnostics for errors in .m files.
(Leave the diagnostics about unexpected items in interface and
optimization files without color, since users cannot see them unless
an automatically generated file has been screwed up.)
Improve the wording of both kinds of diagnostics.
compiler/item_util.m:
Add a utility function for the new code in convert_parse_tree.m.
tests/invalid/bad_item_in_interface.err_exp:
tests/invalid/not_in_interface.err_exp:
tests/invalid_make_int/bad_finalise_decl_int.int_err_exp:
tests/invalid_make_int/bad_in_interface.int_err_exp:
tests/invalid_make_int/bad_initialise_decl_int.int_err_exp:
tests/invalid_make_int/bad_mutable_int.int_err_exp:
tests/invalid_make_int/pragma_export_int.int_err_exp:
tests/invalid_make_int/test_type_spec_int.int_err_exp:
Expect updated diagnostics.
|
||
|
|
dc12878708 |
Shorten function symbols in error_specs.
compiler/error_spec.m:
Replace simplest_spec with spec, and simplest_no_context_spec with
no_ctxt_spec. These are now the most frequently used function symbols
to create error specs, so their name should not make them out to be
the exception.
Replace simplest_msg with msg, and simplest_no_context_msg with
no_ctxt_msg for the same reason.
Abbreviate some of the long phase names.
compiler/*.m:
Conform to the changes above. Most of these changes were done by a script,
with minor manual tidying up, which consisted mostly of fitting code
constructing error specs onto fewer lines than before.
|
||
|
|
d9f5ab5f60 |
Implement type_spec_constrained_preds pragmas.
This pragma, which has the form shown by this example,
:- pragma type_spec_constrained_preds(
[stream.line_oriented(Stream, State),
stream.unboxed_reader(Stream, char, State, Error),
stream.putback(Stream, char, State, Error)],
apply_to_superclasses,
[subst([Stream => io.text_input_stream,
State => io.state, Error => io.error])]).
allows programmers to ask the compiler to create type-specialized versions
of all predicates and functions, in a module and its submodules, that have
one or more of the specified typeclass constraints.
The first argument specifies these constraints, of which the example above
has three. The second argument specifies whether the request also applies
to predicates and functions whose signatures include superclasses of the
type classes involved (or *their* superclasses, and so on), not the named
type classes themselves. The third argument specifies the requested list
of one or more specializations, each of which consists of a substitution
that maps one or more type variables to a type. (A type that should not
itself be a type variable.) This example requests just one specialization
for each match.
compiler/prog_item.m:
Add a new kind of decl_pragma item to represent the new pragma.
Define the new types it needs.
Add some documentation of the invariants of existing item kinds.
compiler/prog_data.m:
Define ground_type, a subtype of mer_type, for use by prog_item.m.
compiler/prog_type_test.m:
Add a utility predicate for converting a type to a ground_type,
if it is indeed ground.
compiler/prog_data_pragma.m:
Change the definition of the type_subst type to use a purpose-specific
function symbol instead of the pair function symbol.
compiler/parse_pragma.m:
Add code to parse the new pragma, and to check the parsed form
to see whether it violates the requirements upon it.
Modify the code that parses plain old type_spec pragma to also allow
subst([State = io.state, Error = io.error]) syntax to be used
to specify type substitutions, as discussed on m-rev.
Modify the code that parses the old substitution syntax to use
the infrastructure of the new syntax, which can generate better
error messages.
Change this now-common code to allow the two sides of a substitution
to be separated by either an equal sign (such as "State = io.state")
or an arrow (such as "Error => io.error").
Improve the wording of some error messages.
Delete the code that accepted and then ignored a third argument
in type_spec pragmas. This code was needed only until a change committed
in July 2022 finished bootstrapping.
vim/syntax/mercury.vim:
Add the new pragma's name to the list of pragma keywords.
compiler/add_pragma.m:
compiler/add_pragma_type_spec.m:
Add code to process the new pragma. Add code to debug the processing
of the new pragma.
Change the code that processes the old type_spec pragma,
- to avoid using mode-specific clauses if the specialization applies
to the whole predicate and not just one procedure of it (this avoids
a bug that I reported on m-rev on 2024 feb 2), and
- to set the context of type-specialized predicates to match the original
predicates, instead of leaving them set to the default context, which
is a dummy context (this helps avoid error messages whose lack of context
can make it hard to figure out what exactly they are complaining about).
compiler/options.m:
doc/user_guide.texi:
Add an option that add_pragma_type_spec.m now consults to decide
whether to report the type_spec pragmas generated to implement each
type_spec_constrained_preds pragma. The documentation of this option
is commented out. It should be made visible to users once we have
(a) gathered sufficient experience with the new pragma to have confidence
in it, and (b) documented the pragma itself.
Add a way to check whether this diff exists in the compiler.
compiler/handle_options.m:
Automatically disable the new option for all invocations other than
those that generate code or check errors, since the output they generate
would be more distracting than useful e.g. when making .intN files.
compiler/parse_class.m:
Restructure the code that selects superclass constraints (constraints
on typeclass declarations) out of the whole set of constraints that
a predicate that is designed to parse constraints on *predicate*
declarations has parsed. The two use cases are different, because
neither inst constraints, nor typeclass constraints involving
partially-specified types, are allowed in typeclass declarations.
The restructure allows us to improve the error messages we generate
if and when any such disallowed constraints are found.
compiler/parse_tree_out_pragma.m:
Add code to output the new pragma.
Add code to try to avoid putting redundant parentheses around
name/arity pairs. It needs new code to be enabled in
parse_tree_out_sym_name.m to work.
compiler/parse_tree_out_type.m:
Generalize (and rename) an existing function.
compiler/parse_tree_out_sym_name.m:
Add code (commented out for now) that can avoid putting redundant
parentheses around name/arity pairs.
compiler/maybe_error.m:
Define maybeN for N = 6, to join N = {1,2,3,4,5}, for use by new code
above.
mdbcomp/sym_name.m:
Fix a misleading predicate name.
compiler/hlds_class.m:
Document an invariant.
compiler/hlds_module.m:
Replace a multi_map with a one_or_more_map, and give a name to the type.
compiler/parse_item.m:
Fix comments.
compiler/parse_tree_out_inst.m:
Add a new utility function needed by other code in this diff.
compiler/hlds_out_typeclass_table.m:
Clarify the typeclass table part of HLDS dumps.
compiler/check_import_accessibility.m:
compiler/check_typeclass.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.qual_errors.m:
compiler/module_qual.qualify_items.m:
compiler/parse_type_name.m:
compiler/pred_name.m:
compiler/prog_item_stats.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
mdbcomp/slice_and_dice.m:
Conform to the changes above.
compiler/prog_type_unify.m:
Fix indentation.
tests/hard_coded/type_spec_modes.m:
Modify this test to see whether the code parsing type substitutions
in type_spec pragmas using the new syntax works.
tests/invalid_nodepend/typeclass_test_3.err_exp:
Expect the improved error message parse_class.m now generates.
tests/invalid_nodepend/bad_tscp.{m,exp}:
Add this test case to check the error messages generated by parse_pragma.m
to report the problems it detects in malformed type_spec_constrained_preds
pragmas.
tests/invalid_nodepend/Mmakefile:
Enable the new test case.
tests/warnings/test_tscp.{m,exp}:
Add a test case that checks whether, given a list of the new pragmas,
the compiler generates the expected set of type_spec pragmas.
tests/warnings/{Mmakefile,Mercury.options}:
Enable the new test case.
|
||
|
|
9d38b252bf |
Separate marker pragmas from other decl/impl pragmas.
compiler/prog_item.m:
Previously, both decl and impl pragmas contained some pragma kinds
that contained only the specification of a predicate or function.
These served only to specify a marker to be applied to the named
predicate or function.
This diff separates out those kinds of pragmas from the types of
both the decl pragmas and the impl pragmas (the difference is that
decl pragmas may appear in module interfaces, while impl pragmas may not),
and gives them two new representations: decl markers and impl markers.
While in the old representation, each kind of marker had its own wrapper
around the predicate/function specification, in the new representation,
they are side-by-side, which allows simpler construction techniques
and smaller code.
Update the definition of parse_tree_module_src, parse_tree_plain_opt,
parse_tree_int0 and parse_tree_int1 to include markers alongside
pragmas of each kind. Use subtypes to restrict the kinds of markers
that can appear in parse_tree_plain_opts to the set that we actually
can put into them. (Source files of course can contain any markers,
and .intN files either get put into them either all of the markers
that occur in the source file in a given section, or none of them.)
Delete the item_pragma_info type, which was a wrapper around
the specific info of each pragma, and stored a context and an item
sequence number alongside it. Move the context and the item sequence
number into the representation of each pragma. This should reduce
visual clutter in the source code at places that construct or deconstruct
pragmas, and at runtime (with direct args) it should reduce both
the number of memory cells we need to allocate, and the number
of pointers we need to follow.
Include decl vs impl in the names of some function symbols.
Partly to counteract that, shorten some names to avoid excessive
line lengths.
compiler/add_pragma.m:
Add predicates to add decl and impl markers.
Move the predicates looping over lists of pragma next to the
predicates handling those pragmas.
compiler/make_hlds_passes.m:
Add both decl and impl markers before adding foreign_procs.
The ability to do this was the original motivation for this diff.
Update the comments both about this issue, and about why we delay
adding tabling pragmas to the HLDS.
compiler/check_module_interface.m:
Conform to the changes above.
Add an XXX about something fishy.
compiler/item_util.m:
Delete aux functions that are no longer needed.
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/grab_modules.m:
compiler/hlds_module.m:
compiler/intermod.m:
compiler/intermod_analysis.m:
compiler/make_hlds_separate_items.m:
compiler/mercury_compile_middle_passes.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qual_errors.m:
compiler/module_qual.qualify_items.m:
compiler/parse_pragma.m:
compiler/parse_pragma_analysis.m:
compiler/parse_pragma_foreign.m:
compiler/parse_pragma_tabling.m:
compiler/parse_tree_out.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_item_stats.m:
compiler/prog_mutable.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/unused_args.m:
Conform to the changes above.
|
||
|
|
155bc71d72 |
Make foreign_procs their own top-level item kind.
compiler/prog_item.m:
Change foreign_procs from being one kind of impl_pragma item
to being their own item kind. Because of this, the changes to
some of the modules listed below delete "pragma" from the names
of predicates and types referring to foreign_procs.
Include foreign_proc items in parse_tree_module_srcs and
parse_tree_plain_opts, the two kinds of parse trees that may contain
foreign_procs.
compiler/make_hlds_separate_items.m:
Gather foreign procs independently of impl pragmas.
compiler/make_hlds_passes.m:
Add foreign_procs from the parse_tree_module_src and any
parse_tree_plain_opts to the HLDS at the same time as we add
foreign_procs generated by the compiler to implement solver types
and mutables. Document the reason for this.
Document also the reason why we should add all marker pragmas
just before we do this. Document the reason why two tests will fail
until that, or something similar, is done.
compiler/add_foreign_proc.m:
Delete a test that was required only because we couldn't guarantee
the relative order of adding foreign_procs and pragmas that mark
predicates as external on one backend.
compiler/module_qual.qual_errors.m:
Add foreign_procs as a possible context for errors during qualification.
compiler/status.m:
Add a comment documented an old issue.
compiler/add_mutable_aux_preds.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_solver.m:
compiler/check_module_interface.m:
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/coverage_profiling.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/equiv_type.m:
compiler/foreign.m:
compiler/get_dependencies.m:
compiler/goal_util.m:
compiler/grab_modules.m:
compiler/hlds_goal.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_pragma_foreign.m:
compiler/parse_tree_out.m:
compiler/parse_tree_out_pragma.m:
compiler/pragma_c_gen.m:
compiler/prog_item_stats.m:
compiler/prog_mutable.m:
compiler/recompilation.version.m:
compiler/structure_sharing.domain.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trailing_analysis.m:
compiler/prog_data_foreign.m:
compiler/unify_proc.m:
Conform to the changes above.
|
||
|
|
ecf3902b91 |
Use abstract typeclasses in parse_tree_int[13].
compiler/prog_data.m:
Define a subtype of the typeclass interface type for abstract typeclasses.
compiler/prog_item.m:
Change the types of the fields representing
- implementation section typeclasses in .int files, and
- interface section typeclasses in .int3 files
to a subtype that allows the definition of only abstract typeclasses.
The interface section typeclasses in .int3 files have more invariants
than just being abstract, but these cannot currently be expressed
using subtypes.
library/list.m:
Add a comment (which is visible only to Mercury developers)
about why this is so.
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/equiv_type.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/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the changes above.
|
||
|
|
fcad1b21e8 |
Delete module_names_contexts fields from parse trees.
compiler/prog_item.m:
We used to include information about include_module, import_module
and use_module declarations in a module in the parse_tree_module_src
in two forms: an unchecked form, which had type module_names_contexts,
and a checked form, which had types include_module_map and
import_and_or_use_map respectively. We have been gradually switching
more and more code working on parse trees from taking the unchecked form
as input to taking the checked form as input.
This diff completes the process.
- It deletes the ptms_{int,imp}_includes and ptms_{int,imp}{imports,uses}
fields from parse_tree_module_src. Their checked versions remain.
- It changes the parse_tree_int3 type to store include and import
information using checked rather than unchecked types. The reason
why this wasn't done before is that the checked data structures
could not preserve the relevant invariants until subtypes were added
to the language. This diff thus also defines the needed new subtype.
Fix a typo (wrong int file number) in a field name.
compiler/item_util.m:
Add some utility predicates needed by new code in the modules below.
Change the interface of a utility predicate
- to stop requiring the caller to supply unchecked data structures,
constructing them internally as intermediate data structures instead,
and
- to stop returning some now-unneeded unchecked data structures.
Keep some utility predicates private that are no longer needed
outside this module.
Delete a whole bunch of utility predicates which are no longer needed
at all.
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
Conform to the changes in prog_item.m, by changing code that used
to construct unchecked to now construct checked data structures.
compiler/check_module_interface.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:
compiler/write_deps_file.m:
Conform to the changes in prog_item.m, mostly by changing code that
used to take unchecked data structures as input to now take checked
data structures as input.
compiler/deps_map.m:
compiler/module_baggage.m:
compiler/module_dep_info.m:
Delete now-unneeded imports.
|
||
|
|
7292ecb571 |
Don't generate duplicate instance declarations.
We used to include in the .int0 file the abstract form of all the instance
declarations in both the interface and the implementation sections.
When an instance is declared (in an already-abstract form) in the interface
section and defined in the implementation section, this resulted in the
abstract interface declaration being included in the .int0 file twice,
once in the interface section, and once in the implementation section.
compiler/comp_unit_interface.m:
Fix this by including an abstract instance declaration in the
implementation section of a .int0 file only if it does not also appear
in the interface section.
Conform to the changes in prog_item.m below.
compiler/parse_tree_out.m:
To help implement the above test, add a function to return the string
form of an abstract instance declaration.
It is easy to make this change for *abstract* instance declarations,
but not *concrete* instance definitions, because (in order to handle
instances that define methods by clauses, instead of by pred/func names)
the latter would require generalizing *all* the code for writing out
clauses, with all the overhead associated with replacing first order calls
with method calls.
Another change (unrelated to the problem above) is to write out
typeclass and instance definitions for typeclasses with no methods
in a nicer form. Instead of looking like this:
:- instance classname(argtypes) where [
].
they now look like this:
:- instance classname(argtypes) where [].
Another formatting change unrelated to the above: don't put parentheses
around typeclass names in instance declarations/definitions if the name
is all alphanumeric and not an operator.
Conform to the changes in prog_item.m below.
compiler/prog_data.m:
compiler/prog_item.m:
To be able to use the new code to convert abstract instances to strings
in comp_unit_interface, and to write out abstract instance declarations
inside .int0 (and other .intN) files, it helps to know which instance
items can only be abstract in these files. As it turns out, none can be
concrete. So define a subtype of item_instance_info that can contain
only abstract instance declarations, and use it to replace
item_instance_info in parse_tree_intN for all N.
compiler/parse_tree_out_info.m:
Add a utility function for new code in comp_unit_interface.m
invoking new code in parse_tree_out.m.
compiler/convert_parse_tree.m:
Conform to the changes in prog_item.m by insisting that instances
read in from .intN files are all abstract.
Fix some typos in some error messages (which people can see only if
something has screwed up a .intN file).
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/recompilation.version.m:
Conform to the changes above.
compiler/intermod.m:
Simplify some code.
tests/invalid/Mercury.options:
Fix the failure of the instances_pc.instances_pc_helper_1 test case
when intermodule optimization is enabled for a bootcheck by disabling
intermodule optimization for this test. The old code to do so didn't
work due to typos.
tests/invalid/instances_pc.instances_pc_helper_1.err_exp:
Expect a reference to only ONE old instance declaration in
instances_pc.int0. Expect it at a new line number, due to the first
formatting change above.
tests/misc_tests/pretty_print_test.exp:
Expect no unnecessary parentheses around a class name in an
instance definition, due to the second formatting change.
|
||
|
|
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.
|