Commit Graph

2 Commits

Author SHA1 Message Date
Zoltan Somogyi
de2f7b2a0c Flatten the test directories, step 2.
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.
2015-02-10 00:44:14 +11:00
Peter Wang
6eab527191 More changes to the intermodule analysis framework.
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.
2008-06-05 06:25:20 +00:00