NEWS:
Mention all the user-visible changes below.
library/enum.m:
Add the typeclass uenum, which is a version of the existing enum typeclass
that maps items to uints, not ints. It also uses a semidet predicate,
not a semidet function, to get back to the item from the uint.
library/sparse_bitset.m:
library/fat_sparse_bitset.m:
Make these modules operate on uints, which means requiring the items
in the sets to be instances of uenum, not enum.
If a few places, improve loops by doing previously-repeated conversions
of [u]ints into <offset, bit-to-set> pairs just once.
library/counter.m:
Define ucounters, which allocate uints. Improve documentation.
library/digraph.m:
Change digraph_keys from ints to uints, since we put them into
sparse_bitsets.
library/int.m:
Make int an instance of the uenum typeclass. This can help users
who currently put ints into sparse_bitsets.
library/pprint.m:
Prettyprint sparse_bitsets as lists of uints.
library/term.m:
Make vars instances of uenum as well as enum.
library/uint.m:
Make uint an instance of the uenum typeclass.
Add the ubits_per_uint function, which allows some casts to be avoided.
compiler/make.deps_set.m:
Change the indexes we put into sparse_bitsets from ints to uints.
compiler/make.make_info.m:
Change the source of those indexes from ints to uints.
compiler/make.top_level.m:
compiler/make.util.m:
Conform to the changes above.
compiler/pre_quantification.m:
Change zones from ints to uints, since we put them into sparse_bitsets.
tests/hard_coded/int_uenum.{m,exp}:
tests/hard_coded/Mmakefile:
Enable the new test case.
tests/valid/use_import_only_for_instance.m:
Update this extract from library/digraph.m the same way as
library/digraph.m itself.
In make_info we maintain a mapping between dependency_file and
dependency_file_index. Replace the type dependency_file used in those
maps with a new type, in which modules are referred to by module_index
instead of by module_name.
The reason for the change is that make.dependencies.of_3 is called
frequently to convert a module_index and module_target_type to a
dependency_file_index. With this change, it does not need to look up
the module_name corresponding to a module_index, but uses the
module_index as given. Also, using module_index instead of module_name
as part of a hash table key should be faster as (1) hashing is faster,
and (2) comparing keys within the same hash table bucket is faster.
This change improves the run time of a do-nothing build of Prince
on my machine from 1.8 s to 1.7 s.
compiler/make.dependencies.m:
Add the new type.
Don't need to call module_index_to_name in of_3.
Describe the `of' function.
compiler/make.make_info.m:
Replace dependency_file in the dependency file <-> index maps
with the new type.
compiler/make.util.m:
Add hash predicate for new type.
compiler/make.deps_set.m:
compiler/make.top_level.m:
Conform to changes.
We previously cached the foreign imports of a module.
find_module_foreign_imports always needs to compute the transitive
foreign imports (i.e. including the foreign imports of transitively
implementation-imported modules), so it had to take the union of a bunch
of sets after looking up cached results.
This change caches the transitive foreign imports of a module, avoiding
the bitset union operations, many/most of which turn out to be redundant.
It reduces the average run time for a do-nothing build of Prince on my
machine from 5.9 s to 3.1 s, for a speed up of ~47%.
compiler/make.dependencies.m:
Cache transitive foreign module imports instead of direct foreign
module imports.
Delete code to make use of va_map; it is no longer used.
(The va_map module may still be convenient to use in places where we
currently use version_array, so keep it around.)
compiler/make.deps_set.m:
Delete code to make use of va_map.
compiler/make.make_info.m:
Rename field.
compiler/make.top_level.m:
Conform to change.
For a do-nothing build of Prince with intermodule optimisation enabled,
mmc --make spends a large fraction of its time computing foreign imports,
or rather looking up the cached results of such. (There are 650 modules,
and the results for each module are looked up tens to hundreds of
thousands of times each.)
This change replaces the representation of cached_foreign_imports from
tree234 to one based on version_array. It reduces the average run time
for a do-nothing build of Prince on my machine from 7.80 s to 5.87 s,
for a speedup of ~25%.
compiler/va_map.m:
Add a simplified version of a module that I originally wrote for
Prince. I have permission to include it in the Mercury compiler and
assign copyright to the Mercury team.
compiler/libs.m:
Include the new module in the libs package.
compiler/make.deps_set.m:
Implement a typeclass needed to use module_index as a va_map key.
compiler/make.dependencies.m:
Implement a typeclass needed to use maybe(T) as a va_map_value.
Use va_map to represent cached_foreign_imports instead of map.
compiler/make.top_level.m:
compiler/make.track_flags.m:
compiler/make.make_info.m:
Carve these three modules out of make.m.
make.top_level.m contains the top level of the mmc --make algorithm.
make.track_flags.m contains code for keeping track of which options
were used to compile which modules.
make.make_info.m defines the make_info structure used by all the
submodules of make.m, as well as a few other utility types.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/make.m:
Delete the code that has been moved to the new modules, leaving
make.m as purely a package.
Include make.build.m in the interface, so we can delete the forwarding
predicate we used to have here for use by mercury_compile_main.m.
compiler/Mercury.options:
Make make.top_level.m and make.track_flags inherit make.m's old
-no-warn-implicit-stream-calls option.
compiler/file_names.m:
Move a utility function about extensions here from make.m.
This also allows the removal of an undesirable module import of make.m
in write_deps_file.m.
compiler/make.build.m:
Move a type here from make.m, since it is needed to allow
mercury_compile_main.m call this module directly (i.e. not through
a forwarding predicate in make.m).
compiler/make.dependencies.m:
compiler/make.deps_set.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/options_file.m:
compiler/write_deps_file.m:
Conform to the changes above. This mostly means having each module make.X
actually import the modules it uses, instead of relying on make.m
importing them, and getting those imports via make.int0.
In a few cases, it means having each module make.X NOT import the modules
it does NOT use, since after the "package-ification" of make.m,
we now get warnings about these imports being unused.
This is a first step towards a much finer grained partition.
compiler/file_names.m:
Split the ext type into ext_src and ext_other, as mentioned above.
Add the first predicate for checking whether a string falls into
a given category of extensions.
Add an XXX proposing a better solution for an old problem that does not
actually arise in practice.
compiler/compile_target_code.m:
Split the two-moded predicate maybe_pic_object_file_extension into
two separate one-mode predicates, one for each old mode. The
implementations of the two modes were already separate, because
the two modes already did different jobs: while one went from PIC
to an "extension", the other went from an "extension string" to PIC.
Until now, "extension" and "extension string" were equivalent;
after this diff, they aren't anymore.
Delete an unused argument.
compiler/make.util.m:
Split the two-moded predicate target_extension into
two separate one-mode predicates, one for each old mode,
for the same reason as maybe_pic_object_file_extension above:
the fact that "extension" and "extension string" are now distinct.
compiler/options_file.m:
Move debug infrastructure here from mercury_compile_main.m, to help
debug possible problems with options files. (I had such a problem
while writing this diff.)
Improve how progress messages are printed.
compiler/options.m:
Make an error message more useful.
compiler/mercury_compile_main.m:
Add infrastructure for debugging possible problems with command lines.
(I had such a problem while writing this diff.)
compiler/analysis.m:
Conform to the changes above. Put the arguments of some methods
into the same order as similar predicates in file_names.m.
compiler/find_module.m:
Conform to the changes above. Delete an unused argument,
compiler/analysis.file.m:
compiler/du_type_layout.m:
compiler/elds_to_erlang.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_kind.m:
compiler/generate_dep_d_files.m:
compiler/grab_modules.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.deps_set.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
compiler/mmc_analysis.m:
compiler/mode_constraints.m:
compiler/module_cmds.m:
compiler/prog_foreign.m:
compiler/read_modules.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/source_file_map.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
compiler/make.deps_set.m:
New module containing the parts of the old make.dependencies.m
that define the module_index and dependency_file_index types,
and the operations on them.
compiler/make.dependencies.m:
Delete the code moved to make.deps_set.m, and import make.deps_set.m
instead. This increases the cohesion of this module.
compiler/make.m:
Include and import make.deps_set.m.
compiler/notes/compiler_design.html:
Document the new module.