--no-ansi (mgnuc) and --no-ansi-c (mmc) have not actually done anything for
many years now. Deprecate these options and remove their "use" throughout most
of the Mercury system. (The remaining uses are in the Makefiles for the Boehm
GC, which need to be updated separately.)
Also deprecate the internal compiler option --cflags-for-ansi.
compiler/options.m:
Document that --no-ansi-c is now deprecated.
Document that the internal option --cflags-for-ansi is now
deprecated.
compiler/compile_target_code.m:
Do not pass the ANSI options to the C compiler.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Deprecate the --no-ansi option; delete code that no longer does
anything useful.
configure.ac:
Delete the configuration variable CFLAGS_FOR_ANSI; it is only ever
set to be empty. (The comment talks about --no-ansi doing other things
in the mgnuc script. It used to also cause some preprocessor macros
to be defined for compatibility with the system headers on some
platforms -- that has not been the case since 2013.)
doc/user_guide.texi:
Document that --no-ansi-c is deprecated.
bytecode/Mmakefile:
compiler/Mercury.options:
library/Mercury.options:
extras/odbc/odbc.m:
runtime/Mmakefile:
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
tests/hard_coded/Mercury.options:
tests/valid/Mercury.options:
trace/Mmakefile:
util/Mmakefile:
Conform to the above change.
NEWS.md:
Announce the above.
Since the compiler now refuses to allow debugging in parallel grades,
tests that require debugging need to be skipped over in low-level
parallel grades or deleted.
tests/hard_coded/Mmakefile:
Disable 'parse' test in parallel grades as it happens to link with
debug libraries.
tests/par_conj/Mercury.options:
tests/par_conj/Mmakefile:
tests/par_conj/par_ddeath.exp:
tests/par_conj/par_ddeath.m:
tests/par_conj/par_ddeath_2.exp:
tests/par_conj/par_ddeath_2.m:
Delete par_ddeath and par_ddeath_2 tests that once triggered a
compiler abort with --trace deep in parallel grades.
I don't think there is much value in keeping them around.
tests/valid/Mmake.valid.common:
Skip LLDS_PROGS (i.e. test cases that required debugging) in
parallel grades.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/untuple_bug.m:
Delete untuple_bug. It tests an old bug in the untupling
transformation, which was more a programming exercise than something
that should be used anyway.
GCC 12 has new warning, -Winfinite-recursion, that is being triggered by six
tests in the directory tests/valid when compiled in high-level C grades. Since
we also enable -Werror, this is causing these test to fail. Fix these failures
by either removing the infinite recursion from them or by disabling the new GCC
warning for the affected test cases.
configure.ac:
tests/DEFNS_FOR_TESTS.in:
Define a variable whose value is the option for disabling GCC's infinite
recursion check.
tests/valid/higher_order5.m:
tests/valid/stack_alloc.m:
Modify these tests so they do not trigger the infinite recursion warning
in GCC (or Mercury for that matter).
tests/valid/mode_syntax.m:
tests/valid/same_length_2.m:
Merge these two tests (under the first name) since they both test the same
thing. Delete the same_length_2 version.
tests/valid/Mmakefile:
Conform to the above deletion.
tests/valid/Mercury.options:
Include DEFNS_FOR_TESTS here so that mmc --make can see it.
Disable GCC's infinite recursion check for those tests that trigger
it.
Shut up a bunch Mercury warnings for the mode_syntax test case that
are unrelated to what is actually being tested.
This fixes Mantis bug #544.
The code of add_trail_ops.m can transform
<code that adds an entry to const_var_map>
into
(
...
<code that adds an entry to const_var_map>
...
;
...,
fail
)
where the const_var_map in the MLDS code generator records which variables'
values are available as ground terms.
The MLDS code generator used to reset the const_var_map in its main data
structure, the ml_gen_info, at the end of every disjunction (actually,
at the end of every branched control structure) to the value it had
at the start. This was intended to prevent the code following the branched
structure from relying on const_var_map entries that were added to the
const_var_map on *some* branches, but not others. However, in this case,
it has the effect of forgetting the entry added by the first disjunct,
even though
- the code after the disjunction can be reached *only* via the first disjunct,
and
- the code after the disjunction (legitimately, until add_trail_ops) depended
on that entry being available.
The fix is to allow the code after a branched control structure to depend
on any const_var_map entry that is present in the final const_var_map
in every branch of the branched control structure whose end is reachable.
The LLDS code generator was not affected by the bug, because it uses
totally separate systems both for implementing trailing, and for keeping
track of what variables' values are available statically. In particular,
it does not rely on operations inserted and the annotations left on
unifications by the add_trail_ops and mark_static_term passes,
having been written long before either module existed.
compiler/hlds_goal.m:
Document the update above to what may be marked static.
compiler/ml_gen_info.m:
Document the updated protocol for handling the const_var_map field.
Use a named type instead of its expansion.
compiler/ml_code_gen.m:
Make the predicates that generate code for a branch in a branched
control structure return the final const_var_maps from the branches
whose endpoints are reachable.
Add a predicate that computes the consensus of all the gathered
const_var_maps.
Compute consensus const_var_maps for if-then-elses and negations.
Fix some inconsistencies in variable naming.
Simplify some code.
compiler/ml_disj_gen.m:
Compute consensus const_var_maps for disjunctions.
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
Compute consensus const_var_maps for various kinds of switches.
In some predicates, put related arguments next to each other.
compiler/ml_unify_gen_construct.m:
Delete "dynamic" from the names of several predicates that also handled
non-dynamic construction unifications.
Fix an out-of-date comment.
compiler/mark_static_terms:
Fix grammar in a comment.
library/map.m:
Fix a careless bug: when doing a merge in map.common_subset_loop,
we threw away an entry from the wrong list in one of three cases.
Make such bugs harder to overlook by
- deleting the common parts from variable names, leaving the differences
easier to see, and
- replacing numeric suffixes for completely separate data structures
with A and B suffixes.
tests/valid/bug544.m:
A new test case for the bug.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Enable the bug, and run it with -O5.
compiler/lco.m:
Do not replace a plain call such as
type_check(E, T)
with
LCMCpr_type_check_1(E, AddrOfT)
which does NOT bind T, if later code in the procedure needs the value of T
in the current stack frame.
This fixes Mantis bug 539.
tests/valid/Mmakefile:
Enable the bug539 test case.
tests/valid/Mercury.options:
Do not force bug539.m to be compiled in asm_fast.gc; the bug
is not grade dependent.
This fixes Mantis bug #512, whose symptom is a compiler abort in some
very specific circumstances. The regression test for the bug below
documents the long causal chain needed to tickle this abort.
compiler/simplify_goal_conj.m:
When deleting unreachable code, set the requanify flag, which also
causes instmap_deltas to be recomputed. The immediate cause of the bug
was an instmap_delta that should have been thus recomputed, but wasn't.
Do this in both places where simplification can delete dead code,
though the Mantis 512 test case involves only one.
tests/valid/bug512.m:
A regression test for this bug.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Enable the new test case, and run it with the flags that tickle
the bug it is guarding against.
The current source-to-source debugger transformation cannot handle the
predicates introduced by higher-order specialization. There are likely similar
issues with other HLDS->HLDS transformations.
The fix (for now) is to disable most HLDS->HLDS transformations in .ssdebug
grades.
compiler/handle_options.m:
Disable most HLDS->HLDS optimizations when the ss-trace level is
shallow or deep.
Add an XXX comment about a separate issue.
compiler/ssdebug.m:
Add an XXX comment about predicates produced by higher-order
specialization.
tests/WS_FLAGS.ws:
Add a missing include.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/gh89.m:
Add the test case from github issue 89.
This implements Mantis feature request #497.
compiler/parse_goal.m:
compiler/parse_dcg_goal.m:
When we find that a disable_warnings scope contains an unrecognized
warning name, generate a warning for it, and return this warning
*alongside*, not *instead of*, the disable_warnings scope goal.
This requires passing around not a maybe1(goal), as we have been doing
till now, but a maybe2(goal, list(warning_spec)), so this change
affects both (1) most of these two modules, and (2) most of the
modules below.
compiler/error_util.m:
Provide warning_spec as a synonym for error_spec, to be used in
situations like this where the "error_spec" is intended contain
something with severity_warning.
compiler/maybe_error.m:
Provide some new utility predicates now needed in parse_goal.m
and elsewhere.
compiler/prog_item.m:
Provide room in the representation of clauses for the warnings
generated by parsing the clause body goal.
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/du_type_layout.m:
compiler/get_dependencies.m:
compiler/make_hlds_passes.m:
compiler/parse_item.m:
compiler/parse_tree_out_clause.m:
compiler/prog_item_stats.m:
compiler/superhomogeneous.m:
Conform to the changes above.
tests/valid/unknown_warning.m:
Add this test case that checks whether a source file with an unknown
warning name in a disable_warnings scope can have code generated for it.
tests/warnings/unknown_warning.{m,exp}:
Add the same source file to this directory as well, to check whether
we get the right set of warnings.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/warnings/Mmakefile:
Enable the two new test cases.
This fixes Mantis bug #493.
compiler/common.m:
Don't apply the common_struct optimization if doing so could possibly
invalidate the annotations generated by mark_static_terms.m, which the
MLDS code generator relies on.
Move the tests for the applicability of the common_struct optimization
for both construction and deconstruction unifications next to each other.
Add XXXs about possible problems this code may have when applied to code
that does region based memory allocation.
tests/valid/bug493.m:
A simplified version of the Mantis test case.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the new test case, and specify the options that originally caused
the bug to manifest itself.
compiler/unused_imports.m:
As above. This fixes Mantis bug #483.
tests/valid/bug483.m:
The test case for this bug.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Enable the new test case with the right options.
tests/valid/some_singleton.m:
The new test case.
tests/valid/Mercury.options:
Specify the options for the test case.
tests/valid/Mmakefile:
List the test case, but do not enable it yet.
compiler/unify_gen.m:
Add type_info, typeclass_info and ground term constants to the var
state map using assign_const_to_var instead of assign_expr_to_var.
expr_is_constant will fail if a constant expression is added with
the more general assign_expr_to_var, causing missed opportunities
to construct terms statically in var_locn.m.
Prevents a compiler abort (bug #457) where mark_static_terms.m
determines that a term can be constructed statically but var_locn.m
decides otherwise.
compiler/var_locn.m:
Do not abort if var_locn_assign_dynamic_cell_to_var is passed
`construct_statically'. Even after the previous change, it is
possible for mark_static_terms.m to determine that a cell with a
dummy type argument can be constructed statically but var_locn.m
currently does not. This was preventing bootchecks at
-O5 --intermodule-optimization.
compiler/hlds_goal.m:
Fix misleading documentation for how_to_construct.
tests/valid/Mercury.options:
tests/valid/bug457.m:
Add a test case.
compiler/options.m:
Disable the (non-user-visible) --no-special-preds option, which was
only ever used for a few experiments. Document why.
compiler/add_special_pred.m:
compiler/higher_order.m:
compiler/simplify_goal_unify.m:
compiler/special_pred.m:
compiler/type_ctor_info.m:
Simplify the code that used to have to deal with the option.
tests/valid/Mercury.options:
Don't specify the option for a test. It does not affect the test anyway.
compiler/unused_imports.m:
When processing type_ctor_info and base_typeclass_info cons_ids, record
the module name in the cons_id as being used, rather than just the
module *containing* that module. Effectively, the bug was that we treated
a module name as if it were a sym_name; the types are the same, but the
meaning isn't.
tests/valid/use_import_only_for_instance.m:
A regression test for the bug.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the regression test.
Mutually-recursive tail calls might have different arguments than their
parents. They may have more or fewer arguments than the caller, and the
outputs may be in different positions. This change handles these correctly.
compiler/mark_tail_calls.m?
As above.
tests/valid/mutual_tailrec_outputs.m:
Add a test case that triggered a crash with mismatched argument list
lengths.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Add new test.
This change enables warnings for mutual recursion for the low level C
backend.
--warn-non-tail-recursion currently only works for direct recursion. This
change renames it to --warn-non-tail-recursion-self and adds
--warn-non-tail-recursion which is intended to produce warnings for self
and mutual recursion.
compiler/options.m:
Add new option.
compiler/handle_options.m:
Make --warn-non-tail-recursion imply --warn-non-tail-recursion-self.
compiler/ml_tailcall.m:
Conform to changes in options.m.
compiler/mark_tail_calls.m:
Simplify the code that interprets tail recursion warning options, this
avoids the need for the warn_non_tail_rec_calls_opt which was only used
here in an unnecessary step. This logic has also been moved to a
separate predicate.
Add a warning for mutually recursive calls that are not tail recursive.
Update these warning/error messages to say if the call is self or
mutually recursive. Also in the case of mutually recursive calls, name
the callee.
compiler/mercury_compile_llds_back_end.m:
Compute the dependency information before running the pre-LLDS passes.
This makes sure that we do this once for the whole module, and
independently of --trad-passes.
compiler/dependency_graph.m:
Add a method for getting the SCC of a given node from a dependency_info
structure. The SCC is retrieved from a lazily built map.
doc/user_guide.texi:
Document the changes.
tests/invalid/Mmakefile:
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.m:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.m:
tests/invalid/require_tailrec_3.err_exp:
tests/invalid/require_tailrec_3.m:
tests/valid/Mmakefile:
tests/valid/require_tailrec_1.m:
tests/valid/require_tailrec_2.m:
tests/valid/require_tailrec_3.m:
Test the tail recursion warnings a lot more extensively, some of these
are new test programs, others just have many more test cases within
them.
tests/invalid/Mercury.options:
tests/valid/Mercury.options:
Add new test files.
Disable most optimisations as these could optimise away the mutual tail
recursions.
tests/EXPECT_FAIL_TESTS.hlc.gc:
New test case failures.
This bug was reported against rotd-2008-01-14; the problem does not occur with
rotd-2016-06-23, although I'm not sure if that's because the original issue has
been fixed or if there is just something masking it.
tests/valid/bug36.m:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Add the test case for bug #36.
This patch reduces spurious tail call warnings by warning only for the last
of a sequence of recursive calls along an execution path, for example it
no-longer emits a warning for the first of the two recursive calls in
quicksort. I have already made a change to this effect for the MLDS
backends.
This patch also implements the new the require_tail_recursion pragma. This
change has already been made for the MLDS backends.
The require_tail_recursion pragma does not yet handle mutual recursion or
raise an error if the code is not recursive at all. These will be my next
tasks.
compiler/mark_tail_calls.m:
Combine marking tail calls with warning about tail calls.
Handle scopes more accurately.
compiler/mercury_compile_llds_back_end.m:
Conform to changes in mark_tail_calls.m
No longer warn for tail calls, this is now done in the same pass that
marks tail calls. The decision to run this pass is now made on a
per-procedure basis and in mark_tail_calls.m
tests/invalid/require_tailrec_1.m:
tests/invalid/require_tailrec_2.m:
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/valid/require_tailrec_1.m:
tests/valid/require_tailrec_2.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Add new tests.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/require_tail_recursion.{m,err_exp} ->
require_tailrec_invalid.{m,exp}:
Rename existing test.
We haven't supported it in years, and keeping it in the compiler
is just a maintenance burden and a performance problem.
mdbcomp/prim_data.m:
Delete the spec_pred_init functor, since we don't support special
"init" predicates anymore.
compiler/prog_data.m:
Delete the slot in solver type details that record the name of the
auto-initialization predicate.
compiler/prog_io_type_defn.m:
Don't allow a type definition to specify an auto-initialization predicate.
compiler/options.m:
compiler/globals.m:
Delete the option that allowed support for auto-initialization to be
turned back on.
compiler/inst_match.m:
compiler/inst_util.m:
Delete comments about auto-initialization.
compiler/mode_info.m:
Delete the record of whether we have variables that can be
auto-initialized (we never do anymore) and the flag that controls whether
auto-initialization is permitted or not.
compiler/modecheck_conj.m:
Simplify the code that modechecks conjunctions, since it no longer
has to figure out where to insert auto-initializations of solver vars.
compiler/modecheck_goal.m:
Delete the code that ensured that if one branch of a branched
control structure auto-initialized a solver variable, then they
all did.
compiler/modecheck_unify.m:
Don't auto-initializate variables before unifications.
compiler/modecheck_util.m:
Delete the code that auto-initialized solver variables at the ends
of procedure bodies if this needed to be done and wasn't done before.
compiler/add_special_pred.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/modecheck_call.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/post_term_analysis.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/term_constr_errors.m:
compiler/term_constr_initial.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_util.m:
compiler/unify_proc.m:
Delete code that handled stuff related to auto-initialization,
and now always take the path that would normally be taken in the
absence of auto-initialization.
deep_profiler/read_profile.m:
runtime/mercury_layout_util.c:
runtime/mercury_stack_trace.c:
util/mdemangle.c:
Remove code that recognized the compiler-generated name of initialization
predicates.
tests/debugger/solver_test.m:
tests/hard_coded/solver_construction_init_test.m:
tests/hard_coded/solver_disj_inits.m:
tests/hard_coded/solver_ite_inits.m:
tests/invalid/missing_init_pred.m:
tests/invalid/zinc2mer_lib.m:
tests/valid/fz_conf.m:
tests/valid/solver_type_bug_2.m:
tests/valid/solver_type_mutable_bug.m:
These tests tested the handling of auto-initialization, which we
no longer support. Keep them around (and a bit more visible than
inside the git repo) in case we need them again, but add a comment
to each saying that the test is disabled.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Disable those tests.
tests/warnings/non_term_user_special.{m,exp}:
Part of this test tested the handling of auto-initialization;
delete that part.
tests/warnings/Mercury.options:
Delete the flag required by the deleted part, since we don't support it
anymore.
compiler/liveness.m:
The bug was a violation of an invariant required by delay_death_proc_body.
Document the requirement that this invariant places on cse_detection.m,
the requirement whose non-fulfillment caused the bug.
compiler/cse_detection.m:
When hoisting a deconstruction unification and creating new variables
for its arguments, if any of the arguments were named variables holding
type_infos, typeclass_infos or their components, then give a name
to the variable holding the corresponding argument as well. This fixes
the bug by fixing the violation of the above invariant. Add a pointer
to the invariant in liveness.m.
Document the reason why another change that looks like a potential fix
wouldn't actually work.
Give some predicates better names and argument orders.
Update the module qualifier (from : to .) in an example. We haven't used
: in a LONG time.
compiler/continuation_info.m:
Simplify the code where the bug originally caused the compiler to crash.
(This code was not actually in error.)
compiler/simplify_goal_conj.m:
Fix a small performance bug I noted while hunting the bug. When the
excess_assign optimization replaced all occurrences of a variable,
it delete the variable from the varset, but not the vartypes,
leaving lookups on it slower than necessary.
Record the reason why do not choose to fix a potential performance bug
that to the best of my knowledge, we haven't actually seen yet in the wild.
compiler/hlds_goal.m:
Define a type as a shorter and more meaningful synonym for a particular
type used in a predicate (incremental_rename_vars_in_goal) that I thought
would have been useful to implement the change to cse_detection.m
that turned out to be NOT a good fix.
compiler/state_var.m:
Use the new type synonym.
tests/valid/bug50_full.m:
tests/valid/bug50.m:
Two versions of the Mantis test case; the original version (slightly
cleaned up), and the minimal version I actually debugged. The latter
has a detailed description of the bug.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Enable the new test cases.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
Delete the modules making up the MLDS->IL code generator.
compiler/globals.m:
compiler/prog_data.m:
Delete IL as a target and foreign language.
compiler/prog_io_pragma.m:
Delete the max_stack_size/1 foreign proc attribute. This was only
ever required by the IL backend.
compiler/options.m
Delete options used for the IL backend.
compiler/write_deps_file.m:
Don't generate mmake targets for .il files etc.
compiler/*.m:
Conform to the above changes.
compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
Conform to the above changes.
library/*.m:
Delete IL foreign_proc and foreign_export pragmas.
README.DotNet:
Delete this file.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
Conform the above changes.
configure.ac:
Don't check that IL is a supported foreign language when performing the
up-to-date check.
Delete the '--enable-dotnet-grades' option.
scripts/Mmake.vars.in:
Delete variables used for the IL backend (and in on case by the Aditi
backend).
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
Delete stuff related to the 'il' and 'ilc' grades.
doc/reference_manual.texi:
Delete the documentation of the 'max_stack_size' option.
doc/user_guide.texi:
Delete stuff related to the IL backend.
tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
Delete these tests: they are no longer relevant.
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
Delete IL foreign_procs where necessary.
tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
Conform to the above changes.
The big diff that replaced the item list with proper parse trees included code
that the compiler couldn't handle in decldebug grades, aborting with a message
about liveness mismatch between different switch arms. The problem occurred
when compiling this code in generate_missing_start_section_warning_int,
which is one arm of a switch on !.MissingStartSectionWarning:
!.MissingStartSectionWarning =
have_not_given_missing_section_start_warning,
!:MissingStartSectionWarning =
have_given_missing_section_start_warning,
Pieces = [invis_order_default_start(1), ...],
_Spec = error_spec(severity_error, phase_term_to_parse_tree,
[simple_msg(Context, [always(Pieces)])])
The problem was liveness.m's handling of the from_ground_term_construct
scope that is generated for the assigmnet of the ground term to Pieces.
compiler/liveness.m:
During the first pass through the procedure body, the liveness pass,
replace with the empty conjunction any from_ground_term_construct scopes
that construct terms to assign to dead variables. This prevents the
second pass, the deadness pass, from including the dead variable
(Pieces in the above example, after the assignment to _Spec was
optimized away by earlier passes) in the set of variables that
have been seen, since obviously, they won't be seen in the other arms.
This inclusion was the cause of the assertion failure that led to
the compiler abort.
Improve the existing debugging infrastructure to help find bugs like this,
by printing out what the selected procedure's body looks like before
as well as after the initial requantification.
compiler/quantification.m:
Replace from_ground_term_construct scopes whose ground term is assigned
to a dead variable with empty conjunctions, so that the compiler passes
between the first quantification after mode checking and the liveness
pass also see a smaller HLDS.
Implement an unrelated improvement whose possibility I discovered when
investigating why a version of the test case *without* the from_ground_term
scope wasn't getting the abort. When processing unifications, build up the
set of variables in the unification directly, not by recording a bunch
of maybe(somethings)s and then processing the somethings, if they existed,
later. This yields code that is shorter, simpler *and* faster.
tests/valid/liveness_disagree.m:
A new test case for this bug. It is a cut-down version of
generate_missing_start_section_warning_int.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the new test case, and try to compile it in a declarative debugging
grade.
compiler/assertion.m:
compiler/deep_profiling.m:
compiler/lookup_switch.m:
compiler/par_loop_control.m:
Add module qualifications in several places. I found the need for these
when I temporarily redefined the set_of_var type to use sets instead of
sparse_bitsets, to make debugging the bug in liveness.m easier; without
them, I got errors about excessive overloading.
Do some other cleanups as well.
tests/debugger/all_solutions.exp4:
tests/debugger/exception_cmd.exp3:
tests/debugger/loopcheck.exp3:
tests/debugger/uci_index.exp2:
tests/declarative_debugger/Mmakefile:
tests/declarative_debugger/builtin_call_rep.exp:
tests/declarative_debugger/catch_retry.exp:
tests/declarative_debugger/condition_bug.exp:
tests/declarative_debugger/find_origin.exp3:
tests/declarative_debugger/lpe_example.exp3:
tests/declarative_debugger/priv_builtin_bug.exp:
tests/declarative_debugger/solns.exp3:
tests/declarative_debugger/sort.exp:
tests/declarative_debugger/track_through_catch.exp:
tests/declarative_debugger/typed_unify.exp:
Update all these expected outputs for the changes in line numbers
caused by my cleanups of the test cases early in 2015.
For the declarative_debugger/{condition_bug,sort} test cases, also
update them for the change to print the types and values of foreign types.
tests/hard_coded/type_qual.{m,exp}:
This test case failed for an earlier version of this diff, so add some
context to its outputs, to make such failures easier to debug.
To make *that* easier, bring it to date in programming style.
There was a bug that prevented the tests in each directory from being run
in parallel, even when the mmake was invoked with e.g. -j4. The bug
was the absence of a '+' on an action that invoked tests/run_one_test.
Without that +, the make process inside the "mmake -j4 runtests_local"
command issued by bootcheck screwed up its connection with the recursive
make invoked by run_one_test, and apparently decided to stop using
parallelism. It was telling us this all this time but its messages,
which looked like this:
make[2]: warning: -jN forced in submake: disabling jobserver mode.
were lost in the sea of other bootcheck output until my recent change
to run_one_test.
A single-character change fixes the bug; the rest of this big change is
dealing with the consequences of fixing the bug. Many test cases in
the hard_coded and valid directories contain nested modules, which
need to be compiled sequentially.
tests/Mmake.common:
Fix the bug.
Delete the duplicate "ALL TESTS SUCCEEDED" message from the runtests
target, since the runtests_local target already prints a message
to that effect. Make this message more emphatic.
tests/run_one_test:
Make the output a bit easier to understand.
tests/hard_coded/*.{m,exp}:
tests/submodules/*.{m,exp}:
Move the source files and expected output files of the test cases that
use nested modules from hard_coded to submodules, since most of the tests
in the hard_coded can be done in parallel, while the ones in submodules
are already done in sequence.
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/submodules/Mmakefile:
tests/submodules/Mercury.options:
Move the Mmakefile and Mercury.options entries of the moved test cases
from hard_coded to submodules.
tests/valid_seq:
A new test directory, to hold the test cases originally in tests/valid
that contain nested modules. Moving these to a new directory, which
forces -j1, allows us to execute the remaining ones in parallel.
tests/valid/*.m:
tests/valid_seq/*.m:
Move the source files of the test cases that use nested modules
from valid to valid_seq.
In a few cases, clean up the test cases a bit.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid_seq/Mmakefile:
tests/valid_seq/Mercury.options:
tests/valid/Mmake.valid.common:
Add valid_seq/Mmakefile to list the test cases now in valid_seq,
and add valid_seq/Mercury.options to hold their option values.
Delete the entries of those tests from valid/Mmakefile, and their option
values from valid/Mercury.options. Unlike valid/Mmakefile,
valid_seq/Mmakefile forces -j1.
To avoid unnecessary duplication between the two Makefiles, put
all the rules that both need into valid/Mmake.valid.common, and
include this in both Mmakefiles.
tests/string_format/Mmakefile:
Force -j1, since these tests share a library module.
tests/Mmakefile:
List the new valid_seq directory among the others.
tests/bootcheck:
Execute the tests in the new valid_seq directory as well as the others.
Record when the execution of the test suite is started.
Comment out invocations of set -x, since they add no useful information
in the vast majority of cases. The comment sign can be removed if and
when the information *would* be useful.
Don't try to copy a nonexistent file. (The error message about this
was also lost in the noise.)
compiler/simplify_goal_ite.m:
Normally, we generate a warning if a negated goal either cannot succeed
or always succeeds. However, if the negation was duplicated as part of
the implementation of a switch, then this is wrong: a negated goal
that always succeeds when execution takes one of the arms may always fail
when execution takes another arm, and vice versa. So don't generate
such warnings in such situations.
tests/valid/negation_in_dupl_for_switch.m:
A new test case for this problem.
tests/valid/Mmakefile
Enable the new test case.
tests/valid/Mercury.options:
Set up the new test case to fail if the bug is not fixed.
Replace space sequences with tabs where needed.
This fixes Mantis bug #370.
compiler/prog_data.m:
Add a predicate to record that a predicate called "format" has
been seen, so the compiler should treat the modules that may be implicitly
imported in presence of such calls as being "used", in the sense that
we shouldn't generate unused module warnings for them.
Give the predicates that handle used modules meaningful names.
compiler/unused_imports.m:
Call the new predicate in prog_data.m when we process any predicate
called "format". We do this even if the callee is not string.format,
io.format or stream.string_writer.format, since the parser may not
have known this when implicitly importing the modules used in the
translation of calls to those predicates.
Give some predicates better names.
compiler/equiv_type.m:
compiler/hlds_module.m:
compiler/mercury_compile_front_end.m:
Conform to the changes above
tests/valid/no_warn_format_imports.m:
The test case for Mantis bug #370, under a more meaningful name.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the new test case, and compile it with the options
required to manifest the bug, if it exists.
The internal representation of a character constant as an atom term
should not use escaped character syntax; the escaping should occur
when writing the external representation only.
compiler/hlds_out_mode.m:
compiler/intermod.m:
compiler/prog_util.m:
compiler/type_constraints.m:
compiler/typecheck.m:
Fix instances of the bug.
tests/valid/Mercury.options
tests/valid/Mmakefile
tests/valid/intermod_char.m
tests/valid/intermod_char2.m
Add test case. The .opt file was invalid because the character
in the clause head was doubly-escaped.
tests/valid/bug300.m:
tests/valid/Mmakefile:
This simple test case can detect the bug in Java grades.
tests/valid/Mercury.options:
Run the new test case with --optimize-constructor-last-call
tests/hard_coded/bug300.m:
tests/hard_coded/bug300.exp:
tests/hard_coded/Mmakefile:
This more complicated test case can detect the bug in C grades. However
it requires specific CFLAGS, beyond LCMC, to do so. The symptoms of the
bug appear differently in this case.
tests/hard_coded/Mercury.options:
Setup MCFLAGS so that the test case can detect the bug.
The compiler would abort during liveness detection on an if-then-else goal
with an unreachable Then branch, due to the Then goal not having its
liveness-related fields initialised. Bug #51.
compiler/liveness.m:
As above.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/bug51.m:
Add test case.
NEWS:
Announce the change.
The bug results in a compiler crash when the compiler constructs a
typeclass info variable that it has already constructed on another branch
and there is also an existentially quantified variable present.
tests/valid/bug271.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
As above.
Branches: main, 11.07
Fix bug #229. A term with an argument produced in a from_ground_term_construct
scope was not itself being marked to be constructed statically. A side-effect
was an exception being thrown while generating a lookup switch in high-level C
grades.
compiler/mark_static_terms.m:
Add the variable constructed in a from_ground_term_construct scope
to the set of static variables.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/mark_static_bug.m:
Add test case.
Branches: main
compiler/structure_reuse.versions.m:
Revert incorrect sanity check in unification_set_reuse.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/reuse_static2.m:
Add test case.
Branches: main 11.01
Fix bug180.
bug180's symptom was a crash in the code generator when compiling ssdb/ssdb.m
with inlining in a deep-profiling grade.
The pre-profiling simplify transformation can introduce new variables and did
not update the varset in the proc_info structure, but did add new entries to
the vartypes map. Then when the deep-profiling transformation executes it
allocates it's own new variables using an old varset, causing it to clobber
existing entries in the vartypes array. This means that variables created by
the simplification transformation that are referenced by goals are now
clobbered by the deep-profiler variables
tests/valid/bug180.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Add a regression test for bug180 to the test suite.
compiler/simplify.m:
Fix bug180 by always updating the proc_info's varset.
compiler/deep_profiling.m:
Use svmap.det_insert rather than svmap.set to detect these types of errors
earlier.
compiler/handle_options.m:
Add a new dump hlds alias to help debug variable-related problems.
Estimated hours taken: 4
Branches: main
Fix Mantis bug #128.
compiler/loop_inv.m:
Fix the bug. The bug was that the loop invariants pass considered
the unification that constructed a partially instantiated term
to be an invariant goal, and attempted to hoist it out of its
predicate. Due to the free variable inside the term, this yielded
a compiler abort.
Improve the names of predicates and types.
tests/valid/bug128.m:
Add the regression test for this bug.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the test case.
Estimated hours taken: 4
Branches: main
Fix Mantis bug #159.
compiler/modecheck_goal.m:
compiler/unique_modes.m:
Fix two occurrences of the same bug. The bug was both plain mode
checking and unique mode checking, when processing from_ground_term
scopes, neglected to test whether the variable being constructed was
live or not, and thus did not delete the scope in cases where it was
not live, even though they both delete construction unifications in
such circumstances.
compiler/modecheck_unify.m:
compiler/simplify.m:
Improve the code style.
tests/valid/bug159.m:
Add the regression test for this bug.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the test case.
Estimated hours taken: 3
Branches: main
Fix Mantis bug #109.
compiler/add_heap_ops.m:
Fix the bug. The bug was that this pass tried to record the heap
pointer at the start of the nth disjunct, even in cases where
there were no following disjuncts at whose starts that saved
heap pointer could be restored (to recover the memory allocated
by the nth disjunct). The symptom was a disjunction with only
one disjunct, but the problem was a simple semantic one. The fix
is simply to say that we won't record the heap pointer before the nth
disjunct unless disjunct n+1 exists.
Improve the generated HLDS in another way as well: wrap the appropriate
kind of promise_purity scope around the transformed code (which uses
impure primitives).
tests/valid/bug109.m:
Add the regression test for this bug.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Enable the test case.
Branches: main, 10.04
Work around bug #142. The symptom is an assertion failure in
hlds.hlds_rtti.apply_substs_to_constraint_map. It occurs when:
- a variable holding a typeclass_info is used multiple times in a call;
- the called procedure is inlined into the caller;
- the corresponding head variables have class constraints with functional
dependencies;
- the type variables in those constraints should be unified, but type variables
in the ranges of functional dependencies are not unified;
- a single typeclass_info variable ends up being for two different constraints.
The work around adopted here is to prevent inlining of a call when a single
typeclass_info variable appears multiple times in the argument list, for which
the head variables have differing class constraints.
compiler/inlining.m:
As above.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/bug142.m:
Add test case.
Branches: main, 10.04
compiler/mode_util.m:
Fix a problem where recomputing the instmap_delta over a negation
goal would change its reachability from `unreachable' to `reachable'.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/neg_erroneous.m:
Add test case.
Branches: main, 10.04
More test case fixes in the valid tests.
tests/valid/Mercury.options:
Compile a bunch of tests that force either the grade (or a component
thereof) with --no-intermodule-optimization, since the necessary .opt
files may not exist if the grade is not installed. (None of the tests
is checking for something that will be masked by
--no-intermodule-optimization.)
Branches: main, 10.04
Fix three failures in the valid tests.
tests/valid/Mercury.options:
The tests liveness_ite, livevars_shallow, and livevars_shallow2
all force the grade to be set to "none".
Disable --intermodule-optimization for these tests, otherwise the
compiler halts with an error when it cannot find the .opt files
in grade none.
Estimated hours taken: 0.5
Branches: main
Fix Mantis bug #134.
compiler/ml_disj_gen.m:
If the options specify --no-static-ground-terms, do not try to
generate lookup tables for disjunctions; the trying would lead
to a compiler abort (bug 134), and we cannot generate the table
anyway.
tests/valid/bug134.m:
tests/valid/Mmakefile:
tests/valid/Mercury.options:
Add the test case for this bug.
interface as unused even though the import is required in order to satisfy the
superclass constraints on an exported type class instance. (The situation
is explained in detail in the diff.)
The fix is to assume that when checking for unused modules, an imported module
that provides a type class instance is used. We can (and do) avoid this
assumption if the importing module does not export any type class instances
since in that case the erroneous warning cannot occur.
compiler/module_qual.m:
Keep tracking of which imported modules export type class instances
and whether the current module exports any.
Using the above information, avoid incorrectly reporting modules
imported in the interface as unused if they are in fact required
because of superclass constraints on instances.
(This is somewhat inelegant, but alternative fixes would require
either (a) delaying the unused module check until after the HLDS
has been constructed, or (b) doing more work on the parse tree
to make information about type class and instances available.
Both of these are much larger changes.)
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/bug100*.m:
Regression test for bug 100.
tests/warnings/Mmakefile:
tests/warnings/unused_interface_import*.m:
tests/warnings/unused_interface_import.exp:
Check that we still emit a warning about unused modules
that export instances if the module compiled does _not_
export any instances.
Branches: main
Fix a long standing bug in the liveness detection pass.
compiler/liveness.m:
In detect_deadness_in_goal, when the instmap delta for an if-then-else
goal is `unreachable', call `add_branch_pre_deaths' for the condition
and else goals with the InstmapReachable argument `no', not `yes'.
This avoids triggering a sanity check later in the
detect_resume_points_in_goal pass on the following test case.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/liveness_ite.m:
Add test case.
Branches: main
Revert a change committed on 2009-08-21 to prevent a compiler abort when using
--trace shallow on a test case. The change caused aborts with other modules.
Fix the original bug a different way, and another bug with --trace shallow.
compiler/live_vars.m:
Revert the old change.
Add a check that variables needed across a call do not appear in the
post-death set of that call.
Only add typeinfo variables to the set of variables needed across a
call for output variable which are not local to the call. Otherwise
the sanity check fails on livevars_shallow2.m.
compiler/liveness.m:
A switch variable which needs to be added to the pre-death set of a
case may require typeinfo variables which describe the type of that
variable to be added to the pre-death set as well. This fixes the
problem with livevars_shallow.m.
tests/valid/livevars_shallow.m:
Replace this test case by another derived from the same original file.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/livevars_shallow2.m:
Add test case.
Branches: main
Support --optimize-constructor-last-call in the java grade, and possibly other
grades using high-level data.
compiler/handle_options.m:
Don't disable --optimize-constructor-last-call on high-level data, nor
if the target language is Java.
compiler/lco.m:
Use a modified transformation when targetting high-level data that
doesn't require taking the address of fields nor using the store_at_ref
builtin.
compiler/ml_unify_gen.m:
Handle the `take_address_fields' part of a construction unification
differently when targetting high-level data.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/lco_term.m:
Add a test case.
Branches: main
Fix a compiler abort when compiling the given program with --trace shallow.
compiler/live_vars.m:
Remove any call forward vars from the post-deaths set of a goal.
In the test program, a typeinfo variable added to the forward vars set
by maybe_add_typeinfo_liveness was already in the post-death set.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/livevars_shallow.m:
Add test case.
Branches: main
Fix bug #90. The compiler would abort on the given program when performing
higher order/type specialisation due to "inconsistent type_infos".
compiler/higher_order.m:
In interpret_typeclass_info_manipulator, when assigning to a variable
TypeInfoVar the extracted field of a type_info TypeInfoArg, duplicate
the TypeInfoArg rtti_var_info for TypeInfoVar.
On the test program the rtti_var_info for TypeInfoVar already existed
but was for the procedure *before* specialisation, which is what
lead to the inconsistent type_infos message.
compiler/hlds_rtti.m:
Add version of rtti_var_info_duplicate which doesn't abort if the
rtti_varmap already has an entry for the target variable.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/tci_spec_varmap.m:
Add test case.