mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-10 11:23:15 +00:00
026148c907be6be23f45cf69862d1fcfc2b7e947
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1b093f34ee |
Stop using a type where it does not belong.
compiler/module_imports.m:
The module_timestamp type has long had a field of the need_qualifier type.
For a year or more now, this field has had a big comment on it explaining
why its use here does not match the semantics of the need_qualifier type.
This diff gives this field a new, bespoke type, that is isomorphic
to need_qualifier, but is completely deparate. Document the reason why
I *can't* document the semantics of this new type :-(
compiler/grab_modules.m:
Do the same kind of replacement on values that are used only to set
this field of module_timestamps.
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
Use the values of the new type to make the same decisions we used to make
using values of the need_qualifier type.
tests/recompilation/*.m*:
Bring the programming style of these modules up to date.
tests/recompilation/*.err_exp.2:
Expect the updated line numbers in messages.
Delete the need_qualifier field from timestamps.
|
||
|
|
9dd11b2fc6 |
Smart recompilation. Record version numbers for each item
Estimated hours taken: 400
Smart recompilation. Record version numbers for each item
in interface files. Record which items are used in each compilation.
Only recompile a module if the output file does not exist or
nothing has changed.
There is still some work to do on this:
- it doesn't work with inter-module optimization.
- it doesn't work when the module name doesn't match the file name.
(this problem will go away when mmake functionality is moved into
the compiler.
I'll hold off documenting this change in the NEWS file and
on the web page for a month or so, until I've had a bit more
experience using it.
compiler/options.m:
compiler/handle_options.m:
doc/user_guide.texi:
Add an option `--smart-recompilation', currently off by default.
Add an internal option `--generate-version-numbers' to control
whether version numbers are written to the interface files. If
`--smart-recompilation' is disabled because the module
is being compiled with `--intermodule-optimization' (e.g. in the
standard library), we still want to write the version numbers
to the interface files.
Add an option `--verbose-recompilation' (default off)
to write messages describing why recompilation is needed.
Add an option `--warn-smart-recompilation' (default on)
to control warnings relating to the smart recompilation
system. Warn if smart recompilation will not work with
the output and inter-module optimization options given.
compiler/recompilation.m:
Type declarations for smart recompilation.
Predicates to record program items used by compilation.
compiler/recompilation_version.m:
Compute version numbers for program items in interface files.
compiler/recompilation_usage.m:
Find all items used by a compilation.
compiler/recompilation_check.m:
Check whether recompilation is necessary.
compiler/timestamp.m:
Timestamp ADT for smart recompilation.
compiler/mercury_compile.m:
Invoke the smart recompilation passes.
compiler/modules.m:
compiler/prog_io.m:
Return timestamps for modules read.
When reading a module make sure the current input stream
is reset to its old value, not stdin.
Handle version number items in interface files.
compiler/module_qual.m:
compiler/unify_proc.m:
compiler/make_hlds.m:
Record all items used by local items.
compiler/make_hlds.m:
Process `:- pragma type_spec' declarations in
add_item_list_clauses. The qual_info is needed
when processing `:- pragma type_spec' declarations
so that any equivalence types used by the declaration
can be recorded as used by the predicate or function to
which the `:- pragma type_spec' applies.
compiler/equiv_type.m:
For each imported item, record which equivalence types
are used by that item.
compiler/hlds_module.m:
Add a field to the module_info to store information about
items used during compilation of a module.
compiler/check_typeclass.m:
Make sure any items used in clauses for typeclass method
implementations are recorded in the `.used' file.
compiler/prog_data.m:
compiler/*.m:
Factor out some duplicated code by combining the
pred and func, and pred_mode and func_mode items.
Make it easier to extract the name of a type, inst or mode
from its declaration.
Add an item type to hold the version numbers for an interface file.
Allow warnings to be reported for `nothing' items (used for
reporting when version numbers are written using an
obsolete format).
compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/typecheck.m:
compiler/type_util.m:
compiler/*.m:
Strip contexts from all types, not just those in class constraints.
This makes it possible to use ordinary unification to check
whether items have changed (with the exception of clauses).
Remove code to create types with contexts in typechecking.
Remove code scattered through the compiler to remove contexts
from types in class constraints.
compiler/hlds_pred.m:
compiler/prog_util.m:
Move hlds_pred__adjust_func_arity to prog_util, so that it
can be used by the pre-hlds passes.
compiler/typecheck.m:
compiler/hlds_module.m:
Move typecheck__visible_modules to hlds_module.m, so it can
be used by recompilation_usage.m.
compiler/typecheck.m:
Add a comment telling where updates may be required if the
code to typecheck a var-functor unification changes.
compiler/error_util.m:
Allow writing messages without contexts (used for the verbose
recompilation messages).
Add functions to format sym_name and sym_name_and_arity,
and to add punctuation to the end of an error message
without unwanted line breaks before the punctuation.
scripts/Mmake.rules:
compiler/modules.m:
Don't remove the output file before running the compiler. We need
to leave the old output file intact if smart recompilation detects
that recompilation is not needed.
compiler/notes/compiler_design.html:
Document the new modules.
library/io.m:
NEWS:
Add predicates to find the modification time of files
and input_streams.
library/set.m:
NEWS:
Add a predicate version of set__fold
Don't sort the output of set__filter, it's already sorted.
library/std_util.m:
NEWS:
Add a predicate `std_util__map_maybe/3' and a function
`std_util__map_maybe/2' to apply a predicate or a function to
a value stored in a term of type `std_util__maybe'.
configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
When checking whether the compiler is recent enough, check for
the --warn-smart-recompilation option.
Check for stat().
library/Mmakefile:
Disable warnings about smart recompilation not working with
`--intermodule-optimization'.
browser/Mmakefile:
Disable warnings about smart recompilation not working when
the module name doesn't match the file name.
runtime/mercury_string.h:
Add a macro MR_make_string_const() which automates computation
of the length of string argument to MR_string_const().
tests/recompilation/Mmakefile:
tests/recompilation/runtests:
tests/recompilation/test_functions:
tests/recompilation/TESTS:
tests/recompilation/README:
A framework for testing smart recompilation.
The option currently only works for the recompilation directory.
tests/recompilation/TEST.m.{1,2}:
tests/recompilation/TEST_2.m.{1,2}:
tests/recompilation/TEST.exp.{1,2}:
tests/recompilation/TEST.err_exp.2:
Test cases, where TEST is one of add_constructor_r, add_instance_r,
add_instance_2_r, add_type_nr, change_class_r, change_instance_r,
change_mode_r, field_r, func_overloading_nr, func_overloading_r,
lambda_mode_r, nested_module_r, no_version_numbers_r,
pragma_type_spec_r, pred_ctor_ambiguity_r, pred_overloading_r,
add_type_re, remove_type_re, type_qual_re.
tests/handle_options:
Add an option `-e' to generate any missing expected output files.
|