compiler/instmap.m:
Before code generation, the MLDS backend recomputes all nonlocal sets,
because the MLDS code generator needs them to contain exact information,
but the compiler's rules allow the nonlocal sets in goal_infos
to overapproximate the true nonlocals set. Since instmap_deltas can
contain a variable as a key only if that variable is in the nonlocals set,
this also involved calling instmap_delta_restrict to ensure this.
However, while the nonlocals sets of goal_infos *may* include variables
that are not true nonlocals, they typically do not do so. This diff
adds conditionally-enabled code to record information about this,
and the results show that 90+% of calls to instmap_delta_restrict
make no changes to the instmap_delta. This diff therefore also
special-cases the handling of such calls. The reason why I believe
this to be worthwhile is that in a deep profiled compiler run,
I observed that the instmap_delta_restrict predicate accounted for
about 1.4% of the call counts, and about 1.3% of the memory allocated.
library/map.m:
library/tree234.m:
Add the library predicates needed by the special case code.
Use predmode declarations in some other places.
NEWS:
Mention the new library predicates.
compiler/mercury_compile_main.m:
Invoke the predicate in instmap.m that, if statistics collection
was enabled, appends its results to a file.
tools/restrict_stats:
A script to summarize the contents of that file.
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.
... 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.
library/multi_map.m:
library/one_or_more_map.m:
Add sorted_keys and keys_as_set to both modules in both function and
predicate forms.
library/map.m:
Use meaningful variable names in related code.
NEWS:
Announce the changes to multi_map. (The description of one_or_more_map
is already "a copy of multi_map".)
library/one_or_more.m:
We used to have a type named one_or_more in the list module representing
nonempty lists. It had literally just two predicates and two functions
defined on it, three of which did conversions to and from lists, which
limited their usefulness.
This new module is the new home of the one_or_more type, together with
a vastly expanded set of utility predicates and functions. Specifically,
it implements every operation in list.m which makes sense for nonempty
lists.
library/list.m:
Delete the code moved over to one_or_more.m.
library/one_or_more_map.m:
This new module is a near copy of multi_map.m, with the difference being
that while the multi_map type defined in multi_map.m maps each key
to a list(V) of values (a list that happens to always be nonempty),
the one_or_more_map type defined in one_or_more_map.m maps each key
to a one_or_more(V) of values (which enforces the presence of at least
one value for each key in the type).
library/map.m:
Mention the existence of one_or_more_map.m as well as multi_map.m.
library/MODULES_DOC:
library/library.m:
List the new modules as belonging to the standard library.
NEWS:
Mention the new modules, and the non-backwards-compatible changes to
list.m.
compiler/*.m:
Import the one_or_more module when needed.
tests/hard_coded/test_one_or_more_chunk.{m,exp}:
Test the one predicate in one_or_more.m that is non-trivially different
from the corresponding predicate in list.m: the chunk predicate.
tests/hard_coded/Mmakefile:
Enable the new test case.
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/LIB_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Specify --warn-inconsistent-pred-order-clauses as a default flag
in these directories as well.
library/string.m:
Reorder code to make this module compile cleanly with
--warn-inconsistent-pred-order-clauses.
Don't export base_string_to_int_underscore to lexer.m, since
lexer.m does not use it anymore, and neither does anything else.
(The export was not publicly documented.)
library/benchmarking.m:
library/bitmap.m:
library/builtin.m:
library/map.m:
library/profiling_builtin.m:
library/rbtree.m:
library/table_builtin.m:
library/uint.m:
profiler/globals.m:
profiler/options.m:
profiler/prof_info.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
ssdb/ssdb.m:
Reorder code to make these modules compile cleanly with
--warn-inconsistent-pred-order-clauses.
library/Mercury.options:
Specify --no-warn-inconsistent-pred-order-clauses for the modules
that would still get warnings without this option.
library/map.m:
As above.
NEWS:
Announce the new predicates.
tests/hard_coded/map_select_test.{m,err_exp}:
A test case for the new code.
tests/hard_coded/Mmakefile:
Enable the new test case.
compiler/decide_type_repn.m:
New module for computing the set of type representation items
to put into the interface files of a module. For now, it generates
this information only for .int3 files.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Add the new module to the parse_tree package.
compiler/comp_unit_interface.m:
Invoke the new module to add type representation items to .int3 files
if the experiment option has the right value. Give it the information
it needs to do its job.
compiler/add_foreign_enum.m:
Export a predicate for use by decide_type_repn.m. Maybe eventually
it should be *moved* to decide_type_repn.m.
compiler/hlds_data.m:
compiler/prog_data.m:
Change the representation of lists of constructors in a type
from lists, which can be empty, with one_or_more, which cannot.
This encodes the invariant that a type constructor cannot have
zero data constructors in the structure of the type.
compiler/prog_item.m:
Change the representation of lists of constructors in a type
from lists, which can be empty, with one_or_more, which cannot.
This encodes the invariant that a type constructor cannot have
zero data constructors in the structure of the type.
Include information about assertions in type representation items
about foreign types.
Do not record whether a type whose representation item says its values
are guaranteed to be word aligned is a Mercury type or a foreign type.
We generate such items only for Mercury types; for foreign types,
their assertions will contain that information. We need this separation
because when we generate .int3 files, we don't the backend that we will
eventually generate code for, and thus do not know whether a given
foreign type declaration is in effect on that backend or not.
compiler/parse_tree_out.m:
Fix the printing of type representation items.
compiler/prog_type.m:
Conform to the changes above, and delete an unused predicate.
compiler/parse_type_repn.m:
Factor out some common code.
Fix an old bug about yes/no vs du_repn/no_du_repn.
Conform to the changes above.
compiler/parse_pragma.m:
Export a predicate for parse_type_repn.m.
Note a possible improvement.
Conform to the changes above.
compiler/add_special_pred.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/det_report.m:
compiler/du_type_layout.m:
compiler/equiv_type.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_pragma.m:
compiler/parse_type_defn.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/resolve_unify_functor.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_norm.m:
compiler/type_util.m:
compiler/untupling.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
compiler/simplify_goal_ite.m:
Add a comment.
compiler/canonicalize_interface.m:
compiler/get_dependencies.m:
Do not abort when seeing type representation items.
compiler/mmakefiles.m:
Delete a predicate that this diff adds to list.m.
library/list.m:
Add new predicates to convert from one_or_more to list
and vice versa.
NEWS:
Announce the new predicates.
library/bimap.m:
library/map.m:
library/tree234.m:
Expand a comment.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
library/assoc_list.m:
library/bag.m:
library/bimap.m:
library/calendar.m:
library/char.m:
library/digraph.m:
library/list.m:
library/map.m:
library/multi_map.m:
library/psqueue.m:
library/rbtree.m:
library/string.m:
library/term.m:
library/tree234.m:
library/type_desc.m:
library/univ.m:
library/varset.m:
Replace most occurrences of "abort" with "throw an exception".
Slightly improve the documentation for map.search, map.lookup,
map.inverse_search.
library/deconstruct.m:
Replace "abort" with "runtime abort" where that is meant.
library/bimap.m:
library/bitmap.m:
library/calendar.m:
library/char.m:
library/cord.m:
library/deconstruct.m:
library/diet.m:
library/dir.m:
library/eqvclass.m:
library/map.m:
library/pprint.m:
library/pqueue.m:
library/stream.string_writer.m:
library/term_conversion.m:
library/time.m:
library/type_desc.m:
library/version_array.m:
library/version_array2d.m:
library/version_bitmap.m:
library/version_hash_table.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most of these modules, either the order of the declarations
or the order of the definitions made sense, and I changed the other
to match. In a few modules, neither made sense, so I changed *both*
to an order that *does* make sense (i.e. it has related predicates
together).
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style, give some auxiliary
(non-exported) predicates better names, or delete some unneeded module
qualifications.
In some places, have the function form of a procedure forward
the work to the predicate form, instead of vice versa, where this is
more natural (usually because it allows the use of state variables).
However, this is the only kind of "algorithmic" change in this diff;
the rest is just moving code around.
library/map.m:
The implementations of map.intersect, map.common and map.union all
loop over the elements in their input maps, and (under different
conditions) add them to a new map. This diff changes the loop predicates
so that they build an assoc list instead, which is then turned into
a map (a balanced 234 tree) at the end. This avoids the construction
of all the intermediate versions of the map, which would involve
a lot of rebalancing.
On the compiler, this yields a very small speedup, but the speedup
can be expected to grow with the size of the input lists, since insertions
into deeper trees need more rebalancing on average.
Add missing (mdi, muo) and semidet modes for map.foldl4 (foldr4 already has
them).
Strip unnecessary module qualification from the interface of the tree234 module
as per the current coding standard.
library/map.m:
Add the above predicates.
Add missing modes for map.foldl4/10.
library/tree234.m:
Implement foldl5/12 and foldr5/12.
Add missing modes for tree234.foldl4/10.
Strip unnecessary module qualification.
NEWS:
Announce the above additions.
NOTE: this change does not affect the io module -- I've left that for a
separate change.
library/*.m:
As per the recent change to the coding standard, avoid module
qualification in library interfaces where possible.
Reformat declarations and descriptive comments to better utilise
any space freed up by the above.
library/bimap.m:
Add a predicate for testing semantic equality of bimaps.
library/assoc_list.m:
Add fold_values with two or three accumulator arguments.
library/int.m:
Add fold_{up,down} with three accumulator arguments.
library/map.m:
library/tree234.m;
Add foldl_values with two or three accumulator arguments.
NEWS:
Announce the above additions.
Reformat the existing changes to the pqueue module slightly
library/map.m:
Add a missing word.
Refer to the higher-order argument as a closure rather than
a predicate since the description covers both the function
and predicate versions of map.union.
The unification operation on 2-3-4 trees tests if they are structurally
equal. They might also be considered equal if their sets of key-value pairs
are equivalent. I've created an equal/2 predicate in the tree234 and
map modules in the standard library to test this.
library/tree234.m:
Implement a predicate to test for tree234 equivalence.
library/map.m:
Forward map.equal/2 to tree234.equal/2.
NEWS:
Announce this change in the news file.
tests/general/map_equal.m:
tests/general/map_equal.exp:
Add test case for map.equal/2
tests/general/Mmakefile:
Include the new test case.
Estimated hours taken: 16
Branches: main
This diff makes three main changes to try to speed up the compiler:
- Avoid a double traversal of a map in const_struct.m.
- Speed up that double traversal in const_struct.m when possible.
- Remove any variables eliminated by the conversion of
from_ground_term_construct scopes to const structs from the procedure's
varset and vartypes. Do so in bulk, if that seems to be worthwhile.
These together speed up the compiler by about 7% when compiling
training_cars_full.m. About two-thirds of that is from the first change,
almost a third is from the second, and a tiny bit from the third.
----------------------------
All the above changes rely on changes in the library.
library/tree234.m:
Add a new predicate, search_insert(K, V, MaybeOldV, !Tree). If K
is in !.Tree with value OldV, it sets MaybeOldV to yes(OldV) and
leaves !Tree unchanged. If K is not in !.Tree, it inserts it into
!Tree with value V. Basically, it does a search and an insert
in ONE traversal, and is the map equivalent of the insert_new
predicates I added to all the set modules recently.
Put all the predicates in the module into a logical order.
Replace all the calls to error with calls to unexpected. Replace
all the sanity checks that called to require with calls to expect,
and put them inside conditionally-enable trace scopes.
Add a predicate for a quick-and-dirty estimate of the size of a tree.
This is to support delete_sorted_list in map.m.
library/map.m:
Make the new tree234.search_insert predicate accessible in the
map module.
Add a predicate for removing a *sorted* list of elements from a map,
since this is more efficient if we are removing a large fraction
of the map's elements.
library/varset.m:
Implement a predicate that is analogous to the new delete_sorted_list
predicate in map.m, and is implemented using it.
Speed up varset.delete_vars even if the vars aren't sorted.
NEWS:
Note the new predicates.
----------------------------
compiler/const_struct.m:
Use the new capability of map.m to combine two traversals into one.
(Change 1 at the top.)
Divide the csdb_struct_map into two maps, one whose cons_ids are
cons/3, and one for every other cons_id. Make the key of the map
for the cons/3 cons_ids a structure that has its most distinctive
components at the start, to reduce the cost of comparisons in lookups.
(Change 2 at the top.)
----------------------------
compiler/simplify.m:
When converting from_ground_term_construct scopes into constant
structures, remove the eliminated variables from the varset and
vartypes. (Change 3 at the top.)
Restructure the simplify_info and its access predicates, in several
respects:
- Make all accesses to the fields through access predicates,
to allow profiling to count how frequently each is used.
- Instead of including the det_info in the simplify_info, include
its components.
- Separate the simplify_info into a main and a sub info, with the
main one being an 8 word structure containing only the most
frequently accessed fields. Some of these previously required
going through two structures (simplify_info and det_info).
- Eliminate a field that was unused. (We no longer need to recompute
instmap deltas for atomic goals.)
- Eliminate some other unused access predicates (setters for read-only
fields).
- Separate the remaining access predicates from simple wrappers around
them. Put all the access predicates in an order that mirrors the
order of the fields in the simplify_info and sub_simplify_info
structures.
- Give some predicates better names.
compiler/pd_util.m:
compiler/common.m:
Conform to the above changes.
----------------------------
compiler/det_util.m:
Put the arguments of a predicate into a more logical order.
compiler/det_analysis.m:
Give some predicates more meaningful names.
Branches: main, 11.07
Add the predicate map.keys_and_values/3 to the standrad library.
library/map.m:
library/tree234.m:
Add the new predicate.
NEWS:
Announce the new predicate.
tests/hard_coded/Mmakefile:
tests/hard_coded/test_keys_and_values.{m,exp}:
Test the new predicate.
Estimated hours taken: 24
Branches: main
Predicates with many variables, such as some of those in zm_enums.m,
tickle pretty bad behavior in the liveness and stack_alloc passes.
This is because those passes manipulate sets of variables, which in
such cases are large sets of variables, and the quadratic behavior
of repeated operations on sets represents as sorted lists hurts us.
This diff changes the representation of the sets of variables involved
in those two passes, which are the prebirth, postbirth, predeath and postdeath
sets in goal_infos, to be values of an abstract type (set_of_progvar).
By default, these are implemented using tree_bitsets, which have much better
worst case behaviour that set_ordlists.
When compiling zm_enums with debugging enabled, this diff speeds up
the liveness pass by about half and the stack alloc pass by about a third,
with the overall speedup being about 6% (due to some other expensive passes).
On tools/speedtest -l, the result is a 3.4% slowdown. Since the slowdown
worsens slightly if I make the abstract representation of sets of prog_vars
be the existing representation (an ordinary set), I think this slowdown is
due to the conversions that are now required in some places between the
abstract representation and an explicit set(prog_var) representation.
As such, as other uses of set(progvar) get converted to set_of_progvar,
this slowdown should disappear.
compiler/set_of_var.m:
The new module that contains the set_of_progvar abstract data type.
This module also contains a copy of the code of the graph_colour
module. Since the set_of_progvar type is private, this is necessary
if we want all the set operations done by graph colouring (which does
the bulk of the work of the stack alloc pass) to use the preferred
set representation.
compiler/graph_colour.m:
Note that this module is no longer used.
compiler/stack_alloc.m:
compiler/liveness.m:
Switch over to using the new module.
compiler/parse_tree.m:
Include set_of_var among the modules of this package. (It is in this
package because the prog_var type is defined in this package.)
compiler/test_bitset.m:
A module that allows new set implementations to be tested. It is
an extended and specialized version of the bitset_tester module
from tests/hard_coded.
compiler/hlds_llds.m:
Use the set_of_progvar type for the prebirth, postbirth, predeath
and postdeath sets in goal_infos, and for other liveness-related
sets of variables.
compiler/code_info.m:
Some of the fields of the code_info structure represent sets of
variables, and some of the predicates defined by this module have
arguments that are sets of variables. If these sets represent entities
that are computed from prebirth, postbirth, predeath and postdeath
sets or from other goal_info fields that have been changed to the
set_of_progvar representation, change them to use the set_of_progvar
representation as well, or, in a few cases, to plain sorted lists.
Conform to the above change.
compiler/proc_type.m:
Add a utility predicate to operate of set_of_progvar.
Replace a lambda expression with a named predicate.
compiler/quantification.m:
Until now, quantification.m used its own private abstract type
(defined as tree_bitset) to represent sets. Make it use set_of_progvar
instead, since it has the same purpose. This eliminates a potential
maintenance problem.
compiler/call_gen.m:
compiler/code_gen.m:
compiler/commit_gen.m:
compiler/delay_construct.m:
compiler/disj_gen.m:
compiler/hlds_out_goal.m:
compiler/hlds_rtti.m:
compiler/interval.m:
compiler/ite_gen.m:
compiler/live_vars.m:
compiler/lookup_switch.m:
compiler/lookup_util.m:
compiler/matching.m:
compiler/pd_util.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_gen.m:
compiler/simplify.m:
compiler/stack_opt.m:
compiler/store_alloc.m:
compiler/string_switch.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.domain.m:
compiler/switch_util.m:
compiler/trace_gen.m:
compiler/tupling.m:
compiler/unify_gen.m:
compiler/unused_args.m:
Conform to the above change.
library/map.m:
Add a utility predicate, map.select_sorted_list, which functions the
same way as map.select, but takes a sorted list as argument instead of
a set.
library/set_ordlist.m:
Bring the interface of this module closer to set.m and tree_bitset.m
to make them more easily interchangeable. This required adding the
predicates is_non_empty and is_singleton, as well as adding predicate
forms of union_list and intersect_list.
I also added missing type_spec pragmas for some predicates frequently
used by the compiler.
library/tree_bitset.m:
Bring the interface of this module closer to set.m and set_ordlist.m
to make them more easily interchangeable. This required adding the
predicates is_non_empty and is_singleton, and both function and
predicate forms of union_list and intersect_list.
Fix an old bug in the difference operation. Given SetA - SetB,
if SetA was the empty set, then this operation would correctly
return the empty set if SetB was small (represented by a leaf list),
but would incorrectly return SetB if it was large (represented by
an interior node list).
Branches: main
Change the argument order of predicates in the sparse_bitset modules to make
it more conducive to the use of state variable notation.
Group function clauses together with the clauses for the corresponding
predicates.
library/sparse_bitset.m:
As above.
library/digraph.m:
compiler/make.dependencies.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/mode_robdd.tfeirn.m:
tests/hard_coded/bitset_tester.m:
tests/hard_coded/pprint_test.m:
tests/valid/loop_inv_bug.m:
Conform to the above change.
library/digraph.m:
library/getopt.m:
library/getopt_io.m:
library/map.m:
Remove dependencies on the svset module.
NEWS:
Announce the above change.
Branches: main
Change the argument order of predicates in the rbtree and tree234 modules
to make them more conducive to the use of state variable notation.
(This change will break existing code that uses these modules but such
modules should be quite rare; most existing code uses the map module.)
library/rbtree.m:
Change argument orderings as above.
Add further modes for the foldl predicates that have
(mostly-)unique accumulators.
library/tree234.m:
Change argument orderings as above.
library/map.m:
profiler/generate_output.m:
tests/debugger/declarative/mapinit.m:
tests/hard_coded/transform_value.m:
Conform to the above changes.
NEWS:
Announce the above changes.
Branches: main
Add functions for creating singleton maps (of various sorts) to the standard
library. The rationale for this to replace the following sequence of code,
which occurs a lot throughout the Mercury system:
map.init(Map0),
map.det_insert(SomeKey, SomeValue, Map0, Map)
library/bimap.m:
library/injection.m:
library/map.m:
library/rbtree.m:
library/tree234.m:
Add the new function singleton/2 that takes single key-value
pair as arguments and returns a new map.
compiler/disj_gen.m:
Avoid ambiguity in a spot.
NEWS:
Announce the additions.