Commit Graph

5 Commits

Author SHA1 Message Date
Simon Taylor
d26863ea86 Fix bugs in the handling of nested sub-modules with --smart-recompilation.
Estimated hours taken: 1
Branches: main

Fix bugs in the handling of nested sub-modules with --smart-recompilation.

compiler/recompilation_check.m:
	If an error occurs before the nested sub-modules of the top-level
	module are known, recompile all of the nested sub-modules.

	If there is a syntax error in a `.used' file, recompile all
	sub-modules. This makes the above change simpler, and is probably
	a good idea anyway -- all outputs from a compilation which produces
	output files containing syntax errors are suspect.

compiler/mercury_compile.m:
	When working out the list of sub-modules of the main module
	in a source file, use all the sub-modules, not just the ones
	that are being recompiled.

tests/recompilation/Mmakefile:
tests/recompilation/TESTS:
tests/recompilation/nested_module_2_r*:
	Test case.
2001-10-24 05:56:41 +00:00
Zoltan Somogyi
6221d014b7 Change the function symbols in type module_errors to avoid clashes with
Estimated hours taken: 0.3
Branches: main

Change the function symbols in type module_errors to avoid clashes with
the function symbols of type bool.

compiler/prog_io.m:
	Change the function symbols in type module_errors to avoid clashes with
	the function symbols of type bool. The new function symbols are more
	meaningful.

compiler/intermod.m:
compiler/mercury_compile.m:
compiler/modules.m:
compiler/recompilation_check.m:
compiler/trans_opt.m:
	Conform to the change to module_errors.

compiler/typecheck.m:
	Delete a now unnecessary type disambiguation.
2001-07-16 08:21:05 +00:00
Simon Taylor
d999b9d330 Slightly modify the types defined in this module to avoid a bogus
Estimated hours taken: 0.5
Branches: main

recompilation.m:
	Slightly modify the types defined in this module to avoid a bogus
	syntax error when compiling the C generated for it using lcc.

recompilation_check.m:
recompilation_usage.m:
recompilation_version.m:
	Changes required by the above.
2001-07-11 15:44:21 +00:00
Simon Taylor
4a7fb746f9 Use a timestamp file mechanism similar to that used for `.int' files
Estimated hours taken: 3

Use a timestamp file mechanism similar to that used for `.int' files
to avoid rechecking whether a module needs to be recompiled on each
mmake if no used interfaces have changed.

compiler/mercury_compile.m:
	Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
	after compilation has finished.

compiler/recompilation_check.m:
	Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
	if a module does not need to be recompiled.

compiler/modules.m:
scripts/Mmake.rules:
	Set up the make dependencies for timestamp files, in a similar
	manner to the `.date' files.

	Remove the timestamp files in the `clean' mmake target.

	Handle `.s' and `.pic_s' files as for the `.o' files
	when using `--target asm'. There are no `.s' or `.pic_s'
	files for nested modules.

scripts/Mmake.vars.in:
	Set up the subdir variables for the timestamp files.

Mmakefile:
scripts/mercury_cleanup_install:
	Save/restore the timestamp files and the `.used' files
	across the library grade installation.

configure.in:
	Remove the `.c_date' files for the `.c' files that
	need to be rebuilt.

doc/user_guide.texi:
	Document the new file extensions.
2001-07-06 11:25:36 +00:00
Simon Taylor
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.
2001-06-27 05:05:21 +00:00