library/string.format.m:
Delete the old predicates for formatting ints as unsigned values;
these are now unused.
configure.ac:
Require the use of a compiler that does not generate references
to the deleted predicates.
compiler/introduced_call_table.m:
Delete the above predicates from the introduced call table.
Use the recently added --trans-opt-deps-spec option to break cycles in
the trans-opt dependency graph for the standard library. This enables
more parallelism when making the .trans_opt files; it now takes about
half as long as before.
Ordering modules sensibly, so that .trans_opt files are created in a
logical order, also improves analysis results for many predicates and
functions. The only results which show a regression with this change are
for deprecated forwarding predicates/functions.
In future, we will probably be able to trim more dependencies to further
improve parallelism, without impacting analysis results.
configure.ac:
Check that the bootstrap compiler supports --trans-opt-deps-spec.
library/mer_std.trans_opt_deps_spec:
Add the spec file that adjusts dependencies in the trans-opt
dependency graph.
library/INTER_FLAGS:
Use the --trans-opt-deps-spec option when building with mmake.
scripts/prepare_install_dir.in:
tools/binary:
tools/bootcheck:
tools/unary:
Copy mer_std.trans_opt_deps_spec when preparing a copy of the
library directory.
Rename mmc and mgnuc options that set this grade component to --c-debug-grade.
Let the options named --c-debug of both mmc and mgnuc enable C level debugging
of only the module being compiled.
runtime/mercury_grade.h:
Rename the .ll_debug grade component to .c_debug. Also rename the C macro
that controls the presence or absence of this grade component
from MR_LL_DEBUG to MR_C_DEBUG_GRADE.
runtime/mercury_conf_param.h:
runtime/mercury_debug.c:
runtime/mercury_debug.h:
runtime/mercury_engine.c:
runtime/mercury_label.c:
runtime/mercury_memory_zones.c:
runtime/mercury_memory_zones.h:
runtime/mercury_overflow.c:
runtime/mercury_std.h:
runtime/mercury_wrapper.c:
Rename the MR_LOWLEVEL_DEBUG macro to MR_DEBUG_THE_RUNTIME.
Previously, the name of this macro wrongly implied that it had
something to do with the old .ll_debug grade component, even though
- the MR_LOWLEVEL_DEBUG macro was designed to debug LLDS grades,
since only these existed when it was created, while
- the .ll_debug grade component (now .c_debug) is useful only for
MLDS grades targeting C.
compiler/options.m:
Rename the old confusingly named low_level_debug option to c_debug_grade.
Move it to the list of grade options, and fix its documentation, which
was completely wrong:
- code in compile_target_code.m treated it as being a synonym of
the .ll_debug (now .c_debug) grade component, while
- its (commented out) documentation here in options.m said it called for
the enabling of what is now MR_DEBUG_THE_RUNTIME.
compiler/compile_target_code.m:
Conform to the rename just above.
Define MR_C_DEBUG_GRADE instead of MR_LL_DEBUG if c_debug_grade is enabled.
Pass -g to the C compiler if either c_debug_grade or target_debug
is enabled.
Add an XXX about a missing safety check for an obsolete experimental
feature.
compiler/compute_grade.m:
When given a grade with a .c_debug grade component, set only the
c_debug_grade option; don't set the target_debug option, which is NOT
a grade option. The change to compile_target_code.m above handles the
only situation in which this implication was formerly required.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Look for and process the .c_debug grade component instead of .ll_debug.
Use a sh variable named c_debug_grade to record its absence/presence.
Look for and process the --c-debug-grade grade-component option,
setting the same sh variable, c_debug_grade. (All grade components
can be set piecemeal using sh options to the scripts using these
subroutines.) This replaces the old, confusingly named option
--low-level-debug.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Consistently use the sh variable c_debug to record the presence of
the (non-grade) --c-debug option to mgnuc, and the sh variable
c_debug_grade to record the presence of the .c_debug grade component.
Stop looking for and handling the --low-level-debug option, which
mgnuc used to document, even though this duplicated the same documentation
in init_grade_options.sh-subr, which mgnuc includes. The difference was
that init_grade_options.sh-subr meant it to represent the old .ll_debug
MLDS grade component, while mgnuc treated it as specifying what is now
MR_DEBUG_THE_RUNTIME for LLDS grades. It didn't help that two sh variables
with quite different semantics had names that differed only in an
underscore: LLDEBUG_OPTS vs LL_DEBUG_OPTS.
scripts/Mmakefile:
Add a missing dependency to force the rebuild of mgnuc after each update
of its sh subroutine mgnuc_file_ops.sh-subr.
doc/user_guide.texi:
Document the --c-debug-grade option of mmc. This option was not publicly
documented under its original misleading name (--low-level-debug), but
its documentation is now possible without contorted dancing around the
name.
Clarify the documentation of mgnuc's --c-debug option.
README.sanitizers:
configure.ac:
Conform to the rename of the grade component.
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/try_all_grade_structs.m:
Conform to the rename of the grade component .ll_debug to .c_debug.
Don't allow the .c_debug grade component in LLDS grades.
In grade_string.m, add some obvious implications of some grade components.
grade_lib/choose_grade.m:
grade_lib/grade_lib.m:
grade_lib/test_grades.m:
grade_lib/var_value_names.m:
Fix white space.
scripts/ml.in:
tools/lmc.in:
tools/test_mercury:
Conform to the change in compile_target_code.m to the naming of
Boehm gc library variants.
compiler/const_prop.m:
As above.
Handle / in both int.m and uint.m the same way as //, since / is a
synonym of // in both modules.
Also, handle the compile-time evaluation of plus, minus, and
unchecked_quotient in uint.m. Previusly, we only evaluated
their synonyms +, -, * and //.
configure.ac:
Require the installed compiler to contain the fix for a bug that
prevents compilation of the new code of const_prop.m in hlc grades.
... along with their unchecked equivalents. These differ from <<, >> and
their unchecked equivalents in that they take the shift amount as a uint,
instead of an int.
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
As above. The unchecked versions have only declarations, since
these operations have been recognized as builtins for a while now.
NEWS:
Document the new operations, and the recent change to recognize
<<u and >>u as single tokens, and fix a typo in a recent addition.
configure.ac:
Require the compiler to be sufficiently recent to be able to parse
<<u and >>u as operators.
compiler/options.m:
Provide a way for a later change to configure.ac to detect the presence
of this change.
tests/hard_coded/bitwise_int.exp:
tests/hard_coded/bitwise_int.exp2:
tests/hard_coded/bitwise_int.m:
tests/hard_coded/bitwise_int16.exp:
tests/hard_coded/bitwise_int16.m:
tests/hard_coded/bitwise_int32.exp:
tests/hard_coded/bitwise_int32.m:
tests/hard_coded/bitwise_int64.exp:
tests/hard_coded/bitwise_int64.m:
tests/hard_coded/bitwise_int8.exp:
tests/hard_coded/bitwise_int8.m:
tests/hard_coded/bitwise_uint.exp:
tests/hard_coded/bitwise_uint.exp2:
tests/hard_coded/bitwise_uint.m:
tests/hard_coded/bitwise_uint16.exp:
tests/hard_coded/bitwise_uint16.m:
tests/hard_coded/bitwise_uint32.exp:
tests/hard_coded/bitwise_uint32.m:
tests/hard_coded/bitwise_uint64.exp:
tests/hard_coded/bitwise_uint64.m:
tests/hard_coded/bitwise_uint8.exp:
tests/hard_coded/bitwise_uint8.m:
Check that <<u and >>u compute the same results as << and >> respectively.
On MacOS, make configure use the value of MACOSX_DEPLOYMENT_TARGET as
the default deployment target (if set), otherwise falling back to the
host system version.
configure.ac:
As above.
README.MacOS:
NEWS:
Document the change.
configure.ac:
Require the installed compiler to support disable_warning scopes
for unknown_format_calls.
compiler/Mercury.options:
library/Mercury.options:
Do not disable unknown_format_call warnings in whole files.
compiler/parse_tree_out_info.m:
compiler/pd_debug.m:
library/io.m:
library/stream.string_writer.m:
library/string.m:
Disable unknown_format_call warnings for just the format calls
that need it.
configure.ac:
Use the AC_CHECK_TOOL macro to search for the strip command on the
PATH. This is more consistent with how other commands are configured
(eg. ar and nm).
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.
The basic block vectorizer optimisation in GCC 11 and 12 is generating code
that causes segmentation faults in grades that use non-local gotos.
As a workaround, disable that optimisation for GCC 11 and later.
(While this problem has presumably always existed for GCC 11, it has not shown
up previously because the affected optimisation is only enabled at -O3; with
GCC 12 it is enabled by default. GCC 10 and earlier do not appear to be
affected.)
configure.ac:
Add the above workaround.
Programs using non-local gotos on AArch64 crash when compiled with
newer versions of GCC:
gcc 6.3.0 (Debian 9) - ok
gcc 8.3.0 (Debian 10) - ok
gcc 9.3.0 (Debian 11) - crash
gcc 10.2 (Debian 11) - crash
Specifically, the programs only crash when compiled with PIC,
but PIC is commonly the default now.
This is Mantis bug #560.
configure.ac:
Disable non-local gotos on AArch64 when using GCC 9+.
README.Linux-aarch64:
Mention the problem.
As mentioned recently on the developers list, GCC versions 9 10 and 11 are
emitting suprious warnings with -Warray-bounds for the specialised code they
introduce for strcmp etc. Disable that warning for those versions of GCC. In
addition to this issue, according to the GCC bug database is is generating a
lot of false positives anyway.
configure.ac:
scripts/mgnuc.in:
As above.
In configure, we try detect the non-working combination of gcc 5+,
targeting x86, PIC, and non-local gotos. We assumed that PIC is only
generated when creating shared libraries, but gcc may have been
configured to generate PIC by default. This is very common on more
recent Linux distributions.
configure.ac:
Extend the test mentioned above: if shared libraries are disabled,
check whether gcc generates PIC anyway.
Clean up the code a little.
m4/mercury.m4:
Add helper macros MERCURY_CC_TARGETS_X86 and
MERCURY_CC_GENERATES_PIC.
README.x86:
Update this document.
compiler/mercury_compile_main.m:
I added that option a week or so ago, but at that time, it did nothing.
This diff implements the warning.
library/LIB_FLAGS.in:
Disable the warning for the modules in the library directory.
configure.ac:
Require the installed compiler to recognize the option, since without this,
library/LIBFLAGS won't work.
tests/warnings/profiling_builtin.{m,exp}:
tests/warnings/time.{m,exp}:
tests/warnings/time.subtime.m:
Two test cases for the warning. One, time, shadows the name of
a documented library module, the other, profiling_builtin,
shadows the name an undocumented library module.
The purpose of time.subtime is to test the message when the module name
*contains* a stdlib module name, but is not *identical* to it.
tests/warnings/Mmakefile:
Do *not* turn on the new test cases, but do document why we do not do so.
configure:
Change default value of enable_gc_mmap and enable_gc_munmap to yes.
Invert sense of --enable-gc-mmap and --enable-gc-munmap options in
the help text.
NEWS:
Announce change.
configure.ac:
Use single quotes for quoting in configure script messages.
Using `' results in warnings from autoconf.
Delete a stray comma from the test for GNU make.
as the default for the Mercury system.
configure.ac:
Require the installed compiler to support this option.
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
grade_lib/GRADE_LIB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Specify this option as the default in their directories.
According to the changelog for autoconf 2.70, many macros have become pickier
about argument quotation. Add quotes to the configure script to avoid these
problems.
Delete unnecessary use of changequote (whose use the autoconf manual recommends
against anyway.)
configure.ac:
As above.
configure.ac:
Require at least autoconf 2.69 (released 2012).
Avoid a warning about an obsolete macro from autoconf 2.70 onwards:
s/AC_HELP_STRING/AS_HELP_/STRING/
configure.ac:
Detect a signal handler being invoked over and over in a loop for a
single SIGSEGV signal; fail the test in that case.
This has been observed on Ubuntu 18.04.5 amd64 (running on a VPS),
when using gcc -m32 to target x86. As far as I understand, this is
not supposed to happen, so it is probably a bug.
configure.ac:
Run the C compiler to check if it actually targets x86-64.
Previously we assumed if $host is x86_64 then the C compiler will be
targeting x86-64, but that is not true if gcc -m32 or gcc -mx32 is
used.
Then, as before, if the C compiler targets x86 and dynamic linking
is enabled (except on Windows) and GCC is version 5+ then disable
selection of any grades that use gcc labels.
runtime/mercury_goto.h:
Report an error if the user tries to use non-local gotos with PIC
on x86 with GCC 5+.
README.x86:
Document the issue.
README.md:
Add reference to README.x86.
runtime/machdeps/aarch64_regs.h:
runtime/mercury_regs.h:
Define global registers for aarch64.
configure.ac:
Compile with -fomit-frame-pointer on aarch64. (Doing so frees
up register x29.)
Compile with -fPIC instead of -fpic on aarch64-*-linux* systems
in order to avoid size limits on the global offset table.
This fix uses the approach discussed on m-dev 2020 nov 16/17 for fixing
github issue #72, whose core problem is a need for information flow
back to a the caller from a callee when the callee fills in the
argument of a function symbol whose representation is a direct_arg tag.
In most cases when the callee fills in the value of an argument,
the caller can see it because the argument is in a word on the heap,
but when the function symbol uses a direct_arg tag, that is not the case.
compiler/direct_arg_in_out.m:
A new module that implements the transformation proposed on m-dev.
It creates a fresh clone variable every time an argument of a direct_arg
tag function symbol is (or may be) updated. This can happen several
times if a type has more than one function symbol with a direct_arg tag.
Since the affected variable can be bound to only one function symbol
at the start, its argument can be filled in only once, but the
compiler cannot know in advance what function symbol the variable
contains, and therefore which of the possibly several fill-in sites
(which fill in the arguments of different function symbols) executed
in sequence will actually update the variable.
The transformation ensures that once a variable is cloned, it is
never referred to again. It also ensures that in a branched control
structure (if-then-else, disjunction or switch), all branches will use
the *same* variable to represent the latest version of each cloned
variable at the end, so that following code has a consistent view
regardless of through which branch execution has reached it.
There are three situations that the transformation cannot and does not
handle.
1. Situations in which the mode of an argument is either an inst variable,
or an abstract inst. In either case, the pass cannot know whether
it should apply its transformation to the argument.
2. Situations where a procedure that has such an argument is
exported to C code as a function. In that case, the C signature
of the function we would generate would be different from what
the user would normally expect. We could modify the documentation
of the export pragma, but I don't think there much point due to
lack of demand. (The problem cannot arise when targeting any language
other than C, because we use direct_arg tags only with the low level
data representation, which we only use for C.)
3. Situations where a procedure that has such an argument is defined
by foreign_proc. Again, dealing with the problem would require
nontrivial changes to the documented interface between code in
foreign_procs and the surrounding Mercury code, and I see no demand
for code that could benefit from that.
In these cases, this module generates error messages.
compiler/transform_hlds.m:
Include the new module in the transform_hlds package.
Delete unnecessary module qualification on some existing inclusions.
Put some existing inclusions into a more meaningful order.
compiler/notes/compiler_design.html:
Document the new pass. Fix some nearby prose.
compiler/lambda.m:
compiler/simplify_proc.m:
Use a predicate exported by direct_arg_in_out.m to test, for each
procedure, whether the procedure has any argument positions that are
subject to the problem that direct_arg_in_out.m addresses.
simplify_proc.m does this for all procedures it processes;
lambda.m does this for all the procedures it creates from
lambda expressions.
Give a predicate in simplify_proc.m a better name.
Sort a list of predicate names.
compiler/hlds_module.m:
Add a field to the module_info that simplify_proc.m and lambda.m
can use to tell direct_arg_in_out.m what work (if any) it needs to do.
compiler/mercury_compile_middle_passes.m:
Invoke direct_arg_in_out.m if the new field in the HLDS indicates
that it has some work to do. (In the vast majority of compiler invocations,
it won't have any.)
compiler/hlds_pred.m:
The new code in direct_arg_in_out.m creates a clone of each procedure
affected by the problem, before deleting the originals (to make sure that
no references to the unfixed versions of now-fixed procedures remain.)
Make it possible to create exact clones of both predicates and procedures
by adding two pairs of predicates, {pred,proc}_prepare_to_clone and
{pred,proc}_create.
Add the direct_arg_in_out transformation as a possible source
of transformed predicates.
library/private_builtin.m:
Add a new builtin operation, partial_inst_copy, that the new module
generates calls to.
configure.ac:
Require the installed compiler to recognize partial_inst_copy
as a no_type_info builtin.
compiler/builtin_ops.m:
Recognize the new builtin. (This was committed before the rest; the diff
to private_builtin.m can be done only once the change to builtin_ops.m
is part of the installed compiler.)
compiler/options.m:
Add a way to test whether the builtin_ops.m in the installed compiler
recognizes the new builtin.
compiler/dead_proc_elim.m:
Do not delete the new primitive before direct_arg_in_out.m has had
a chance to generate calls to it.
Add an XXX.
compiler/error_util.m:
Recognize the new module as a source of error messages.
compiler/pred_table.m:
Add a pair of utility predicates to be used when looking up
builtin predicates, for which the compiler writer knows that
there should be exactly one match. These are used in direct_arg_in_out.m.
compiler/simplify_goal_call.m:
Replace some existing code with calls to the new predicates
in pred_table.m.
compiler/hlds_goal.m:
Add modes to rename_vars_in_goal_expr that express the fact
that when an atomic goal_expr has some variables renamed inside it,
it does not suddenly become some *other* kind of goal_expr.
New code in direct_arg_in_out.m relies on this.
compiler/hlds_out_goal.m:
When the HLDS we are dumping out is malformed because it contains
calls to predicates that have been deleted, the compiler used to abort
at such calls. (I ran into this while debugging direct_arg_in_out.m.)
Fix this. When such calls are encountered, we now print out as much
information we can about the call, and prefix the call with an
unmistakable prefix to draw attention to the problem.
compiler/inst_util.m:
Fix a bug that prevented direct_arg_in_out.m from even being invoked
on some test code for it.
The bug was in code that we use to unify a headvar's initial inst
with its final inst. When the initial inst was a non-ground bound_inst
such as the ones used in tests/hard_coded/gh72.m, and the final inst
was simply "ground", this code quite properly returned a bound_inst
(which, unlike ground, can show the exact set of function symbols
that the headvar could be bound to). The problem was that it
reused the original bound_inst's test results, including the one
that said the final inst is NOT ground, which of course is wrong
for any inst unified with ground. Fix two instances of this bug.
compiler/modes.m:
Make some of the code I had to traverse to find the bug in inst_util.m
easier to read and understand.
Replace some uses of booleans with bespoke enum types.
Change the argument lists of some predicates to put related arguments
next to each other.
Give some variables more descriptive names.
compiler/layout_out.m:
Conform to the change in hlds_pred.m.
compiler/var_locn.m:
Fix a code generation bug. When filling-in the value of the argument
of a function symbol represented by a direct_arg tag, the code we
generated for it worked only if the direct_arg tag used 0
as its ptag value. In the test cases we initially used for
github issue 72, that was the case, but the new tests/hard_coded/gh72.m
has direct_tag args that use other ptag values as well.
Document the reason why the updated code works.
compiler/term_constr_initial.m:
Add the new primitive predicate added to private_builtin.m,
partial_inst_copy, to a table of builtins that do not take type_infos,
even though their signatures contain type variables.
Fix a bunch of old bugs: most other such primitives were not listed
either.
mdbcomp/program_representation.m:
Add partial_inst_copy to the master list of builtins that do not take
type_infos even though their signatures contain type variables. (Done
by an earlier commit.)
Document the fact that any updates here require updates to
term_constr_initial.m.
library/multi_map.m:
We have long had multi_map.add and multi_map.set as synonyms,
but we only had multi_map.reverse_set. Add multi_map.reverse_add
as a synonym for it.
Define the "set" versions in terms of the "add" versions,
instead of vice versa.
NEWS:
Document the new predicates in multi_map.m.
tests/hard_coded/gh72a.m:
Fix typo.
tests/hard_coded/gh72.{m,exp}:
A new, much more comprehensive test case than gh72a.m.
This one tries to tickle github issue 72 in as many forms of code
as I can think of.
tests/invalid/gh72_errors.{m,err_exp}:
A test case for testing the generation of error messages for
two out of the three kinds of situations that direct_arg_in_out.m
cannot handle. (Proposals for how to test the third category welcome.)
tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
Enable the two new test cases, as well as two old ones, gh72[ab].m,
that previously we didn't pass.
tests/invalid/Mercury.option:
Do not compile gh72_error.m with --errorcheck-only, since its errors
are reported by a pass that --errorcheck-only does not invoke.