library/list.m:
Add a predicate version of map_corresponding3.
Move a predicate next to its only call site.
Use more meaningful variable names.
library/map.m:
library/tree234.m:
Add several predicates: foldl4_values, foldl5_values, filter_map_values
and filter_map_values_only.
library/multi_map.m:
Embed an implicit assertion in a call.
library/set_ordlist.m:
Give a predicate a better name.
library/NEWS:
Announce the new additions.
Put the list of updated library modules back into alphabetical order.
tests/hard_coded/test_map_filter.{m,exp}:
Test the one wholly new utility predicate.
library/math.m:
Since code in math.m uses C macros defined in a foreign_decl in float.m,
math.m needs a foreign_import_module for float, but it did not have one.
This caused compilation of math.c to math.o to fail *except* with
intermodule optimization, which gave math.m the required access to
float.m's internals anyway. The reason we didn't notice is that
intermodule optimization is the default.
Until now, we have supported two variants of trailing grades, those that use a
fixed-size trail (.tr) and those that use trail segments (.trseg). This change
removes support for fixed sized trails, and renames the .trseg grade component
to .tr. The .trseg grade now acts a synonym for .tr; it is deprecated, since we
intend to eventually delete it. Until then, the behavior of the old .tr grade
component should be available, though to developers only, by compiling the
whole system with EXTRA_CFLAGS = -DMR_USE_FIXED_SIZE_TRAIL.
runtime/mercury_conf_param.h:
Delete the MR_TRAIL_SEGMENTS macro. Its effect is now implied by
MR_USE_TRAIL, unless a new macro, MR_USE_FIXED_SIZE_TRAIL, is defined.
Developers can use this new macro to disable trail segments, should the
need for doing that arise.
runtime/mercury_grade.h:
Add a new macro that defines a binary compatibility version number for
trailing; use that in the grade part for trailing.
Use "_trfix" or "_trseg" as the prefix of the trailing part of the
MR_GRADE_VAR depending on if MR_USE_FIXED_SIZE_TRAIL is defined or
not.
runtime/mercury_trail.[ch]:
runtime/mercury_context.h:
Enable trail segments by default, only disabling them if
MR_USE_FIXED_SIZE_TRAIL is enabled.
runtime/mercury_wrapper.c:
trace/mercury_trace_cmd_developer.c:
Conform to the above changes.
compiler/compile_target_code.m:
Do not pass options for trail segments to the C compiler.
compiler/compute_grade.m:
Treat trseg as a synonym for tr.
compiler/options.m:
Deprecate --trail-segments.
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/grade_vars.m:
grade_lib/try_all_grade_structs.m:
grade_lib/var_value_names.m:
Remove the trseg component.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Remove support for the --trail-segments option.
doc/user_guide.texi:
Update the documentation for the --trail-segments.
Comment out the documentation of the --trail-size and --trail-size-kwords
runtime options; they are no longer useful to non-developers.
NEWS:
Announce this change.
library/thread.closeable_channel.m
Add the new module. It omits two operations from thread.channel.m:
- untake, because it is deprecated
- duplicate, because I'm not sure what it's useful for in practice
library/MODULES_DOC:
library/library.m
library/thread.m:
NEWS:
Mention the new module.
A call to channel.untake will deadlock if a call to channel.take is
blocked on the same channel.
unGetChan was removed from GHC for the same reason:
https://gitlab.haskell.org/ghc/ghc/issues/4154
library/thread.channel.m:
Deprecate channel.untake/4.
NEWS:
Announce the change.
library/hash_table.m:
Switch to using kv_lists to represent items in overflowing buckets.
This is both cleaner and more efficient.
Give many types, function symbols, predicates, functions and variables
more meaningful names.
Add XXXs to mark some significant potential problems.
When an operation has both function and predicate forms, make the
function form forward to the predicate form, as we do in the rest
of the standard library.
Make equality testing between a key in a hash bucket and a search key
explicit in all cases.
library/kv_list.m:
Add some functionality that hash_table.m now needs from kv_lists.
library/assoc_list.m:
Add some functionality that kv_list.m now has, to maintain parity
between the two modules.
NEWS:
Announce the changes to assoc_list.m. (The changes to kv_list are moot,
since it is a new module.)
tests/hard_coded/hash_table_test.{m,exp}:
Make the progress messages output by this test more meaningful,
and update its programming style.
library/kv_list.m:
This new module is a version of assoc_list.m in which the list of
key-value pairs is represented not by a list of pairs (which has
two two-word cells per key-value pair) but by a bespoke, flattened
data structure (which has one three-word cell per key-value pair).
This should improve performance by reducing the number of memory
allocations and traffic to and from the data cache. (The *amount*
of memory allocated will not be affected, since Boehm rounds up
three words to four. And since cache block sizes are also powers
of two, traffic to and from memory should stay roughly the same.)
The new module has one operation for every operation in assoc_list.m,
plus two functions for converting between assoc_lists and kv_lists
(one for each direction).
library/assoc_list.m:
Improve comments on some exported predicates and/or functions.
Add a lookup operation on assoc lists as a predicate. This operation
already existed as a field access function; not having it available
using normal syntax was a bit strange.
library/library.m:
library/MODULES_DOC:
NEWS:
Mention the new module.
Currently, the hash functions for (some of) the primitive types are defined in
three places:
1. The hash_table module.
2. The version_hash_table module (duplicates of the above).
3. Some (but not all) of the library modules for the primitive types.
This change makes the library module for a primitive type provide the hash
function for that type and deprecates the versions in the hash table modules.
Additionally, deprecate the "generic" has functions in the hash table modules.
library/hash_table.m:
library/version_hash_table.m:
As above.
library/char.m:
library/int.m:
library/uint.m:
Add hash/1 and hash/2.
library/float.m:
Add hash/2.
library/robdd.m:
Replace a call to the deprecated function.
NEWS:
Announce the above additions and deprecations.
tests/hard_coded/hash_table_delete.m:
tests/hard_coded/hash_table_test.m:
tests/hard_coded/version_hash_table_delete.m:
tests/hard_coded/version_hash_table_test.m:
Conform to the above change.
compiler/options.m:
Uncomment help text for --warn-suspicious-recursion.
(It was already documented in the user guide.)
NEWS:
Add --warn-suspicious-recursion as new to the 20.01 release.
Common subexpression elimination (cse) declines to do its job of transforming
(
X = f(A1, ..., An),
goal A
;
X = f(B1, ..., Bn),
goal B
)
into
X = f(X1, ..., Xn),
(
A1 = X1, ..., An = Xn,
goal A
;
B1 = X1, ..., Bn = Xn,
goal B
)
when the insts of some of X's arguments are at least partially unique,
because mode analysis cannot track uniqueness through the extra unifications
that this transformation introduces. When this happens, and the procedure
this code is in does not match its declared determinism, generate a message
that gives this fact as a possible reason for that determinism mismatch.
This fixes Mantis bug #496 to the extent that we *can* fix it
without rewriting the whole of mode analysis.
compiler/hlds_pred.m:
Provide a slot in the proc_info for recording whether cse has declined
to pull a common unification out of a branched control structure because
of this concern, and if so, at what locations in the source code.
An unrelated change: move a slot used only by constraint-based mode
analysis, which is never enabled, from the proc_info to the proc_sub_info.
This should improve both speed and memory consumption, though very
slightly.
compiler/cse_detection.m:
Record each such location in this slot.
Doing this requires a change in approach. Previously, we did not try
to pull a unification out of any branch of a branched control structure
if it involved (partially or wholly) unique arguments. However, doing
this in just one branch cannot possibly affect the output of cse detection,
since it pulls a unification out of a branch only if can pull the same
unification out of all the other branches as well.
Our new approach is to transform branched control structures regardless
of uniqueness, and then *undo* the transformation (simply by discarding
its result) if it involves unique arguments. It is such undoing that we
record in the proc_info.
compiler/switch_detection.m:
Conform to the new approach.
compiler/hlds_out_pred.m:
Print the contents of the new slot in HLDS dumps.
compiler/det_report.m:
If the actual determinism of a procedure, as computed by determinism
analysis, does not match its declared determinism, *and* if the proc_info's
new slot says that cse declined to pull some common unifications
out of a branched control structure, then mention that fact, and
the usual fix, as a possible explanation of the determinism problem.
tests/invalid/bug496.{m,err_exp}:
The Mantis test case.
tests/invalid/Mmakefile:
Enable the new test case.
Delete some procedures that have been marked as obsolete since before the 14.01
release.
library/hash_table.m:
library/version_array.m:
As above.
NEWS:
Announce the deletions.
tests/hard_coded/hash_table_delete.m:
Replace a call to one of the deleted functions.
This avoid a link error when using clang's ThinLTO mode:
error: Failed to link module
../trace/libmer_eventspec.a.llvm.18688.mercury_event_parser.c:
Expected at most one ThinLTO module per bitcode file
compiler/Mmakefile:
Remove libmer_eventspec.a from MLOBJS.
Mmake.workspace already causes the library to be linked in.
configure.ac:
Add -flto to LINK_SHARED_OBJ and LINK_SHARED_OBJ_SH commands
when LTO is enabled with clang.
Search for and use LTO-aware llvm-ar, llvm-ranlib and llvm-nm
programs in place of the normal tools.
configure.ac:
Add -flto to LINK_SHARED_OBJ and LINK_SHARED_OBJ_SH commands
when LTO is enabled with gcc.
Search for and use LTO-aware gcc-ar, gcc-ranlib and gcc-nm
programs in place of the normal tools.
MSYS2 provides a POSIX like environment and package manager for Windows.
It packages up the MinGW-w64 port of GCC. (MSYS2 is separate from the
original MSYS.)
Make it possible to build Mercury under MSYS2 with the MinGW-w64 GCC
without having to resort to cross compilation.
configure.ac:
Recognise the x86_64-pc-mingw* architecture returned by config.guess
under MSYS2.
If we are building the MSVC port under MSYS2, set up the flags for
threads appropriately.
scripts/ml.in:
Pass libraries to the linker correctly for static linking on all the
different MinGW configurations.
README.MinGW:
Update documentation for MinGW ports.
compiler/mode_errors.m:
Simplify the wording of the new error message component added yesterday.
Mention a possible reason for inst mismatches when the inst contains
a higher order component. Put this in the parentheses, because it is
*not* guaranteed to be the actual reason.
compiler/inst_util.m:
Add a utility predicate for the new code in mode_errors.m.
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/try_detism.err_exp:
Expect the updated error messages.
compiler/mode_errors.m:
There are two improvements.
The first and much the more important is that when a call does not match
any of the declared modes of the called predicate or function, we now
print the names and insts of any arguments whose insts, by themselves,
do not match any of the callee's modes. Instead of reporting "here are
all the arguments, here are all their insts, find out for yourself
which one is wrong", the compiler now tells the programmer explicitly
which one is wrong in almost all cases. (Not all. If e.g. two args <A, B>
have insts <free, free>, but the callee has two modes, <in, out> and
<out, in>, then the compiler won't report either arg, since neither arg
is wrong by itself.)
The second improvement is that when the verbosity settings ask us
to print all possible reasons why we can't schedule a conjunction,
instead of our default approach of printing the only the first,
we now put a blank line between the different reasons, for visual
separation.
compiler/modecheck_call.m:
Preserve the extra information now needed by mode_errors.m.
compiler/modecheck_util.m:
Conform to the changes above.
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/try_detism.err_exp:
Expect the updated error messages for these tests.
scripts/ml.in:
Shared libraries are now the default on FreeBSD systems.
Handle 64-bit Cygwin systems the same as 32-bit ones.
Update references to the configure script source.
Instead of trying to determine the type of the C compiler in the ml script
based on the name of the C compiler executable, use the C compiler type
determined by the configure script.
scripts/ml.in:
As above.
configure.ac:
Stop and report an error if this script is run on the x86_64-pc-msys
architecture; that will go badly wrong as the configure script currently does
not handle it correctly.
README.MS-VisualC:
When using MSVC as the C compiler and building on MSYS2, the
configuration type must not be "*-pc-msys". (That configuration
type is used for building programs for use with MSYS itself, not
native executables.)
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.
.INSTALL.in:
The configure option --disable-dynamic-link does not do what this
file says it does; the new --disable-shared-libs option does, so
mention that instead.
configure.ac:
Add the option --disable-shared-libs, which turns off shared libraries
even on systems that support them.
Make the workaround for bug #453 look at the value of the new option,
rather than that of --disable-dynamic-link.