compiler/make.util.m:
All callers of the remove_file_for_make predicate pass it
the names of *files*, not directories, to remove. So stop invoking
a library predicate intended to remove complete directort hierarchies.
library/io.file.m:
Document the lack of a predicate that removes *only* regular files
as a problem. (Even io.file.remove_file can, and usually will, remove
the named "file" if it is in fact a directory, provided it is empty.)
Make the descriptions of the exported predicates of this module
easier to read.
Make a foreign_proc more readable as well.
compiler/make.build.m:
compiler/make.check_up_to_date.m:
compiler/make.file_names.m:
compiler/make.find_local_modules.m:
compiler/make.hash.m:
compiler/make.index_set.m:
compiler/make.library_install.m:
compiler/make.make_info.m:
compiler/make.module_target.m:
compiler/make.prereqs.m:
compiler/make.prereqs_cache.m:
compiler/make.program_target.m:
compiler/make.timestamp.m:
compiler/make.top_level.m:
compiler/make.util.m:
Perform the above rename, and similar ones as well.
Replace the dep_target/dep_file distinction, which was misleading,
with the merc_target/non_merc_target distinction. (Both name files
that can be prerequisites, but the Mercury-related files can be built
by mmc --make.)
In one case, make unnecessarily-exported type definitions private.
compiler/mercury_compile_make_hlds.m:
compiler/mmakefiles.m:
Perform similar renames.
compiler/make.util.m:
Instead of exporting a predicate whose implementation is a function,
export the function. Make the function return a value of a bespoke type
instead of a bool. Clarify its semantics.
compiler/make.library_install.m:
Conform to the change above.
compiler/file_names.m:
Change the predicates that return file names to return as their result
both the current, legacy filename, and the proposed filename.
For ext_cur extensions, the legacy and the proposed filenames
will always be identical. Add a predicate for these that returns
just this one filename.
compiler/comp_unit_interface.m:
compiler/compile_target_code.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/fact_table.m:
compiler/generate_dep_d_files.m:
compiler/generate_mmakefile_fragments.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.check_up_to_date.m:
compiler/make.clean.m:
compiler/make.dependencies.m:
compiler/make.file_names.m:
compiler/make.get_module_dep_info.m:
compiler/make.library_install.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.timestamp.m:
compiler/make.track_flags.m:
compiler/make.util.m:
compiler/make_module_file_names.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.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/read_modules.m:
compiler/recompilation.used_file.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the changes above. In most places, this means ignoring
the proposed filename for now, but marking such places with "XXX LEGACY",
to make them easier to find when we *do* start to make use of the proposed
file names (first alongside the legacy names, and then without them).
In some places, make variable names more descriptive.
library/set.m:
Add utility predicate for use by a diff to one of the modules above.
NEWS.md:
Announce the new library predicate.
compiler/make.make_info.m:
Rename two types that are conceptually maps to include "map"
in their names.
Rename the getter and setter operations on the fields of the make_info
containing values of these types accordingly.
compiler/make.library_install.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.timestamp.m:
compiler/make.top_level.m:
compiler/make.util.m:
Conform to the changes above.
compiler/make.util.m:
Add a predicate, should_we_stop_or_continue, which encapsulates
the logic of the stop-or-continue test.
compiler/make.build.m:
compiler/make.dependencies.m:
compiler/make.find_local_modules.m:
compiler/make.library_install.m:
Replace copies of that logic with a call to the new predicate.
... and other minor fixes.
library/*.m:
library/LIB_FLAGS.in:
compiler/*.m:
mdbcomp/*.m:
Fix and update copyright notices.
Fix spelling.
Delete trailing whitespace.
... and the compilation task type foreign_code_to_object code.
The only code in the compiler that created a reference to either
was code to *remove* files identified by the module_target_foreign_object
target. It seems that all other code that created references to either
function symbol (as opposed to handling them after they were created elsewhere)
was deleted as part of the removal of the IL backend from the compiler
in 2015.
compiler/make.make_info.m:
Delete the above two function symbols from their types.
compiler/make.module_target.m:
Delete the code that used to handle the deleted function symbols,
and delete the XXX whose investigation led me to discover the fact
that this code has been dead for a while.
compiler/make.check_up_to_date.m:
compiler/make.dependencies.m:
compiler/make.file_names.m:
compiler/make.hash.m:
compiler/make.program_target.m:
compiler/make.timestamp.m:
compiler/make.util.m:
compiler/prog_foreign.m:
Delete the code that used to handle the deleted function symbols.
compiler/make.module_target.m:
As above. This allows us
- to test whether an lhs file has a date file or not just once,
whereas previously we did it twice, and
- to take the timestamp of
Add comments about some other aspects of the code.
compiler/make.timestamp.m:
Delete a predicate whose only caller was deleted by the changes above.
compiler/make.file_names.m:
Rename timestamp_extension to date_file_extension. The file extensions
that this predicate returns all have "date" in their names, and thus
DateFile is a more readily understandable variable name than TimestampFile.
compiler/make.util.m:
Conform to the change in make.file_names.m.
Each of the new modules, and the old one, have improved cohesion.
compiler/make.check_up_to_date.m:
compiler/make.deps_cache.m:
compiler/make.find_local_modules.m:
Carve these new modules out of make.dependencies.m.
make.check_up_to_date.m contains code to test whether the other files
that the current target file depends on are up to date or not.
make.deps_cache.m contains the caches that make.dependecies.m uses,
which are also components of the make_info structure.
make.find_local_modules.m contains code to find the set of modules
in the current directory that a module (such as a module that
defines main/2) depends on.
compiler/make.m:
Include the new modules in the make package.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/make.make_info.m:
Move two types here from make.dependencies.m, since they define
the type of one the pieces information stored in the make_info,
and they are also used by other modules.
compiler/make.dependencies.m:
Delete the code moved to other modules.
compiler/make.build.m:
compiler/make.deps_set.m:
compiler/make.file_names.m:
compiler/make.hash.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.timestamp.m:
compiler/make.top_level.m:
compiler/make.track_flags.m:
compiler/make.util.m:
Conform to the changes above.
compiler/make.util.m:
Delete the versions of maybe_write_msg and maybe_write_msg_locked
that wrote to the (implicit) current output stream. The versions
that write to an explicitly specified stream remain.
Change the old callers to the deleted predicates to pass an explicit
stream to the remaining versions. To make this possible, require *their*
callers to specify an explicit stream.
Give two predicates less-confusing names.
compiler/Mercury.options:
Stop specifying -no-warn-implicit-stream-calls for make.util.m.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Conform to the changes in make.util.m. In most places, we do still use
implicit streams, but moving such uses higher and higher in the call tree
gets us closer and closer to using only explicit streams.
Each of the new modules, and the new make.util.m, has better cohesion
than the old make.util.m. (For example, the lists of modules they import
don't overlap all that much.)
compiler/make.file_names.m:
compiler/make.hash.m:
compiler/make.timestamp.m:
Carve these three modules out of make.util.m
- make.file_names.m does filename translations.
- make.hash.m does hashing.
- make.hash.m looks up and compares timestamps.
compiler/make.m:
Include the new modules.
compiler/notes/compiler_design.html:
Document the new modules.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.top_level.m:
compiler/make.util.m:
Update module imports.
We have been using the maybe_search type to represent two related
but slightly different concepts:
- whether we are computing a filename *to search for*, and
- whether we are computing a filename *by searching*.
This diff changes things so that we use two different types to represent
these concepts: maybe_for_search for the first, and maybe_search for
the second. Expressing this distinction in the type makes the affected code
easier to understand.
compiler/file_names.m:
Define maybe_for_search, document it, and update the documentation
of maybe_search.
Use maybe_for_search throughout this module, since it never does
any searching,
Update some other comments.
Add a function to convert from maybe_search to maybe_for_search.
This is needed because to search for something, you first need
to know what to search for.
compiler/make.module_target.m:
compiler/make.util.m:
Change all the occurrences of the old maybe_search type that actually
control whether we are computing a filename *to search for* into
maybe_for_search.
compiler/file_names.m:
Up till now, every translation of a module_name+extension to a filename
returned a filename that always included the needed relative path.
But for some final products of compilation, such as executables
and libraries, after we have created the file under its fully
specified relative pathname, we also want to copy it to the
current directory.
We used to this in a roundabout way, by setting up a globals structure
that turned off the use_subdirs and use_grade_subdir options
(or, in some cases, just one of them), and redoing the
module_name+extension to filename translation using this modified globals.
This diff changes to a more direct approach: asking file_names.m
to return both the fully specified relative path of the filaname,
and just its local directory component, in *one* predicate call.
We do this by adding new versions that return this info
of those predicates whose callers need this info.
To make this possible, make the main translation predicate,
module_name_to_file_name_ext, return to its callers not
the list of directory components and the full relative path, but
the list of directory components and the local filename,
leaving it up to its callers to construct the full relative path
from them *without* precluding the possibility of returning
the local filename as well.
Move some comments to the place they apply to.
compiler/compile_target_code.m:
Rename the link_output_filename predicate to linked_target_file_name
and export it. linked_target_file_name was a predicate in make.util.m
that had a identical definition to linked_target_file_name, which
this diff deletes; by exporting the renamed predicate, we make it
available in make.util.m as well.
Provide a new version of linked_target_file_name,
linked_target_file_name_full_curdir, which also returns
both the full pathname and the local directory name
it gets from file_names.m.
Use the new facilities in file_names.m where relevant.
Factor out some common code.
compiler/make.program_target.m:
compiler/make.util.m:
Use the new facilities in file_names.m where relevant.
In make.util.m, delete the duplicate predicate definition.
compiler/file_names.m:
... which treated some extensions in the category differently than others.
This allows the code that converts each category's extensions to the
final filename to test nothing except the search/nosearch parameter
and the subdir options.
compiler/analysis.file.m:
compiler/analysis.m:
compiler/make.util.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_make_hlds.m:
compiler/mercury_compile_middle_passes.m:
compiler/write_deps_file.m:
Conform to the new designations of the extensions that
moved to a new category.
compiler/file_names.m:
Take ext_src out of the ext type, because this allows us to delete
the I/O state pair of arguments out of every file translation predicate
other than module_name_to_source_file_name and the ones that create
directories.
compiler/file_kind.m:
Delete the ext output argument of file_kind_to_extension, because
we can't return ext_src for fk_src anymore.
compiler/write_deps_file.m:
Delete a test for ext_src which could never succeed, because the
predicate in question is never called with ext_src.
Undo an accidental change from the diff that introduced
module_name_to_lib_file_name_create_dirs.
Conform to the changes above.
compiler/compile_target_code.m:
compiler/fact_table.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.m:
compiler/mlds_to_c_file.m:
compiler/mmc_analysis.m:
compiler/module_cmds.m:
compiler/read_modules.m:
compiler/recompilation.used_file.m:
compiler/write_module_interface_files.m:
Conform to the changes above.
compiler/file_names.m:
Split module_name_to_file_name into three versions.
- One corresponds to the old predicate's operation with do_not_create_dirs,
- one corresponds to the old predicate's operation with do_create_dirs, and
- one just returns the directory path, and lets the caller make those
directories if it wants to, using procedures that we now export.
Do the same for module_name_to_lib_file_name.
Do not do the same for fact_table_file_name, which has too few callers
to make it worthwhile.
The point is that the versions that do not create any dirs should NOT
need to take I/O state pairs as arguments, once we take ext_src
out of the ext type.
compiler/compile_target_code.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/fact_table.m:
compiler/generate_dep_d_files.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.track_flags.m:
compiler/make.util.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.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/read_modules.m:
compiler/recompilation.used_file.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Update calls to the affected predicates.
In some places, add XXXs about seemingly-strange choices about
what calls create directories and which don't.
compiler/file_names.m:
Delete the old code for doing filename translations, and use
just the new code.
Delete all the code that was needed only for comparing the old and
new code.
Delete the newext_other extension category, since it was also needed
only for that purpose. Delete all the code that supported it.
Switch the infrastructure for recording the demand for translations
to work with the new code.
compiler/analysis.file.m:
Delete functions that returned old-style extensions, which are
not useful anymore. The new-style extensions, by identifying
extensions via enums rather than strings, serve the purpose
for which these functions were created.
compiler/mercury_compile_main.m:
Move the code to call to write out the translation record
from just after a call to real_main_after_expansion to the
end of real_main_after_expansion. The reason is that the
predicate being called now needs access to a globals structure,
real_main_after_expansion has access to a globals structure,
but its caller does not.
Don't try to test the equivalence of the old and new algorithms
for file name translation, since that test code has been deleted.
compiler/analysis.m:
compiler/compile_target_code.m:
compiler/du_type_layout.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.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.track_flags.m:
compiler/make.util.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_make_hlds.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.used_file.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the changes in file_names.m.
compiler/make.util.m:
Add verbose_make_N_part_msg predicates, and the more general
option_set_make_N_part_msg predicates, to allow simpler code
to construct progress and informational messages.
Pass to debug_make_msg a message *generator*, instead of a predicate
that *writes out* a message. Make debug_make_msg return the message
(if debug_make is enabled) to be written out (hopefully) to an explicitly
specified stream.
compiler/make.dependencies.m:
Rename the dependency_status predicate to get_dependency_status.
Make it return the original dependency_file, and the filename it
corresponds to, alongside the status, because this is the simplest
way to avoid requiring its callers to reconstruct that information
after their calls to get_dependency_status.
Change the signature of check_dependency_timestamps to expect
the new output of get_dependency_status.
Replace code to write out debugging messages with code to just return
them as a string. Move one of these predicates to just after its caller.
Give some predicates more descriptive names.
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Conform to the changes above.
In make.program_target.m, add XXXs about progress messages
that end with a period, unlike all the other progress messages.
compiler/make.util.m:
The predicates that handled progress messages in this module
- tested whether the progress message was needed, and if yes,
- first constructed the message,
- and then printed it.
The predicates that handled error messages were similar,
but error messages are always needed.
In most cases, the printing was done to the current *implicit* output
stream.
Code calling these predicates won't get warnings about implicit stream
calls unless every predicate has both implicit and explicit stream
variants.
Make all these predicates do just the first two of the above jobs,
and return a string that may be empty or not. Then require callers
to call one of four new predicates to print out the resulting string
if it is not empty. The four are distinguished along two axes:
implicit vs explicit stream, and locked/unlocked stdout.
Add XXXs about the problems of even this updated approach,
including the one with locking stdout when the output stream,
whether implicitly or explicitly specified, is *not* stdout.
Make the names of all the predicates affected by the above change
end in "_msg". Change some of the names to be more descriptive.
Delete one predicate whose code was identical to that of another.
compiler/make.build.m:
Export the lock/unlock stdout predicates for use by the new predicates
in make.util.m.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
Conform to the changes above.
compiler/make.program_target.m:
Conform to the changes above.
Give a predicate a less misleading name.
Add an XXX in a place.
The main purpose of this change is not extra efficiency, but uncovering
inconsistencies, and in fact, it found one. A secondary purpose is preparing
for the use of explicit streams in the make package.
compiler/make.util.m:
Avoid such a conversion in the debug_file_msg predicate by requiring
the caller to supply not a target file, but the result of the conversion.
Create separate do_not_search and do_search versions of the
module_TARGET_to_file_name predicate, to reduce the unnecessary
differences between this predicate (now these predicates) and the
corresponding code in file_names.m, i.e. module_NAME_to_file_name/
module_NAME_to_search_file_name. The point of this is to make it easier
to compare two predicates that may, or may not, do identical jobs
using different code, as noted by the new XXX in make.module_target.m.
Put do_not_search code before do_search alternatives, again following
the pattern in file_names.m.
compiler/make.module_target.m:
Update the calls to debug_file_msg.
In one case, add an XXX for the fact that the filename corresponding
to a target file is computed twice, in two different predicates, using
two seemingly different algorithms.
compiler/make.util.m:
As above.
compiler/compile_target_code.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
Conform to the changes in make.util.m.
This should allow profiling runs to collect information about the
number of accesses to each field.
compiler/make.make_info.m:
Move the definition of the make_info type from the interface section
to the implementation section. Add getter functions for all its fields,
setter predicates for its writeable fields, and an initialization
function.
Move all the readonly fields to the start of the structure.
Put related fields next to each other.
compiler/make.top_level.m:
Replace the explicit construction of the initial make_info value
with a call to its initialization function.
compiler/make.build.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.track_flags.m:
compiler/make.util.m:
Replace all accesses to the fields of make_info with calls to the
getter functions or the setter predicates.
compiler/file_names.m:
Change the argument vectors of the predicates that compute filenames
by taking *two* arguments to specify the extension: adding an argument
value of the "newext" type right after the old "ext" type. To make this
possible, export the newext type.
By default, use the new argument to do every filename computation twice,
with the old and new algorithms, throwing an exception if their results
differ. (There is no easy way to test whether the "make-any-needed-dirs"
part was done the same way, but this is reasonably easy to check
visually in the code.)
In case an exception does get thrown, this can be suppressed (hopefully
after the exception being reported) by setting the environment variable
"NO_EXT_CHECKS" to any value.
Add representations of "get the value of this extension from this option"
style extensions to the newext type, for each of the options that the
compiler uses this way. The one exception is java_object_file_extension,
which was used in this way, but which had no code handling it in
file_names.m.
Add a representation of ".$(EXT_FOR_PIC_OBJECTS)" as a value
to the newext type.
Shorten some function symbol names in the newext type and its components,
to make them easier to fit without excessive line lengths in the modules
listed below.
compiler/analysis.file.m:
compiler/analysis.m:
compiler/compile_target_code.m:
compiler/du_type_layout.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.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.track_flags.m:
compiler/make.util.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.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.used_file.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Pass extensions as ext/newext pairs, not just as exts.
To make this possible, change functions and predicates that returned
just old-style extensions to return new-style extensions as well.
compiler/make.program_target.m:
Pass extensions as ext/newext pairs, not just as exts.
Add an XXX about java_object_file_extension for Julien, since he added
this option (in 2001 :-().
compiler/make.util.m:
Many operations in this module that operate on filenames did not take
those filenames as arguments; instead, they took an argument such as
a target_file from which they *computed* the filename. This meant that
any predicate that called more than one of these operations implicitly
computed the filename more than once. This could be a problem, because
- there are several predicates one can use to compute the filename, but
- there is no guarantee that different operations use the same predicate.
As a first step in fixing this, change the predicates that print
filenames in progress or error messages to take those filenames
as parameters. Delete one of them, target_file_error, because
after this change, it would have become identical to the existing
file_error predicate.
compiler/make.module_target.m:
Require the callers of record_made_target to supply the filename
as well as the target_file from which it is derived.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
Compute the filename before calling the updated operations in make.util.m
and/or make.module_target.m.
Add "XXX MAKE_STREAM" to places in the code that operate on either
implicit or badly-chosed explicit streams.
compiler/make.util.m:
The target_type_to_extension used to fail for two target types,
and one of its callers depended on it failling *only* for those two
target types.
Eliminate this unwanted coupling by making target_type_to_extension
det, returning one of three values: an extension as before, or a
representation of one or other of the two previously-failing target types.
Rename the predicate to reflect this change.
Stop exporting this predicate, since all its callers are in make.util.m.
compiler/file_names.m:
Document the meaning of the maybe_create_dirs and maybe_search types.
Delete long-obsolete references to .il files.
compiler/make.util.m:
Rename make_remove_target_file to remove_make_target_file, since this
predicate removes target files in Makefiles, and does not "make" anything.
Rename several other predicates in a similar manner, for the same reason.
Add an extra argument to get_file_name and some related predicates
that will allow future conditionally-enabled trace goals in the compiler
to track where the requests for file name translations come from.
compiler/write_deps_file.m:
Factor out some code.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Conform to the changes above.
tools/file_name_translation_stats:
Allow for large numbers of file name translations.
compiler/prog_foreign.m:
foreign_language_module_name and foreign_language_file_extension
were both functions with two modes, one of which was semidet.
Since semidet functions violate the law of least astonishment,
turn both into predicates.
Change the semidet mode into det (this has been possible ever since
we deleted the Erlang backend). Then comment out the other mode,
since it has no use left.
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
Update the calls to the affected functions (now predicates).
compiler/make.util.m:
... after inlining some of their at their only call sites.
The rest were unused.
The inlining should (eventually) help the call sites to avoid
redundant conversions from make's representation of target files
to their actual filesystem names. Eventually, because at the moment,
the other conversions are hidden somewhere in their call trees.
Keep one make_write_X predicate after renaming it to write_make_X.
Add XXXs about possible bugs.
compiler/make.dependencies.m:
Replace a higher order arg that wrote out a filename with one
that just returns that filename.
Improve some debugging output slightly.
compiler/make.module_target.m:
Inline the former make_write_X predicates.
Add XXXs about possible bugs.
compiler/make.program_target.m:
Conform to the change in make.dependencies.m.
This change improves the run time of a do-nothing build of Prince using
mmc --make on my machine from 1.46 s to 1.19 s.
compiler/make.make_info.m:
Use version_hash_table for the target_file timestamps cache
instead of a tree234 map.
compiler/make.util.m:
Add function to initialised a target_file_timestamps.
Conform to change in type.
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.top_level.m:
Conform to change in type.
Add a comment about a possible change.
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.
compiler/make.build.m:
Replace three polymorphic predicates that fold over lists of values
of type T with two, three and five monomorphic predicates respectively.
The monomorphic versions fold over lists of elements of specified types.
The list of monomorphic versions needed should be useful information for
simplifying the make package's overuse of higher order constructs.
The replaced predicates were mostly just interfaces to the predicates
that looped over the lists. This diff leaves those predicates alone.
compiler/make.dependencies.m:
Make the same change to deps_set_foldl3_maybe_stop_at_error and to
map_find_module_deps (only the first of which does a fold).
For map_find_module_deps, also change the argument order, because
operating on the second argument first, and on the first argument second,
is confusing.
compiler/make.make_info.m:
Replace a pair type, which some of the above fold operated over,
with a bespoke type, because its structure and semantics was related
to existing bespoke types.
compiler/make.program_target.m:
Conform to the changes above. In two cases, replaces nested folds
with sequences of folds, both because this is simpler, and because
it avoids the need for an extra variant of the fold.
compiler/make.module_target.m:
compiler/make.top_level.m:
compiler/make.track_flags.m:
compiler/make.util.m:
Conform to the changes above.
Previously, to look up the timestamp for a target_file we would first
compute a file name for that target_file, then look up the timestamp by
file name. This occurs frequently, so even though the computed file name
was cached, eliminating one of the two steps can be worthwhile.
This change therefore introduces a cache of timestamps indexed by
target_file, in addition to the existing cache of timestamps indexed
by file name.
Cache invalidation can be complicated because when a file is updated,
it is not straightforward to which target_file(s) may be affected.
Invalidating the entire cache is viable as it happens relatively
infrequently, and the cache will be quickly repopulated anyway.
This change improves the run time of a do-nothing build of Prince
on my machine from 1.7 s to 1.6 s.
compiler/make.make_info.m:
compiler/make.top_level.m:
Add a field to make_info to hold a cache of timestamps indexed by
target_file.
Delete the mki_search_file_name_cache field.
compiler/make.util.m:
Cache timestamps by target_file in get_target_timestamp.
Avoid computing file names until required.
Don't cache computed file names in get_file_name.
get_file_name is now called much less frequently, so caching the
result should not be necessary (but can be reintroduced if some
other code path requires it).
Clear out timestamps for target_files when a file is deleted.
compiler/make.module_target.m:
Delete old timestamp for a target_file when the target is made.
compiler/make.program_target.m:
Clear out timestamps for target_files when Java class files are
made.
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.
compiler/file_util.m:
compiler/find_module.m:
As above. Users may specify a module by its module name or
by its file name, but having the predicates that search
for a module's source, interface or optimization files by file name
be in file_util.m while similar predicates that search by module name
be in find_module.m is suboptimal, since it prevents factoring out
any commonalities, and makes it harder to spot things that *should*
be common but arent't.
compiler/check_libgrades.m:
compiler/compile_target_code.m:
compiler/make.module_dep_file.m:
compiler/make.util.m:
compiler/mercury_compile_front_end.m:
compiler/mmc_analysis.m:
compiler/options_file.m:
compiler/parse_module.m:
Update module imports.
Since this is the first converted module that dumps out goals when
debugging trace flags are enabled, this required generalizing the code
that does that, to take either varsets or var_tables as a means of
specifying the names of variables. We do this via a new type,
var_name_source, which contains either a varset or a var_table.
Almost all of this diff is there to implement this generalization.
A large part of it affects code in the parse_tree package that we use
to write out the parts of HLDS goals that are defined by types defined
in that package. Since we want to avoid making any part of the parse_tree
package dependent on the hlds package, this required defining the
var_name_source type in the parse_tree package, which in turn requires
var_table.m to be in that same package.
compiler/lco.m:
Convert this module to use var_tables instead of varsets and vartypes.
compiler/var_table.m:
Move this module from the hlds package to the parse_tree package.
To make this, possible, move the parts that required access to the HLDS
to hlds_pred.m, from where it was usually invoked.
Export some utility predicates to allow the moved code to work
in hlds_pred.m without access to the actual definition of the
var_table type.
Define the var_name_source type.
Add some utility functions for use by code writing out variable names.
compiler/hlds_pred.m:
Add the code moved from var_table.m.
compiler/vartypes.m:
Move this module from the hlds package to the parse_tree package,
for symmetry with var_table.m. It did not depend on being in hlds
in any way.
compiler/hlds.m:
compiler/parse_tree.m:
Move vartypes.m and var_table.m from the hlds package
to the parse_tree package.
compiler/hlds_out_goal.m:
Change all the predicates in this module to take a var_name_source
instead of a prog_varset.
Fix some comments.
compiler/hlds_out_util.m:
Change some of the predicates in this module (those called from
hlds_out_goal.m) to take a var_name_source instead of a prog_varset.
compiler/parse_tree_out_term.m:
Provide variants of some existing predicates and functions that take
var_name_sources instead of varsets. The code of the copies
duplicates the logic of the originals, though I hope that this
duplication can be done away with at the end of the transition.
(The best solution would be to use a typeclass with methods
that convert vars to their names, but we would want to ensure
that the compiler can specialize all the affected predicates
and functions to the two instances of this typeclass, which is
something that we cannot do yet. In the meantime, the lack of
any generalization in the old versions preserves their performance.)
tools/sort_imports:
tools/filter_sort_imports:
A new tool that automatically sorts any occurrences of consecutive
":- import_module" declarations in the named files. The sorting is done
in filter_sort_imports; sort_imports loops over the named files.
After automatically replacing all occurrences of hlds.{vartypes,var_table}
in import_module declarations with their parse_tree versions, the updated
import_module declarations were usually out of order with respect to
their neighbours. I used this script to fix that, and some earlier
out-of-order imports.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_heap_ops.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_trail_ops.m:
compiler/analysis.m:
compiler/arg_info.m:
compiler/build_mode_constraints.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/check_promise.m:
compiler/closure_analysis.m:
compiler/closure_gen.m:
compiler/code_info.m:
compiler/code_loc_dep.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/continuation_info.m:
compiler/convert_parse_tree.m:
compiler/coverage_profiling.m:
compiler/cse_detection.m:
compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/direct_arg_in_out.m:
compiler/disj_gen.m:
compiler/distance_granularity.m:
compiler/equiv_type_hlds.m:
compiler/exception_analysis.m:
compiler/file_names.m:
compiler/float_regs.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/goal_mode.m:
compiler/goal_path.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/granularity.m:
compiler/hhf.m:
compiler/higher_order.m:
compiler/hlds_clauses.m:
compiler/hlds_code_util.m:
compiler/hlds_error_util.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/hlds_out_pred.m:
compiler/hlds_rtti.m:
compiler/hlds_statistics.m:
compiler/inlining.m:
compiler/inst_check.m:
compiler/inst_test.m:
compiler/inst_user.m:
compiler/instance_method_clauses.m:
compiler/instmap.m:
compiler/intermod.m:
compiler/intermod_analysis.m:
compiler/interval.m:
compiler/introduce_exists_casts.m:
compiler/introduce_parallelism.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/llds.m:
compiler/llds_out_data.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/lookup_switch.m:
compiler/loop_inv.m:
compiler/make.module_target.m:
compiler/make.util.m:
compiler/make_goal.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_types.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_args_util.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_commit_gen.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_gen_info.m:
compiler/ml_lookup_switch.m:
compiler/ml_proc_gen.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_unify_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mmc_analysis.m:
compiler/mode_comparison.m:
compiler/mode_constraints.m:
compiler/mode_debug.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_ordering.m:
compiler/modecheck_call.m:
compiler/modecheck_coerce.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/modes.m:
compiler/module_cmds.m:
compiler/old_type_constraints.m:
compiler/opt_debug.m:
compiler/optimize.m:
compiler/options_file.m:
compiler/ordering_mode_constraints.m:
compiler/par_loop_control.m:
compiler/parse_item.m:
compiler/parse_string_format.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_to_term.m:
compiler/parse_util.m:
compiler/pd_debug.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/peephole.m:
compiler/polymorphism.m:
compiler/polymorphism_info.m:
compiler/polymorphism_lambda.m:
compiler/polymorphism_type_class_info.m:
compiler/polymorphism_type_info.m:
compiler/post_typecheck.m:
compiler/pragma_c_gen.m:
compiler/pred_name.m:
compiler/pred_table.m:
compiler/prog_item.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/quantification.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.points_to_graph.m:
compiler/rbmm.points_to_info.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/rbmm.region_transformation.m:
compiler/recompilation.used_file.m:
compiler/recompilation.version.m:
compiler/recompute_instmap_deltas.m:
compiler/resolve_unify_functor.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/set_of_var.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_conj.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_goal_scope.m:
compiler/simplify_goal_switch.m:
compiler/simplify_goal_unify.m:
compiler/simplify_info.m:
compiler/simplify_proc.m:
compiler/size_prof.m:
compiler/smm_common.m:
compiler/ssdebug.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.domain.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/superhomogeneous.m:
compiler/switch_detection.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_build.m:
compiler/term_constr_data.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/term_constr_util.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/trace_gen.m:
compiler/trailing_analysis.m:
compiler/transform_llds.m:
compiler/try_expand.m:
compiler/tupling.m:
compiler/type_assign.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/typecheck_debug.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/var_locn.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
Conform to the changes above.
library/io.file.m:
library/io.m:
Move two sections of io.m, the "file handling predicates" section
and the "handling temporary files" section to the new submodule io.file.m.
Leave behind in io.m "forwarding predicates", predicates that do nothing
except call the moved predicates in io.file.m, to provide backward
compatibility. But do mark the forwarding predicates as obsolete,
to tell people to update their (at their leisure, since the obsoleteness
warning can be turned off).
Also leave behind in io.m the definitions of the two types used
by some parameters of some of the moved predicates. Document the reason
why this is done.
library/MODULES_DOC:
List the new module among the documented modules.
NEWS:
Announce the changes.
browser/browse.m:
browser/interactive_query.m:
browser/listing.m:
compiler/analysis.file.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_util.m:
compiler/handle_options.m:
compiler/make.build.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/module_cmds.m:
compiler/parse_module.m:
compiler/passes_aux.m:
compiler/prog_event.m:
compiler/recompilation.check.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
library/dir.m:
mdbcomp/program_representation.m:
ssdb/ssdb.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
In two modules, add a #include of fcntl.h in C code. These modules contain
C code that needs this #include, but until now, they got it via a copy
in an automatically generated C header file of a foreign_decl pragma
in io.m that contained that #include. This diff moves that foreign_decl
to io.file.m, removing that crutch.
tests/debugger/browser_test.m:
tests/hard_coded/bit_buffer_test.m:
tests/hard_coded/bitmap_test.m:
tests/hard_coded/construct_bug.m:
tests/hard_coded/dir_fold.m:
tests/hard_coded/dir_test.m:
tests/hard_coded/read_binary_int16.m:
tests/hard_coded/read_binary_int32.m:
tests/hard_coded/read_binary_int64.m:
tests/hard_coded/read_binary_uint16.m:
tests/hard_coded/read_binary_uint32.m:
tests/hard_coded/read_binary_uint64.m:
tests/hard_coded/read_bitmap_size.m:
tests/hard_coded/remove_file.m:
tests/hard_coded/write_binary.m:
tests/hard_coded/write_binary_int8.m:
tests/hard_coded/write_binary_multibyte_int.m:
tests/hard_coded/write_binary_uint8.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
compiler/module_dep_info.m:
As above. The only change is added documentation.
compiler/parse_tree.m:
Include the new module in the parse_tree package.
compiler/notes/compiler_design.html:
Document the new module, and update the documentation of module_imports.m.
compiler/module_imports.m:
Delete the moved code, put the main data structure at the top,
and add some documentation for it.
compiler/compile_target_code.m:
compiler/generate_dep_d_files.m:
compiler/make.dependencies.m:
compiler/make.make_info.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/module_deps_graph.m:
Import module_dep_info.m, usually instead of module_imports.m,
sometimes beside module_imports.m.
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.
compiler/module_imports.m:
Until now, we stored the information we read in from .dep files
in module_and_imports structures in which most of the fields
were left filled-in with default values, which could be correct
only by accident.
This diff switches to storing information from .dep files in
a values of a type, module_dep_summary, that is made for this purpose.
With this type, it is obvious that the only fields that are ever
accessed are fields that have been properly filled in.
Delete the old predicate that constructed the half-filled-in
module_and_imports structure, since it is not needed anymore.
Also, delete the mcm_read construction method, since the deleted
predicate was its only user.
Since mmc --make operates both on values of this type *and* on
values of the old module_and_imports type, introduce a new type,
module_dep_info, which stores either one or the other,
and add the needed access predicates on this type.
Give a field of module_and_imports a more descriptive name.
compiler/make.m:
Switch to recording module_dep_infos for modules, instead of
just module_and_imports.
Replace some uses of maybes and pairs with bespoke types.
compiler/make.module_dep_file.m:
Store the result of reading a .dep file in a module_dep_summary,
not in a partially-filled-in module_and_imports.
compiler/module_deps_graph.m:
Store module_dep_infos in the deps_graph instead of module_and_imports
structures.
Delete a named mode, since mode "in" now works for functions
with the default mode.
compiler/make.dependencies.m:
Delete the maybe(option) field from dep_file, since it was *always*
set to "no".
Conform to the changes above.
compiler/make.util.m:
Add a new utility predicate, for use in make.dependencies.m.
Conform to the changes above.
compiler/generate_dep_d_files.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Conform to the changes above.
compiler/compile_target_code.m:
Expect a module_dep_info instead of a module_and_imports,
since that is what our callers have.
Add an XXX for a surprising piece of code.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_backend.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
compiler/erlang_rtti.m:
compiler/mercury_compile_erl_back_end.m:
Delete these modules, which together constitute the Erlang backend.
compiler/notes/compiler_design.html:
Delete references to the deleted modules.
compiler/parse_tree_out_type_repn.m:
Update the format we use to represent the sets of foreign_type and
foreign_enum declarations for a type as part of its item_type_repn_info,
now that Erlang is no longer a target language.
compiler/parse_type_repn.m:
Accept both the updated version of the item_type_repn_info and the
immediately previous version, since the installed compiler will
initially generate that previous version. However, stop accepting
an even older version that we stopped generating several months ago.
compiler/parse_pragma_foreign.m:
When the compiler finds a reference to Erlang as a foreign language,
add a message about support for Erlang being discontinued to the error
message.
Make the code parsing foreign_decls handle the term containing
the foreign language the same way as the codes parsing foreign
codes, procs, types and enums.
Add a mechanism to help parse_mutable.m to do the same.
compiler/parse_mutable.m:
When the compiler finds a reference to Erlang as a foreign language,
print an error message about support for Erlang being discontinued.
compiler/compute_grade.m:
When the compiler finds a reference to Erlang as a grade component,
print an informational message about support for Erlang being discontinued.
compiler/pickle.m:
compiler/make.build.m:
Delete Erlang foreign procs and types.
compiler/add_foreign_enum.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_type.m:
compiler/check_libgrades.m:
compiler/check_parse_tree_type_defns.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/const_struct.m:
compiler/convert_parse_tree.m:
compiler/dead_proc_elim.m:
compiler/decide_type_repn.m:
compiler/deps_map.m:
compiler/du_type_layout.m:
compiler/export.m:
compiler/foreign.m:
compiler/globals.m:
compiler/granularity.m:
compiler/handle_options.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_module.m:
compiler/inlining.m:
compiler/int_emu.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/lco.m:
compiler/llds_out_file.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_separate_items.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/ml_code_util.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_target_util.m:
compiler/ml_top_gen.m:
compiler/mlds.m:
compiler/mlds_dump.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_type.m:
compiler/module_imports.m:
compiler/parse_pragma_foreign.m:
compiler/parse_tree_out.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/prog_data.m:
compiler/prog_data_foreign.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/simplify_goal_scope.m:
compiler/special_pred.m:
compiler/string_encoding.m:
compiler/top_level.m:
compiler/uint_emu.m:
compiler/write_deps_file.m:
Remove references to Erlang as a backend or as a target language.
tests/invalid/bad_foreign_code.{m,err_exp}:
tests/invalid/bad_foreign_decl.{m,err_exp}:
tests/invalid/bad_foreign_enum.{m,err_exp}:
tests/invalid/bad_foreign_export.{m,err_exp}:
tests/invalid/bad_foreign_export_enum.{m,err_exp}:
tests/invalid/bad_foreign_import_module.{m,err_exp}:
tests/invalid/bad_foreign_proc.{m,err_exp}:
tests/invalid/bad_foreign_type.{m,err_exp}:
Add a test for Erlang as an invalid foreign language. Expect both the
new error message for this new error, and the updated list of now-valid
foreign languages on all errors.
... using an approach proposed by Peter, with an extra twist from Julien.
Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.
The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.
Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.
library/getopt.m:
library/getopt_io.m:
Make the changes described above.
library/Mmakefile:
Instead of building both getopt_io.m and getopt.m from getopt_template,
build getopt.m from getopt_io.m.
tools/bootcheck:
Delete references to getopt_template.
compiler/typecheck_errors.m:
When a type error involves one of the getopt/getopt_io predicates
whose interfaces are changed by this diff, tell the user about
how these changes could have caused the error, and thus what the
probable fix is.
compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
Use the updated getopt interface.
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Replace references to getopt_io.m with references to getopt.m.
tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
New test cases for the extra help
tests/invalid/Mmakefile:
Enable the new test cases.
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: