My commit afe2887882 broke the ability
to run the test suite outside of a bootcheck by executing "mmake runtests"
in the tests directory. This diff fixes that.
tests/Mmake.common:
Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile
defined it as such, I overlooked the fact that tests/Mmakefile itself
defined it ".", referring to the same directory from a different starting
point. Document this easily-overlooked fact.
Rename the old runtests target, which after afe2887 runs the tests
in a single directory, as runtests_dir, to leave the target name
"runtests" itself free for tests/Mmakefile to use.
tests/Mmakefile:
Define "TESTS_DIR = .", and add a target "runtests" which invokes
"mmake runtests_dir" in each test directory.
tools/bootcheck:
Invoke "mmake runtests_dir" instead of "mmake runtests" in each
test directory.
Initialize a variable just before it is used.
tests/*/Mmakefile:
Add back the definition "TESTS_DIR = .."
A long time ago, test directories such as hard_coded had subdirectories
such as hard_coded/typeclasses. These have since been flattened out
(e.g. hard_coded/typeclasses is now just typeclasses), but there were
still remnants of the old approach. This diff deletes those remnants.
tests/*/Mmakefile:
Delete the TESTS_DIR and the SUBDIRS mmake variables; TESTS_DIR
was always set to "..", and SUBDIRS to the empty string.
Delete any references to the make variable NOT_WORKING, since
it is never used.
tests/Mmake.common:
Document that Mmakefiles in test directories don't have to set
TESTS_DIR and SUBDIRS anymore. Fix the formatting of the documentation
of the make variables they do still have to set.
Delete the targets and actions for handling subdirectories of
test directories, since there aren't any.
tests/Mmakefile:
Simplify some code.
tests/Mmake.common:
Don't invoke any actions in the clean_local and realclean_local
targets, since if using mmc --make, the builtin mmake rules
have actions for those targets as well, and make can't handle
more than one action for a target having actions. Replace those
actions with dependencies on other, unique targets that have
the actions instead.
tests/*/Mmakefile:
Avoid actions in clean_local and realclean_local targets the same way.
Sort the test names in some directories that didn't already do so.
Delete some obsolete comments.
Fix style.
tests/valid/Mmake.valid.common:
As for the Mmakefiles above, and also move the definition of a make
variable before it is needed.
tests/Mmake.common:
Replace the -j1 in the runtests_local target used by all the test
directories with $(MAYBE_J1).
tests/*/Mmakefile:
Define MAYBE_J1 it as the empty string in test directories in which
different tests don't share source files.
Define MAYBE_J1 as -j1 in test directories in which
different tests do share source files.
tests/submodules/sub2_a.m:
Add this copy of sub_a.m to allow tests in the submodules directory
to be done in parallel.
tests/submodules/accessibility2.m:
Import sub2_a.m instead of sub_a.m.
tests/warnings/ambig_types_high_level.m:
Add this copy of ambig_types.m to allow tests in the warnings directory
to be done in parallel.
tests/warnings/ambig_high_level.m:
Import ambig_types_high_level.m instead of ambig_types.m.
Specifically, rename the following subdirectories of the test directory:
old dir name new dir name
analysis/ext analysis_external
analysis/ctgc analysis_ctgc
analysis/excp analysis_excp
analysis/table analysis_table
analysis/trail analysis_trail
invalid/purity invalid_purity
analysis/sharing analysis_sharing
hard_coded/purity purity
general/accumulator accumulator
analysis/unused_args analysis_unused_args
debugger/declarative declarative_debugger
hard_coded/exceptions exceptions
general/string_format string_format
hard_coded/sub-modules submodules
hard_coded/typeclasses typeclasses
general/structure_reuse structure_reuse
Some subdirectories are still there, to wit, the subdirs of the inactive
test directory stm, each of which (if I remember correctly) holds only one
test case.
The general/structure_reuse directory previously wasn't enabled; I think
this was a bug.
tests/Mmakefile:
tools/bootcheck:
List the new test directories.
tests/Mmake.common:
The analysis_* directories each need to know whether the workspace
uses subdirs. This used to be controlled from one place,
analysis/Mmakefile, but since analysis_* are not subdirs of analysis,
we need a new central place to find this out.
tests/analysis/common.sh:
Update documentation for the move.
tests/OLDDIRS/Mmakefile:
Set the subdir list to empty.
tests/NEWDIRS/Mmakefile:
Update the "this" directory's name, as well as TESTS_DIR.
In analysis_*/Mmakefile, use the new mechanism for detecting the presence
of subdirs.
Specifically, rename the following subdirectories of the test directory:
old dir name new dir name
analysis/ext analysis_external
analysis/ctgc analysis_ctgc
analysis/excp analysis_excp
analysis/table analysis_table
analysis/trail analysis_trail
invalid/purity invalid_purity
analysis/sharing analysis_sharing
hard_coded/purity purity
general/accumulator accumulator
analysis/unused_args analysis_unused_args
debugger/declarative declarative_debugger
hard_coded/exceptions exceptions
general/string_format string_format
hard_coded/sub-modules submodules
hard_coded/typeclasses typeclasses
general/structure_reuse structure_reuse
Some subdirectories are still there, to wit, the subdirs of the inactive
test directory stm, each of which (if I remember correctly) holds only one
test case.
The general/structure_reuse directory previously wasn't enabled; I think
this was a bug.
tests/Mmakefile:
tools/bootcheck:
List the new test directories.
tests/Mmake.common:
The analysis_* directories each need to know whether the workspace
uses subdirs. This used to be controlled from one place,
analysis/Mmakefile, but since analysis_* are not subdirs of analysis,
we need a new central place to find this out.
tests/analysis/common.sh:
Update documentation for the move.
tests/OLDDIRS/Mmakefile:
Set the subdir list to empty.
tests/NEWDIRS/Mmakefile:
Update the "this" directory's name, as well as TESTS_DIR.
In analysis_*/Mmakefile, use the new mechanism for detecting the presence
of subdirs.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.
*/Makefile:
*/Mmakefile:
As above.
tests/hard_coded/.gitignore:
Don't ignore the purity subdir. This ignore must have been left over
from when purity.m was a test in hard_coded, not hard_coded/purity,
and it ignored an executable, not a directory.
A number of patterns and filenames where missing from .gitignore files,
especially in the tests/ directory.
.gitignore:
boehm_gc/.gitignore:
boehm_gc/libatomic_ops/pkgconfig/.gitignore:
runtime/.gitignore:
scripts/.gitignore:
tests/.gitignore:
tests/analysis/table/.gitignore:
tests/analysis/trail/.gitignore:
tests/benchmarks/.gitignore:
tests/debugger/.gitignore:
tests/invalid/.gitignore:
tests/mmc_make/.gitignore:
tests/mmc_make/lib/.gitignore:
Add new patterns to .gitignore files.
Remove some patterns that are implicit because they're in a parent
directory's file.
tests/analysis/.gitignore:
After removing superfluous patterns this file was empty. I've deleted
it.
Branches: main, 11.07
Make the none.gc.memprof grade work with MSVC again.
Avoid more warnings when compiling with MSVC.
compiler/layout_out.m:
Avoid an incomplete type in the declaration of the alloc_sites
array. (Similar changes need to be made for the layout structures
related to debugging and deep profiling - I am in the process of
testing the former, the latter doesn't currently work on Windows
any way.)
browser/listing.m:
Use don't-care variables in some foreign_procs.
This avoids warnings about assignments from uninitialized
variables with MSVC.
*/.cvsignore:
Update cvsignore entries.
Ignore files generated by mprof.
tests/analysis/ctgc/reuse_runtest.sh:
tests/analysis/excp/excp_runtest.sh:
tests/analysis/ext/ext2_runtest.sh:
tests/analysis/ext/ext_runtest.sh:
tests/analysis/sharing/sharing_runtest.sh:
tests/analysis/table/table_runtest.sh:
tests/analysis/trail/trail_runtest.sh:
tests/analysis/unused_args/unused_args_runtest.sh:
Use `.' command instead of `source' as the latter is not portable.
Branches: main
In structure sharing and structure reuse analyses, we weren't renaming
variables from imported `sharing_as' and `reuse_as' structures to match the
variable names used in the current compiler run. It was only by luck if a
particular variable number referred to the same thing in an imported answer
as in the procedure being analysed.
We *were* doing it for `--transitive-' and `--intermodule-optimisation'
but not for `--intermodule-analysis'.
compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
Change structure sharing and reuse answers to store
`structure_sharing_domain', `structure_reuse_domain' structures instead
of `sharing_as' and `reuse_as' structures.
Rename the variables from imported answers.
Bump analysis versions.
compiler/structure_sharing.domain.m:
Hide `sharing_as' again as we no longer need it outside this module.
tests/analysis/ctgc/reuse_runtest.sh:
Update test cases for changed answer formats.
Estimated hours taken: 0.1
Branches: main
analysis/unused_args/Mercury.options:
Hack to make this directory work on some nightly tests where
EXTRA_MCFLAGS=-O2 is passed on the `mmake' command line.
Estimated hours taken: 0.2
Branches: main
The tests in the `tests/analysis' directory fail to run during the nightly
tests because then `--intermodule-optimisation' might be present in
EXTRA_MCFLAGS, which is incompatible with `--intermodule-analysis'.
tests/analysis/Mmakefile:
tests/analysis/ctgc/Mmakefile:
tests/analysis/excp/Mmakefile:
tests/analysis/ext/Mmakefile:
tests/analysis/sharing/Mmakefile:
tests/analysis/table/Mmakefile:
tests/analysis/trail/Mmakefile:
tests/analysis/unused_args/Mmakefile:
Delete `--intermodule-optimisation' and also
`--transitive-intermodule-optimisation' from EXTRA_MCFLAGS when
running in these directories.
Branches: main
Store call and answer patterns as terms in `.analysis' (and related) files and
not strings. It's easier to convert complex patterns to/from terms than
strings. Also change the module names and function-ids while we're at it.
compiler/analysis.m:
Replace the `to_string' typeclass with a `to_term' typeclass. Make
call and answer patterns convert to/from terms instead of strings.
compiler/analysis.file.m:
Read/write terms for call and answer patterns.
Read/write module names and function-ids with more natural syntax
than the term representations of internal data structures.
Bump the analysis file version number.
Move some code around.
Use promise_equivalent_solutions goals instead of
promise_equivalent_solution_io.
compiler/exception_analysis.m:
compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
Conform to `to_term' typeclass interface.
tests/analysis/ctgc/reuse_runtest.sh:
tests/analysis/excp/excp_runtest.sh:
tests/analysis/sharing/sharing_runtest.sh:
tests/analysis/unused_args/unused_args_runtest.sh:
Update test scripts for changed file formats.
compiler/mercury_compile.m:
Print verbose messages and report stats when reading in files for
intermodule analysis.
Branches: main
tests/analysis/Mmakefile:
tests/analysis/ctgc/Mmakefile:
I accidentally committed a set of tests in the directory
`analysis/ctgc' instead of `analysis/reuse'. Update the makefiles to
reflect the name that was actually used.
Branches: main
More changes to the intermodule analysis framework. This patch mainly deals
with incorrect treatment of :- external procedures, opt_imported procedures,
and forcing the correct reanalyses when answers change or requests are
satisfied.
- Previously, the way to ensure that a module M is reanalysed if a request in
module N is satisfied was, while analysing M: assume an answer for the
procedure in N; record that as a result in N; and record that M has a
dependency on that answer. When N is analysed, if the real answer is
better than the assumed answer, M would be marked `suboptimal' and later
reanalysed.
That's complicated and wasn't always done correctly. Now we remember the
module which makes a request. When the request is satisfied, we mark the
requesting module as `suboptimal'. This also means the `.analysis' file of
a module will only be modified when analysing that module and no others,
which should be useful for parallel builds.
- In most analyses we weren't recording results for exported `:- external'
procedures as we don't have their clauses and don't analyse them. Other
modules would happily make requests for `:- external' procedures, which
would never be satisfied.
- We shouldn't make intermodule requests for `opt_imported' procedures as we
actually have their clauses. Even if the request is satisfied, we'd
probably not look them up since we do have their clauses.
- If a module M opt_imports a procedure P from module N (its clauses are
available while analysing M) then M also needs to depend on any answers
required by P. Otherwise a change to an answer required by P won't cause M
to be reanalysed.
- There doesn't seem to be any reason to keep track of the analysis status of
individual results. If an answer changes requiring another module to be
reanalysed, the *whole module* will be marked suboptimal or invalid. And
if that results in changed answers, its dependant modules will be marked.
This patch doesn't remove the status of individual results but makes them
always `optimal'.
compiler/analysis.m:
Remember the name of the module being analysed in the analysis_info.
Simplify some predicate interfaces with this information.
Remember whether we're currently making an analysis file or just
reading from them. Make the record_* predicates do nothing in the
latter case, so the caller doesn't need to check. Also make the
record predicates do the right thing if the callee module is
non-local, e.g. don't make requests to non-local modules.
Automatically add a request if depending on a result that doesn't
exist.
Add a procedure to return the existing call patterns for a procedure,
regardless of whether the module has been marked `invalid'.
Add some assertions to check the analysis framework is being used as
intended.
Minor cleanups.
compiler/analysis.file.m:
Record the module that made the request in `.request' files.
Bump the analysis file version number.
compiler/hlds_module.m:
Pass extra arguments to `init_analysis_info'.
compiler/hlds_pred.m:
Add `pred_info_is_imported_not_external' which doesn't succeed on
`:- external' procedures (defined in the current module), unlike
`pred_info_is_imported'.
compiler/exception_analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
Record results for `:- external' procedures.
Don't look up results for our own `:- external' procedures from the
analysis registry. In general, fix many spots where external procs
would be treated as imported.
Write out results for procedures which are exported to submodules.
Conform to analysis framework changes. Remove some redundant checks
which have been moved into the framework.
compiler/mercury_compile.m:
Conform to analysis framework changes.
compiler/structure_reuse.analysis.m:
Be careful not to read in requests and call patterns for
`opt_imported' procedures as if they were defined in the current
module.
If depending on an answer that doesn't exist, also make a request for
that answer.
Conform to analysis framework changes.
Write out messages when removing useless reuse version procedures.
compiler/structure_reuse.indirect.m:
Use `pred_info_is_imported_not_external' so as not to look up results
for our own `:- external' procedures from the analysis registry.
Treat `opt_imported' procedures as intra-module as far as requests
are concerned. We need to satisfy requests for them in the current
compiler invocation rather than when analysing imported modules.
compiler/structure_sharing.analysis.m:
Fix treatment of `:- external' procedures.
Conform to analysis framework changes.
compiler/structure_sharing.domain.m:
Don't return suboptimal when unable to look up a result.
compiler/mmc_analysis.m:
Replace pred_or_func_name_arity_to_func_id by a higher-level
predicate.
tests/Mmakefile:
tests/analysis/Mmakefile:
tests/analysis/common.sh:
tests/analysis/excp/Mercury.options:
tests/analysis/excp/Mmakefile:
tests/analysis/excp/excp_m1.m.exception:
tests/analysis/excp/excp_m1.m.no_exception:
tests/analysis/excp/excp_m2.m:
tests/analysis/excp/excp_m3.m:
tests/analysis/excp/excp_runtest.sh:
tests/analysis/ext/Mercury.options:
tests/analysis/ext/Mmakefile:
tests/analysis/ext/ext.m:
tests/analysis/ext/ext2.m:
tests/analysis/ext/ext2_runtest.sh:
tests/analysis/ext/ext_runtest.sh:
tests/analysis/sharing/Mercury.options:
tests/analysis/sharing/Mmakefile:
tests/analysis/sharing/sharing_m1.m.no_share:
tests/analysis/sharing/sharing_m1.m.share:
tests/analysis/sharing/sharing_m2.m:
tests/analysis/sharing/sharing_m3.m:
tests/analysis/sharing/sharing_runtest.sh:
tests/analysis/table/Mercury.options:
tests/analysis/table/Mmakefile:
tests/analysis/table/table_m1.m.no_tabling:
tests/analysis/table/table_m1.m.tabling:
tests/analysis/table/table_m2.m:
tests/analysis/table/table_m3.m:
tests/analysis/table/table_runtest.sh:
tests/analysis/trail/Mercury.options:
tests/analysis/trail/Mmakefile:
tests/analysis/trail/trail_m1.m.no_trail:
tests/analysis/trail/trail_m1.m.trail:
tests/analysis/trail/trail_m2.m:
tests/analysis/trail/trail_m3.m:
tests/analysis/trail/trail_runtest.sh:
tests/analysis/unused_args/Mercury.options:
tests/analysis/unused_args/Mmakefile:
tests/analysis/unused_args/ua_m1.m.no_unused_args:
tests/analysis/unused_args/ua_m1.m.unused_args:
tests/analysis/unused_args/ua_m2.m:
tests/analysis/unused_args/ua_m3.m:
tests/analysis/unused_args/unused_args_runtest.sh:
Add test cases.
Branches: main
More changes to the intermodule analysis framework. This patch mainly deals
with incorrect treatment of :- external procedures, opt_imported procedures,
and forcing the correct reanalyses when answers change or requests are
satisfied.
- Previously, the way to ensure that a module M is reanalysed if a request in
module N is satisfied was, while analysing M: assume an answer for the
procedure in N; record that as a result in N; and record that M has a
dependency on that answer. When N is analysed, if the real answer is
better than the assumed answer, M would be marked `suboptimal' and later
reanalysed.
That's complicated and wasn't always done correctly. Now we remember the
module which makes a request. When the request is satisfied, we mark the
requesting module as `suboptimal'. This also means the `.analysis' file of
a module will only be modified when analysing that module and no others,
which should be useful for parallel builds.
- In most analyses we weren't recording results for exported `:- external'
procedures as we don't have their clauses and don't analyse them. Other
modules would happily make requests for `:- external' procedures, which
would never be satisfied.
- We shouldn't make intermodule requests for `opt_imported' procedures as we
actually have their clauses. Even if the request is satisfied, we'd
probably not look them up since we do have their clauses.
- If a module M opt_imports a procedure P from module N (its clauses are
available while analysing M) then M also needs to depend on any answers
required by P. Otherwise a change to an answer required by P won't cause M
to be reanalysed.
- There doesn't seem to be any reason to keep track of the analysis status of
individual results. If an answer changes requiring another module to be
reanalysed, the *whole module* will be marked suboptimal or invalid. And
if that results in changed answers, its dependant modules will be marked.
This patch doesn't remove the status of individual results but makes them
always `optimal'.
compiler/analysis.m:
Remember the name of the module being analysed in the analysis_info.
Simplify some predicate interfaces with this information.
Remember whether we're currently making an analysis file or just
reading from them. Make the record_* predicates do nothing in the
latter case, so the caller doesn't need to check. Also make the
record predicates do the right thing if the callee module is
non-local, e.g. don't make requests to non-local modules.
Automatically add a request if depending on a result that doesn't
exist.
Add a procedure to return the existing call patterns for a procedure,
regardless of whether the module has been marked `invalid'.
Add some assertions to check the analysis framework is being used as
intended.
Minor cleanups.
compiler/analysis.file.m:
Record the module that made the request in `.request' files.
Bump the analysis file version number.
compiler/hlds_module.m:
Pass extra arguments to `init_analysis_info'.
compiler/hlds_pred.m:
Add `pred_info_is_imported_not_external' which doesn't succeed on
`:- external' procedures (defined in the current module), unlike
`pred_info_is_imported'.
compiler/exception_analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
Record results for `:- external' procedures.
Don't look up results for our own `:- external' procedures from the
analysis registry. In general, fix many spots where external procs
would be treated as imported.
Write out results for procedures which are exported to submodules.
Conform to analysis framework changes. Remove some redundant checks
which have been moved into the framework.
compiler/mercury_compile.m:
Conform to analysis framework changes.
compiler/structure_reuse.analysis.m:
Be careful not to read in requests and call patterns for
`opt_imported' procedures as if they were defined in the current
module.
If depending on an answer that doesn't exist, also make a request for
that answer.
Conform to analysis framework changes.
Write out messages when removing useless reuse version procedures.
compiler/structure_reuse.indirect.m:
Use `pred_info_is_imported_not_external' so as not to look up results
for our own `:- external' procedures from the analysis registry.
Treat `opt_imported' procedures as intra-module as far as requests
are concerned. We need to satisfy requests for them in the current
compiler invocation rather than when analysing imported modules.
compiler/structure_sharing.analysis.m:
Fix treatment of `:- external' procedures.
Conform to analysis framework changes.
compiler/structure_sharing.domain.m:
Don't return suboptimal when unable to look up a result.
compiler/mmc_analysis.m:
Replace pred_or_func_name_arity_to_func_id by a higher-level
predicate.
tests/Mmakefile:
tests/analysis/Mmakefile:
tests/analysis/common.sh:
tests/analysis/excp/Mercury.options:
tests/analysis/excp/Mmakefile:
tests/analysis/excp/excp_m1.m.exception:
tests/analysis/excp/excp_m1.m.no_exception:
tests/analysis/excp/excp_m2.m:
tests/analysis/excp/excp_m3.m:
tests/analysis/excp/excp_runtest.sh:
tests/analysis/ext/Mercury.options:
tests/analysis/ext/Mmakefile:
tests/analysis/ext/ext.m:
tests/analysis/ext/ext2.m:
tests/analysis/ext/ext2_runtest.sh:
tests/analysis/ext/ext_runtest.sh:
tests/analysis/sharing/Mercury.options:
tests/analysis/sharing/Mmakefile:
tests/analysis/sharing/sharing_m1.m.no_share:
tests/analysis/sharing/sharing_m1.m.share:
tests/analysis/sharing/sharing_m2.m:
tests/analysis/sharing/sharing_m3.m:
tests/analysis/sharing/sharing_runtest.sh:
tests/analysis/table/Mercury.options:
tests/analysis/table/Mmakefile:
tests/analysis/table/table_m1.m.no_tabling:
tests/analysis/table/table_m1.m.tabling:
tests/analysis/table/table_m2.m:
tests/analysis/table/table_m3.m:
tests/analysis/table/table_runtest.sh:
tests/analysis/trail/Mercury.options:
tests/analysis/trail/Mmakefile:
tests/analysis/trail/trail_m1.m.no_trail:
tests/analysis/trail/trail_m1.m.trail:
tests/analysis/trail/trail_m2.m:
tests/analysis/trail/trail_m3.m:
tests/analysis/trail/trail_runtest.sh:
tests/analysis/unused_args/Mercury.options:
tests/analysis/unused_args/Mmakefile:
tests/analysis/unused_args/ua_m1.m.no_unused_args:
tests/analysis/unused_args/ua_m1.m.unused_args:
tests/analysis/unused_args/ua_m2.m:
tests/analysis/unused_args/ua_m3.m:
tests/analysis/unused_args/unused_args_runtest.sh:
Add test cases.