Commit Graph

69 Commits

Author SHA1 Message Date
Warwick Harvey
d2b98d996c Fixed a typo in the rule to generate .pic_o' files from .m' files
Estimated hours taken: 0.25

scripts/Mmake.rules:
	Fixed a typo in the rule to generate `.pic_o' files from `.m' files
	when `RM_C' is not set to `:'.
1999-07-14 07:17:51 +00:00
Mark Brown
bf66b3545c Add two new mmake targets, clean_local and realclean_local, which
Estimated hours taken: 1

Add two new mmake targets, clean_local and realclean_local, which
are the same as clean and realclean except that the former retain their
original meanings if rules are added to the latter.  This is useful
if users want to add rules for a recursive mmake clean.

compiler/modules.m:
	Output `clean_local: module.clean' to generated .dep files
	instead of `clean: module.clean'.  Same for `realclean'.

scripts/Mmake.rules:
	Add dependencies to implement the original targets in terms of
	the new targets.
1999-07-09 04:53:13 +00:00
Fergus Henderson
e06fa4993d For --use-subdirs, add `-I.' to ALL_MGNUCFLAGS rather than to
Estimated hours taken: 0.25

scripts/Mmake.rules:
	For --use-subdirs, add `-I.' to ALL_MGNUCFLAGS rather than to
	MGNUCFLAGS.  This avoids problems where EXTRA_MGNUCFLAGS and
	MGNUCFLAGS_FOR_TARGET were being interpreted as gcc options
	rather than as mgnuc options, because `-I.' is a gcc option
	rather than an mgnuc option and so all options which follow
	it are assumed to be gcc options.
1999-03-29 10:33:20 +00:00
Simon Taylor
18430aaef1 Aditi compilation.
Estimated hours taken: 1200

Aditi compilation.

compiler/options.m:
	The documentation for these is commented out because the Aditi
	system is not currently useful to the general public.
	--aditi: enable Aditi compilation.
	--dump-rl: write the intermediate RL to `<module>.rl_dump'.
	--dump-rl-bytecode: write a text version of the bytecodes
		to `<module>.rla'
	--aditi-only: don't produce a `.c' file.
	--filenames-from-stdin: accept a list of filenames to compile
		from stdin. This is used by the query shell.
	--optimize-rl, --optimize-rl-cse, --optimize-rl-invariants,
	--optimize-rl-index, --detect-rl-streams:
		Options to control RL optimization passes.
	--aditi-user:
		Default owner of any Aditi procedures,
		defaults to $USER or "guest".
	--generate-schemas:
		write schemas for base relations to `<module>'.base_schema
		and schemas for derived relations to `<module>'.derived_schema.
		This is used by the query shell.

compiler/handle_options.m:
	Handle the default for --aditi-user.

compiler/hlds_pred.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/make_hlds.m:
	Add some Aditi pragma declarations - `aditi', `supp_magic', `context',
	`naive', `psn' (predicate semi-naive), `aditi_memo', `aditi_no_memo',
	`base_relation', `owner' and `index'.
	Separate out code to parse a predicate name and arity.

compiler/hlds_pred.m:
	Add predicates to identify Aditi procedures.
	Added markers `generate_inline' and `aditi_interface', which
	are used internally for Aditi code generation.
	Add an `owner' field to pred_infos, which is used for database
	security checks.
	Add a field to pred_infos to hold the list of indexes for a base
	relation.

compiler/make_hlds.m:
	Some pragmas must be exported if the corresponding predicates
	are exported, check this.
	Make sure stratification of Aditi procedures is checked.
	Predicates with a mode declaration but no type declaration
	are no longer assumed to be local.
	Set the `do_aditi_compilation' field of the module_info if there
	are any local Aditi procedures or base relations.
	Check that `--aditi' is set if Aditi compilation is required.

compiler/post_typecheck.m:
	Check that every Aditi predicate has an `aditi__state' argument,
	which is used to ensure sequencing of updates and that Aditi
	procedures are only called within transactions.

compiler/dnf.m:
	Changed the definition of disjunctive normal form slightly
	so that a call followed by some atomic goals not including
	any database calls is considered atomic. magic.m can handle
	this kind of goal, and it results in more efficient RL code.

compiler/hlds_module.m:
compiler/dependency_graph.m:
	Added dependency_graph__get_scc_entry_points which finds
	the procedures in an SCC which could be called from outside.
	Added a new field to the dependency_info, the
	aditi_dependency_ordering. This contains all Aditi SCCs of
	the original program, with multiple SCCs merged where
	possible to improve the effectiveness of differential evaluation
	and the low level RL optimizations.

compiler/hlds_module.m:
	Add a field to record whether there are any local Aditi procedures
	in the current module.
	Added versions of module_info_pred_proc_info and
	module_info_set_pred_proc_info which take a pred_proc_id,
	not a separate pred_id and proc_id.

compiler/polymorphism.m:
compiler/lambda.m:
	Make sure that predicates created for closures in Aditi procedures
	have the correct markers.

compiler/goal_util.m:
	Added goal_util__switch_to_disjunction,
	goal_util__case_to_disjunct (factored out from simplify.m)
	and goal_util__if_then_else_to_disjunction. These are
	require because supplementary magic sets can't handle
	if-then-elses or switches.

compiler/type_util.m:
	Added type_is_aditi_state/1.

compiler/mode_util.m:
	Added partition_args/5 which partitions a list of arguments
	into inputs and others.

compiler/inlining.m:
	Don't inline memoed procedures.
	Don't inline Aditi procedures into non-Aditi procedures.

compiler/intermod.m:
	Handle Aditi markers.
	Clean up handling of markers which should not appear in `.opt' files.

compiler/simplify.m:
	Export a slightly different interface for use by magic.m.
	Remove explicit quantifications where possible.
	Merge multiple nested quantifications.
	Don't report infinite recursion warnings for Aditi procedures.

compiler/prog_out.m:
	Generalised the code to output a module list to write any list.

compiler/code_gen.m:
compiler/arg_info.m:
	Don't process Aditi procedures.

compiler/mercury_compile.m:
	Call magic.m and rl_gen.m.
	Don't perform the low-level annotation passes on Aditi procedures.
	Remove calls to constraint.m - sometime soon a rewritten version
	will be called directly from deforestation.

compiler/passes_aux.m:
	Add predicates to process only non-Aditi procedures.

compiler/llds.m:
compiler/llds_out.m:
	Added new `code_addr' enum members, do_{det,semidet,nondet}_aditi_call,
	which are defined in extras/aditi/aditi.m.

compiler/call_gen.m:
	Handle generation of do_*_aditi_call.

compiler/llds_out.m:
	Write the RL code for the module as a constant char array
	in the `.c' file.

compiler/term_errors.m:
compiler/error_util.m:
	Move code to describe predicates into error_util.m
	Allow the caller to explicitly add line breaks.
	Added error_util:list_to_pieces to format a list of
	strings.
	Reordered some arguments for currying.

compiler/hlds_out.m:
	Don't try to print clauses if there are none.

runtime/mercury_init.h:
util/mkinit.c:
scripts/c2init.in:
	Added a function `mercury__load_aditi_rl_code()' to the generated
	`<module>_init.c' file which throws all the RL code for the program
	at the database. This should be called at connection time by
	`aditi__connect'.
	Added an option `--aditi' which controls the output
	`mercury__load_aditi_rl_code()'.

compiler/notes/compiler_design.html:
	Document the new files.

Mmakefile:
bindist/Mmakefile:
	Don't distribute extras/aditi yet.

New files:

compiler/magic.m:
compiler/magic_util.m:
	Supplementary magic sets transformation. Report errors
	for constructs that Aditi can't handle.

compiler/context.m:
	Supplementary context transformation.

compiler/rl_gen.m:
compiler/rl_relops.m:
	Aditi code generation.

compiler/rl_info.m:
	Code generator state.

compiler/rl.m:
	Intermediate RL representation.

compiler/rl_util:
	Predicates to collect information about RL instructions.

compiler/rl_dump.m:
	Print out the representation in rl.m.

compiler/rl_opt.m:
	Control low-level RL optimizations.

compiler/rl_block.m:
	Break a procedure into basic blocks.

compiler/rl_analyse.m:
	Generic dataflow analysis for RL procedures.

compiler/rl_liveness.m:
	Make sure all relations are initialised before used, clear
	references to relations that are no longer required.

compiler/rl_loop.m:
	Loop invariant removal.

compiler/rl_block_opt.m:
	CSE and instruction merging on basic blocks.

compiler/rl_key.m:
	Detect upper/lower bounds for which a goal could succeed.

compiler/rl_sort.m:
	Use indexing for joins and projections.
	Optimize away unnecessary sorting and indexing.

compiler/rl_stream.m:
	Detect relations which don't need to be materialised.

compiler/rl_code.m:
	RL bytecode definitions. Automatically generated from the Aditi
	header files.

compiler/rl_out.m:
compiler/rl_file.m:
	Output the RL bytecodes in binary to <module>.rlo (for use by Aditi)
	and in text to <module>.rla (for use by the RL interpreter).
	Also output the schema information if --generate-schemas is set.

compiler/rl_exprn.m:
	Generate bytecodes for join conditions.

extras/aditi/Mmakefile:
extras/aditi/aditi.m:
	Definitions of some Aditi library predicates and the
	interfacing and transaction processing code.
1998-12-06 23:49:14 +00:00
Fergus Henderson
99b39fd3fc Fix a bug reported by Renaud Paquay <rpa@miscrit.be>.
Estimated hours taken: 0.5

Fix a bug reported by Renaud Paquay <rpa@miscrit.be>.

compiler/modules.m:
scripts/Mmake.rules:
	When invoking Mmake recursively, pass down the values of
	MC and ALL_MCFLAGS, in case their values were overridden
	on the command line.
1998-10-29 16:25:55 +00:00
Fergus Henderson
1eca19786e Add Mmake support for target-specific MCFLAGS flags (MCFLAGS-foo, etc.)
Estimated hours taken: 3

Add Mmake support for target-specific MCFLAGS flags (MCFLAGS-foo, etc.)
using some tricky GNU Make hackery that avoids warning about undefined
variables.
Also define ALL_MCFLAGS = $(MCFLAGS) $(TARGET_MCFLAGS) $(EXTRA_MCFLAGS)
and use $(ALL_MCFLAGS) instead of $(MCFLAGS).  This allows user Mmakefiles
to override MCFLAGS without suppressing the use of the TARGET_MCFLAGS
and EXTRA_MCFLAGS.

Similarly for the other *FLAGS variables.

scripts/Mmake.vars.in:
	Define ALL_*FLAGS and TARGET_*FLAGS.

scripts/Mmake.rules:
	Use ALL_*FLAGS instead of *FLAGS.

scripts/mmake.in:
	Re-enable the warnings about undefined variables,
        since we won't get too many spurious warnings now.

Mmake.common.in:
	Delete `$(MCFLAGS-$*)' from the definition of `MCFLAGS', since this
	is now done automatically by Mmake.

tests/Mmake.common:
	Delete the definitions of MCFLAGS and GRADEFLAGS, since this stuff
	is now done automatically by Mmake.

doc/user_guide.texi:
NEWS:
	Document these changes.
1998-08-04 14:06:10 +00:00
Fergus Henderson
c766e2dfcc Fix a bug or two introduced in my previous change:
Estimated hours taken: 0.25

scripts/Mmake.rules:
	Fix a bug or two introduced in my previous change:
	it turns out that making `%.depend' depend on `%.dep'
	doesn't work, because (a) GNU Make deletes the
	"intermediate" .dep file after making it and
	(b) it won't remaking the `.dep' file if it already exists.
	So I when back to the old solution of code duplication,
	just adding a comment to warn about the duplication.
1998-06-12 16:35:01 +00:00
Fergus Henderson
be0df21856 Fix a problem where the dependency files were being remade unnecessarily.
Estimated hours taken: 0.5

Fix a problem where the dependency files were being remade unnecessarily.
The problem was caused by the following change:

> Instead of deleting the `_init.c' file every time we recreate
> the `.dep' file, just tell make that the `_init.c' file depends on
> the `.dep' file, so that make will remake it if the `.dep' file
> changes.  (I don't know why I didn't do it that way in the
> first place.)

The reason we didn't want the `_init.c' file to define on the `.dep'
file is that the `.dep' file is listed as depending on the top-level
`.m' file.  The fix is to change things so that the `.dep' file
is not listed as depending on the `.m' file.

scripts/Mmake.rules:
	Fix some code duplication (and subsequent code rot, caused by
	changes in one place but not the other) in the rules for `.dep'
	and `.depend'.
	Delete the `.m' file from the dependencies for the `.dep' file.
1998-06-12 04:11:37 +00:00
Fergus Henderson
ea5d21a93a Update the GNU make bug work-around so that it creates the `date3s'
Estimated hours taken: 0.25

scripts/Mmake.rules:
	Update the GNU make bug work-around so that it creates the `date3s'
	directory as well as the other `*date*' directories when doing
	`mmake depend'.  Previously, the *.int3 files never depended on
	anything else (they were always the first thing created), so this
	wasn't necessary.  However, with nested modules, the `.int3'
	files for sub-modules depends on the `.int3' file for the parent
	module, so we now need to create the `date3s' directory too.
1998-05-29 04:20:32 +00:00
Fergus Henderson
935fbfe36e Add Mmake support for nested sub-modules.
Estimated hours taken: 6

Add Mmake support for nested sub-modules.

compiler/mercury_compile.m:
compiler/modules.m:
compiler/intermod.m:
	Pass down the source file name to various places.
	Store the source file name in the module_imports data structure.
	In various places, use this source file name instead of assuming
	that the source file name can be obtained from the module name.

compiler/modules.m:
	Change the generated .d and .dep files to use the source file names.
	Add hard-coded rules in the .d files if the source file name does not
	match the form expected by the pattern rules in scripts/Mmake.rules.
	XXX unfortunately the rules don't work right for parallel makes of
	    nested modules

scripts/Mmake.rules:
	Add a comment saying that any changes here might need to
	be duplicated in compiler/modules.m.

tests/hard_coded/Mmakefile:
tests/hard_coded/nested.m:
tests/hard_coded/nested2.m:
tests/hard_coded/nested.exp:
tests/hard_coded/nested2.exp:
	Add a couple of test cases for nested modules (XXX not enabled,
	due to the above-mentioned problem with parallel makes).

doc/reference_manual.texi:
	Update the "implementation bugs and limitations" section.

NEWS:
	Update the news about nested modules.
1998-05-27 04:00:54 +00:00
Fergus Henderson
54f7db8c33 When invoking make recursively, pass $(MFLAGS) rather than
Estimated hours taken: 0.5

scripts/Mmake.rules:
        When invoking make recursively, pass $(MFLAGS) rather than
	$(MAKEOVERRIDES).  This avoids a warning, and is probably the
	right thing to do anyway (I'm not sure why I used MAKEOVERRIDES
	in the first place).  Previously I made exactly the same change
	in one place, but missed another occurrence of
	$(MAKEOVERRIDES).  This change fixes that other occurrence.

	Also when invoking make recursively, pass down the value of
	$(GRADEFLAGS).  Newer versions of GNU Make (e.g. 3.75) do
	this automatically, but older versions (e.g. 3.70) don't.
	This should fix a bug reported by Warwick Harvey where
	`mmake install_grades' at the top-level caused `.m' files in
	the library to be compiled with the wrong grades.
1998-05-26 09:48:29 +00:00
Fergus Henderson
f00346033a Make another small fix to mmake.in and add more empty definitions for various
Estimated hours taken: 0.5

Make another small fix to mmake.in and add more empty definitions for various
Mmake variables to avoid spurious warnings.

scripts/mmake.in:
	Add `*clean*' to the patterns for which we do not
	pass `--warn-undefined-variables'.

scripts/Mmake.rules:
	When invoking make recursively, pass $(MFLAGS) rather than
	$(MAKEOVERRIDES).  This avoids a warning, and is probably the
	right thing to do anyway (I'm not sure why I used MAKEOVERRIDES
	in the first place).

boehm_gc/Mmakefile:
tests/hard_coded/Mmakefile:
	Add empty definition for `MMAKEFLAGS'.
1998-04-02 13:23:10 +00:00
Fergus Henderson
7860363a0e Fix some bugs which meant that building NU-Prolog or SICStus Prolog
Estimated hours taken: 2

Fix some bugs which meant that building NU-Prolog or SICStus Prolog
executables with MMAKE_USE_SUBDIRS set to `yes' did not work.

scripts/mnc.in:
scripts/msc.in:
	Add support for a `--use-subdirs' option.

scripts/Mmake.rules:
	If MMAKE_USE_SUBDIRS=yes, then add `--use-subdirs' to
	$(MNCFLAGS) and $(MSCFLAGS).

scripts/mnl.in:
	Add support for new environment variable MERCURY_NU_DEBUG_LIB_OBJS,
	for use by library/Mmakefile.

library/Mmakefile:
	Fix places where .no and .ql files where hard-coded as being in
	the current directory instead of in $(nos_subdir) or $(qls_subdir).
1998-03-27 16:37:01 +00:00
Fergus Henderson
1481544541 Fix the handling of dependencies on $(MLOBJS) and $(MLPICOBJS)
Estimated hours taken: 0.5

Fix the handling of dependencies on $(MLOBJS) and $(MLPICOBJS)
so that we don't reinvoke the linker for every make, even when
the executable(s) are already up-to-date.

scripts/Mmake.rules:
	Delete the MLOBJS and MLPICOBJS targets.
	Add `$(MLOBJS_DEPS) : $(MLOBJS)', and likewise for $(MLPICOBJS).

compiler/modules.m:
	When generating the `.dep' files, instead of using the MLOBJS
	and MLPICOBJS phony targets, record dependencies of files on
	$(MLOBJS) by adding those files to $(MLOBJS_DEPS),
	and likewise for $(MLPICOBJS).
1998-03-20 05:53:27 +00:00
Fergus Henderson
7ebc79e927 Fix some problems with the `--use-subdirs' option.
Estimated hours taken: 6

Fix some problems with the `--use-subdirs' option.
The compiler itself now compiles and bootstraps fine with --use-subdirs.

compiler/modules.m:
	Put `.h' files in the source directory, rather than
	in the `Mercury/hs' subdirectory.

compiler/mercury_compile.m:
scripts/Mmake.rules:
	If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
	so that #include statements work relative to the source directory
	rather than relative to the `Mercury/cs' subdirectory.

scripts/Mmake.vars.in:
	Define $(cs_subdir), $(os_subdir) etc. variables;
	these are set to the directory to use for .c, .o, etc. files,
	(including the trailing `/'), or to the empty string,
	if --use-subdirs is not set.

scripts/Mmake.rules:
	Use $(cs_subdir), $(os_subdir) etc. to avoid the code
	duplication created by my previous change to handle
	--use-subdirs.
	Also add lots of comments, and reorder the code
	in a more logical order.

Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
	Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
	file-names (e.g. *.dep, *_init.[co], tree234.o) that were
	used in some of the rules.

library/Mmakefile:
	Add `rm -f tags' to the rule for `mmake realclean'.

tools/bootcheck:
	Add `--use-subdirs' option (defaults to setting of the
	MMAKE_USE_SUBDIRS environment variable).
	Change the code which compares the stage2 & stage3 C files
	to use the appropriate location for them based on the
	setting of this option.
1998-03-20 02:58:33 +00:00
Fergus Henderson
f71821fc20 Use a better work-around for the GNU Make directory
Estimated hours taken: 1

scripts/Mmake.rules:
	Use a better work-around for the GNU Make directory
	caching bug that causes problems for --use-subdirs:
	just do `mkdir Mercury/dates', rather than doing a recursive
	invocation of `mmake' to make all the `.int3' files.
1998-03-19 08:51:29 +00:00
Fergus Henderson
f884cee0c4 Finish off the centralization of the file name handling code, and
Estimated hours taken: 11

Finish off the centralization of the file name handling code, and
add support for generating intermediate files in subdirectories.

scripts/mmake.in:
	Add a new boolean option `--use-subdirs';
	if enabled, it just sets the environment variable MMAKE_USE_SUBDIRS
	to `yes' before invoking Make.
	Also add negative versions of the various options
	(`--no-use-subdirs', `--no-verbose', `--no-save-makefile').

scripts/Mmake.rules:
	Add code to handle generating intermediate file names
	in subdirectories.  If MMAKE_USE_SUBDIRS=yes, we add
	`--use-subdirs' to MCFLAGS, and most of the pattern rules
	are changed to use subdirectories.

	Note that getting this to work required a bit of a hack:
	due to what seem to be bugs in GNU Make, `mmake depend'
	needs to do `mmc --make-short-interface *.m' to get things
	started.  But once the int3s are there, the dependencies
	seem to work OK.

compiler/options.m:
	Add a new boolean option `--use-subdirs'.

compiler/modules.m:
	Add new predicate `fact_table_file_name'.
	Add an extra argument to `module_name_to_file_name',
	specifying whether or not to create any directories
	needed for the file name.
	Change all the file-name-creating predicates here
	to go through a single new predicate `choose_file_name',
	and add code in that predicate to handle the `--use-subdirs'
	option.
	Also if the `--use-subdirs' option is set, don't use the
	compact dependencies format, since it can't work in that case.

compiler/fact_table.m:
	Call `fact_table_file_name' rather than using `string__append'.

compiler/mercury_compile.m:
	Change `link_module_list' and `join_module_list'
	so that they create file names by calling `module_name_to_file_name'.

compiler/export.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/termination.m:
compiler/trans_opt.m:
compiler/unused_args.m:
	Change all calls to `module_name_to_file_name' to pass
	the extra argument specifying whether or not to make
	any directories needed for the file name.

library/Mmakefile:
	Change the rule for `mmake install_ints' so that it
	creates a `Mercury' subdirectory with symbolic links
	`ints', `int2s', `int3s', `opts', and `trans_opts'
	which just point to `..'.  This is needed for the
	`--use-subdirs' option to work, because Mmake currently
	does not support mixing libraries compiled with and
	without `--use-subdirs'.

doc/user_guide.texi:
	Document the above changes.
1998-03-18 08:09:50 +00:00
Tyson Dowd
5ab83f2dcd Change @: to @ in the rules for MLOBJS-% and MLPICOBJS-%
Estimated hours taken: 0.3

scripts/Mmake.rules:
	Change @: to @ in the rules for MLOBJS-% and MLPICOBJS-%
1998-03-09 02:22:21 +00:00
Tyson Dowd
164369cd14 Fix bugs in how MLOBJS works.
Estimated hours taken: 3

Fix bugs in how MLOBJS works.

Because mmake puts the contents of the .dep file before the Mmakefile
when generating a makefile for gmake, the scheme of using
        MLOBJS=foo.o bar.o
in the Mmakefile won't work.

The dependencies in the .dep file such as
        libxyz.a: ..... $(MLOBJS)
are expanded when read, but the variable MLOBJS is not set until later.
This means MLOBJS won't be generated from the .c files, and the linker
will abort, complaining that files are missing.

So the solution is to output
        libxyz.a: ..... MLOBJS
where MLOBJS is a target, and is defined in Mmake.rules (which is seen
by make after the contents of Mmakefile).
        MLOBJS: $(MLOBJS).

(In fact, it gets more complicated: to support different MLOBJS variables
for different programs/libraries, so we use MLOBJS-xyz as the target,
and a pattern matching rule in Mmake.rules).

This must also be done for MLPICOBJS.

compiler/modules.m:
        Output the targets instead of the variables.

scripts/Mmake.rules:
        Pattern match MLOBJS-% and MLPICOBJS-% dependencies, and make
        them depend on the corresponding variables.
1998-03-05 06:01:41 +00:00
Fergus Henderson
11d8161692 Add support for nested modules.
Estimated hours taken: 50

Add support for nested modules.

- module names may themselves be module-qualified
- modules may contain `:- include_module' declarations
  which name sub-modules
- a sub-module has access to all the declarations in the
  parent module (including its implementation section).

This support is not yet complete; see the BUGS and LIMITATIONS below.

LIMITATIONS
- source file names must match module names
	(just as they did previously)
- mmc doesn't allow path names on the command line any more
	(e.g. `mmc --make-int ../library/foo.m').
- import_module declarations must use the fully-qualified module name
- module qualifiers must use the fully-qualified module name
- no support for root-qualified module names
	(e.g. `:parent:child' instead of `parent:child').
- modules may not be physically nested (only logical nesting, via
  `include_module').

BUGS
- doesn't check that the parent module is imported/used before allowing
	import/use of its sub-modules.
- doesn't check that there is an include_module declaration in the
	parent for each module claiming to be a child of that parent
- privacy of private modules is not enforced

-------------------

NEWS:
	Mention that we support nested modules.

library/ops.m:
library/nc_builtin.nl:
library/sp_builtin.nl:
compiler/mercury_to_mercury.m:
	Add `include_module' as a new prefix operator.
	Change the associativity of `:' from xfy to yfx
	(since this made parsing module qualifiers slightly easier).

compiler/prog_data.m:
	Add new `include_module' declaration.
	Change the `module_name' and `module_specifier' types
	from strings to sym_names, so that module names can
	themselves be module qualified.

compiler/modules.m:
	Add predicates module_name_to_file_name/2 and
	file_name_to_module_name/2.
	Lots of changes to handle parent module dependencies,
	to create parent interface (`.int0') files, to read them in,
	to output correct dependencies information for them to the
	`.d' and `.dep' files, etc.
	Rewrite a lot of the code to improve the readability
	(add comments, use subroutines, better variable names).
	Also fix a couple of bugs:
	- generate_dependencies was using the transitive implementation
	  dependencies rather than the transitive interface dependencies
	  to compute the `.int3' dependencies when writing `.d' files
	  (this bug was introduced during crs's changes to support
	  `.trans_opt' files)
	- when creating the `.int' file, it was reading in the
	  interfaces for modules imported in the implementation section,
	  not just those in the interface section.
	  This meant that the compiler missed a lot of errors.

library/graph.m:
library/lexer.m:
library/term.m:
library/term_io.m:
library/varset.m:
compiler/*.m:
	Add `:- import_module' declarations to the interface needed
	by declarations in the interface.  (The previous version
	of the compiler did not detect these missing interface imports,
	due to the above-mentioned bug in modules.m.)

compiler/mercury_compile.m:
compiler/intermod.m:
	Change mercury_compile__maybe_grab_optfiles and
	intermod__grab_optfiles so that they grab the opt files for
	parent modules as well as the ones for imported modules.

compiler/mercury_compile.m:
	Minor changes to handle parent module dependencies.
	(Also improve the wording of the warning about trans-opt
	dependencies.)

compiler/make_hlds.m:
compiler/module_qual.m:
	Ignore `:- include_module' declarations.

compiler/module_qual.m:
	A couple of small changes to handle nested module names.

compiler/prog_out.m:
compiler/prog_util.m:
	Add new predicates string_to_sym_name/3 (prog_util.m) and
	sym_name_to_string/{2,3} (prog_out.m).

compiler/*.m:
	Replace many occurrences of `string' with `module_name'.
	Change code that prints out module names or converts
	them to strings or filenames to handle the fact that
	module names are now sym_names intead of strings.
	Also change a few places (e.g. in intermod.m, hlds_module.m)
	where the code assumed that any qualified symbol was
	fully-qualified.

compiler/prog_io.m:
compiler/prog_io_goal.m:
	Move sym_name_and_args/3, parse_qualified_term/4 and
	parse_qualified_term/5 preds from prog_io_goal.m to prog_io.m,
	since they are very similar to the parse_symbol_name/2 predicate
	already in prog_io.m.  Rewrite these predicates, both
	to improve maintainability, and to handle the newly
	allowed syntax (module-qualified module names).
	Rename parse_qualified_term/5 as `parse_implicit_qualified_term'.

compiler/prog_io.m:
	Rewrite the handling of `:- module' and `:- end_module'
	declarations, so that it can handle nested modules.
	Add code to parse `include_module' declarations.

compiler/prog_util.m:
compiler/*.m:
	Add new predicates mercury_public_builtin_module/1 and
	mercury_private_builtin_module/1 in prog_util.m.
	Change most of the hard-coded occurrences of "mercury_builtin"
	to call mercury_private_builtin_module/1 or
	mercury_public_builtin_module/1 or both.

compiler/llds_out.m:
	Add llds_out__sym_name_mangle/2, for mangling module names.

compiler/special_pred.m:
compiler/mode_util.m:
compiler/clause_to_proc.m:
compiler/prog_io_goal.m:
compiler/lambda.m:
compiler/polymorphism.m:
	Move the predicates in_mode/1, out_mode/1, and uo_mode/1
	from special_pred.m to mode_util.m, and change various
	hard-coded definitions to instead call these predicates.

compiler/polymorphism.m:
	Ensure that the type names `type_info' and `typeclass_info' are
	module-qualified in the generated code.  This avoids a problem
	where the code generated by polymorphism.m was not considered
	type-correct, due to the type `type_info' not matching
	`mercury_builtin:type_info'.

compiler/check_typeclass.m:
	Simplify the code for check_instance_pred and
	get_matching_instance_pred_ids.

compiler/mercury_compile.m:
compiler/modules.m:
	Disallow directory names in command-line arguments.

compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/modules.m:
	Add a `--make-private-interface' option.
	The private interface file `<module>.int0' contains
	all the declarations in the module; it is used for
	compiling sub-modules.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Add support for creating `.int0' and `.date0' files
	by invoking mmc with `--make-private-interface'.

doc/user_guide.texi:
	Document `--make-private-interface' and the `.int0'
	and `.date0' file extensions.

doc/reference_manual.texi:
	Document nested modules.

util/mdemangle.c:
profiler/demangle.m:
	Demangle names with multiple module qualifiers.

tests/general/Mmakefile:
tests/general/string_format_test.m:
tests/general/string_format_test.exp:
tests/general/string__format_test.m:
tests/general/string__format_test.exp:
tests/general/.cvsignore:
	Change the `:- module string__format_test' declaration in
	`string__format_test.m' to `:- module string_format_test',
	because with the original declaration the `__' was taken
	as a module qualifier, which lead to an error message.
	Hence rename the file accordingly, to avoid the warning
	about file name not matching module name.

tests/invalid/Mmakefile:
tests/invalid/missing_interface_import.m:
tests/invalid/missing_interface_import.err_exp:
	Regression test to check that the compiler reports
	errors for missing `import_module' in the interface section.

tests/invalid/*.err_exp:
tests/warnings/unused_args_test.exp:
tests/warnings/unused_import.exp:
	Update the expected diagnostics output for the test cases to
	reflect a few minor changes to the warning messages.

tests/hard_coded/Mmakefile:
tests/hard_coded/parent.m:
tests/hard_coded/parent.child.m:
tests/hard_coded/parent.exp:
tests/hard_coded/parent2.m:
tests/hard_coded/parent2.child.m:
tests/hard_coded/parent2.exp:
	Two simple tests case for the use of nested modules with
	separate compilation.
1998-03-03 17:48:14 +00:00
Tyson Dowd
66628aae3d On some Linux boxes (e.g. mine), the invoking "mmake" in the compiler
Author: trd

Estimated hours taken: 0.5

On some Linux boxes (e.g. mine), the invoking "mmake" in the compiler
directory has a 50 second startup time, due to all the file accesses.
This adds about 1.5 hours to the compilation process.

"mmake" only needs to be invoked to if we want to remove .c files,
so the startup can be avoided by using more disk space.

scripts/Mmake.rules:
	If RM_C is set to ':' (that is, removal of .c files is turned
	off), we don't need to re-invoke "mmake" on each .c file,
	because we don't need to remove the intermediate .c files.
	We can also generate .pic_o files directly from .c files.
1998-02-12 10:04:33 +00:00
Fergus Henderson
5194da9ad7 Fix a bug that caused Mmake to delete user .c files.
Estimated hours taken: 0.25

Fix a bug that caused Mmake to delete user .c files.

scripts/Mmake.rules:
	Delete the call to $(RM_C) in the rule for `.o.pic_o', since
	that does nasty things in the case that the .c file is the
	user's source code, not an intermediate file produced by
	the Mercury compiler.
1998-01-25 16:24:41 +00:00
Fergus Henderson
a70a7099dc Add Mmake support for `.trans_opt' files.
Estimated hours taken: 2

Add Mmake support for `.trans_opt' files.
Also fix up the handling of profiling files for `mmake clean'.

compiler/modules.m:
compiler/trans_opt.m:
	Rename `.trans_optdate' as `.trans_opt_date'.

compiler/modules.m:
	Output definitions for $(foo.profs), $(foo.trans_opts), and
	$(foo.trans_opt_dates) variables in the generated `.dep' files.
	Add code to the generated rules for `mmake clean' to remove
	these files.

scripts/Mmake.rules:
	Add rules for creating `.trans_opt' and `.trans_opt_date' files.
	Change things so that `Prof.*' get removed by `mmake clean'
	rather than only by `mmake realclean'.

scripts/Mmake.vars.in:
	Add MCTOI and MCTOIFLAGS variables, for creating `.trans_opt' files.
1998-01-14 02:21:46 +00:00
Fergus Henderson
36599a2060 Delete calls to `chmod -r'. Turning off read permission seems
Estimated hours taken: 0.5

configure.in:
scripts/Mmake.rules:
	Delete calls to `chmod -r'.  Turning off read permission seems
	to cause more problems than it solves.  Amoung other things,
	it causes problems on systems such as Windows where you can't
	delete a read-only file.  (GNU-win32 has some work-arounds for
	that, but there are bugs in the work-arounds.)
	We should probably also delete the various calls to `chmod +w',
	since they are no longer needed, but for the moment I have left
	them in for backwards compatibility.  We can reconsider this
	in a year or two's time.
1997-11-21 12:34:19 +00:00
Fergus Henderson
1acfdbff07 Add support for a new `GRADEFLAGS' variable to Mmake,
Estimated hours taken: 1

Add support for a new `GRADEFLAGS' variable to Mmake,
so that you can use the more readable (and more portable)
`GRADEFLAGS = --profiling' rather than e.g. `GRADEFLAGS = asm_fast.gc.prof'.

scripts/Mmake.vars.in:
	Add GRADEFLAGS variable, defaulting to `--grade $(GRADE)'.

scripts/Mmake.rules:
	Change various rules to use `$(GRADEFLAGS)' instead of
	`--grade $(GRADE)'.

compiler/modules.m:
	Change various rules in the generated `.dep' files to
	use `$(GRADEFLAGS)' instead of `--grade $(GRADE)'.

doc/user_guide.texi:
	Modify the documentation to reflect the above changes.
1997-11-21 08:08:32 +00:00
Fergus Henderson
c98155751b Delete support for `.mod' files, since they are obsolete now.
Estimated hours taken: 0.5

Delete support for `.mod' files, since they are obsolete now.

scripts/mod2c:
	Delete this script.

scripts/Mmakefile:
	Delete reference to `mod2c'.

scripts/Mmake.rules:
	Delete the `.mod' suffix and the rule for .mod -> .c,

scripts/Mmake.vars.in:
	Delete the MOD2C, MOD2CFLAGS, MOD2H, and MOD2HFLAGS variables.

doc/user_guide.texi
	Delete mention of `.mod' files.
1997-11-21 07:11:01 +00:00
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Tyson Dowd
f9674e6fb8 Remove references to .garb files.
Estimated hours taken: 0.5

compiler/modules.m:
scripts/Mmake.rules:
	Remove references to .garb files.
	We are not going to use a separate link phase for accurate gc
	anymore.
1997-06-03 07:01:10 +00:00
Fergus Henderson
c3e9d9bba5 Work around a new (mis-)feature present in GNU Make 3.74
Estimated hours taken: 8

scripts/Mmake.rules:
	Work around a new (mis-)feature present in GNU Make 3.74
	but not in 3.71: recent versions will not update the timestamp
	of a target if the commands for that target are just whitespace.
	Instead, we need to use an explicit sh `:' command.
1997-05-23 00:39:14 +00:00
Fergus Henderson
3e0f071867 Add a rule for creating `.pic_s' files (which are the
Estimated hours taken: 0.25

scripts/Mmake.rules:
	Add a rule for creating `.pic_s' files (which are the
	assembler files corresponding to the `.pic_o' objects).
1997-02-07 13:21:01 +00:00
Simon Taylor
0460a5f78d Improvements to intermodule optimization and bug fixes.
Estimated hours taken: 2

Improvements to intermodule optimization and bug fixes.

scripts/Mmake.rules
	Stop the output of --make-optimization-interface going to the
	.err file.
1996-11-06 01:38:47 +00:00
Zoltan Somogyi
c2e602535e Use .err instead of .err2 as the file name for error messages.
Estimated hours taken: 0.1

Mmake.rules:
	Use .err instead of .err2 as the file name for error messages.
	Remove the rule for handling .pp files.
1996-11-04 06:30:10 +00:00
Simon Taylor
d3aa462819 Add suffixes, rules and options for .opt and .optdate.
Estimated hours taken: 0.5

scripts/Mmake.rules
scripts/Mmake.vars.in
        Add suffixes, rules and options for .opt and .optdate.

scripts/mercury_update_interface.in
        Work-around for a problem with parallel gmake. mc --make-interface
        was being run twice in a row on the same module. The first call
        mercury_update_interface moves module.int.tmp to module.int,
        then the second can't find module.int.tmp. The work-around is to
        ignore the exit status of the mv.
1996-09-11 08:58:17 +00:00
Fergus Henderson
e1c8643455 Ensure that the rule for `mmake realclean' removes the
Estimated hours taken: 0.5

scripts/Mmake.rules:
	Ensure that the rule for `mmake realclean' removes the
	profiling files.

	Also use `--grade' rather than `-s' (the latter is a bit cryptic).
1996-07-26 15:38:12 +00:00
Tyson Dowd
c3cf377058 Add handling of accurate GC grades to the scripts.
Estimated hours taken: 0.25

Add handling of accurate GC grades to the scripts.

scripts/Mmake.rules:
	Add '-s $(GRADE)' to the rule for .m.garb
	Remove obsolete .mod.mod_h rule (we don't use that mechanism anymore).
	Remove .mod_h from .SUFFIXES

scripts/mgnuc.in:
	Add .agc grade for accurate garbage collection.
1996-06-16 05:32:53 +00:00
Simon Taylor
3dad0e05f1 Module qualification of types, insts and modes.
Estimated hours taken: 0.2

Module qualification of types, insts and modes.

Added a new interface file - <module>.int3. This contains the
short interface qualified as much as possible given the information
in the current module.

When producing the .int and .int2 files for a module, the compiler uses
the information in the .int3 files of modules imported in the interface
to fully module qualify all items. The .int2 file is just a fully
qualified version of the .int3 file. The .int3 file cannot be overwritten
by the fully qualified version in the .int2 file because then mmake would
not be able to tell when the interface files that depend on that .int3
file really need updating.


scripts/Mmake.rules
scripts/Mmake.vars
Removed the rule for .int, since this is now in the .d files.
Rules and suffix entry for the .int3 and .date3 files.
1996-06-11 06:31:37 +00:00
Fergus Henderson
5bb6657116 Change the rules for building `.pic_o' to avoid some problems
Estimated hours taken: 2

scripts/Mmake.rules:
	Change the rules for building `.pic_o' to avoid some problems
	with parallel makes.  In particular, the stuff for removing
	the intermediate `.c' files was causing some trouble.
1996-04-18 01:18:59 +00:00
Fergus Henderson
a158626828 Fix some software rot in the rule for creating `.pic_o' files.
Estimated hours taken: 0.1

scripts/Mmake.rules:
	Fix some software rot in the rule for creating `.pic_o' files.
1996-04-06 17:51:14 +00:00
Fergus Henderson
9a03fa9315 In the rule for compiling with --split-c-files, make sure that
Estimated hours taken: 0.1

scripts/Mmake.rules:
	In the rule for compiling with --split-c-files, make sure that
	we remove the old object files before we recompile.  This is
	necessary in case you removed some predicates from the source
	file, in which case there will be fewer object files produced --
	we need to make sure that we don't leave old ones lying around.
1996-03-17 04:52:10 +00:00
Fergus Henderson
16bf987b6c Add new variables MCS and MCSFLAGS, for compiling with --split-c-files.
scripts/{Mmake.vars.in,Mmake.rules} {compiler,library,profiler}/Mmake:
	Add new variables MCS and MCSFLAGS, for compiling with --split-c-files.
1996-03-12 03:09:03 +00:00
Fergus Henderson
57987a0f6b Fix typo in rule for using --split-c-files' (it had --split-files').
Estimated hours taken: 0.1

scripts/Mmake.rules:
	Fix typo in rule for using `--split-c-files' (it had `--split-files').
1996-03-10 01:10:55 +00:00
Fergus Henderson
9716b33379 Add rule for creating %.dir/*.o using `--split-c-files'.
Estimated hours taken: 0.1

scripts/Mmake.rules:
	Add rule for creating %.dir/*.o using `--split-c-files'.
1996-03-05 15:17:44 +00:00
Fergus Henderson
14ffa5fcd0 Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date.
Estimated hours taken: 1

Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date.
(This change should hopefully fix a problem with the source distribution not
being able to bootstrap itself.)

Also a couple of minor tidy-ups.

scripts/mmake.in:
	Export new variable MMAKE_MAKE_CMD, for use by Mmake.rules.

scripts/Mmake.rules:
	In the rule for `.m' -> `.o', use a recursive invocatino of
	make (via the MMAKE_MAKE_CMD variable) to build the `.c' file,
	rather than unconditionally invoking `$(MCG)'.

scripts/.cvsignore:
	Add Mmake.vars, since it is now automatically-generated.

scripts/ml.in:
	Some stylistic changes: make sure that autoconf @var@ variables occur
	only in assignments to shell variables at the start of the script,
	not scattered throughout the body of the script.
1996-02-04 06:17:30 +00:00
Thomas Conway
e7d8f4f727 Change a couple of shell/make variable names,
Estimated hours taken: 0.5

Change a couple of shell/make variable names,
and moved some configuration stuff around.

scripts/Mmake.rules Mmake.vars.in:
	Changed some variable names.
	Changed a couple of configuration things for shared libraries.
1996-01-08 06:05:36 +00:00
Fergus Henderson
6aca62cff0 Change things so that in the usual case Mmake does not keep the
automatically generated `.c' files lying around.  (The aim of this
change is to cut down on disk space usage!)

scripts/Mmake.vars:
	Add `RM_C' variable to specify whether or not the `.c' files
	should be removed.

scripts/Mmake.rules:
	Add rule for creating `.o' files directly from the `.m' files,
	using $(RM_C) to delete the intermediate `.c' file.
1995-11-24 10:20:56 +00:00
Fergus Henderson
4c33b19f4c Fix bug in which mmake' would pass the same option twice to mc'.
Estimated hours taken: 0.3

Fix bug in which `mmake' would pass the same option twice to `mc'.

scripts/Mmake.rules
	When invoking `mc --make-interface', don't pass both
	$(MCFLAGS), since $(MCIFLAGS) already includes $(MCFLAGS).
1995-11-04 09:57:36 +00:00
Fergus Henderson
831dc0079c Add a rule for creating `.i' (pre-processed C) files.
scripts/Mmake.rules:
	Add a rule for creating `.i' (pre-processed C) files.
1995-10-24 07:29:21 +00:00
Fergus Henderson
d50a62a4d0 Fix the rule for making *.err: we now need to pass --errorcheck-only.
scripts/Mmake.rules:
	Fix the rule for making *.err: we now need to pass --errorcheck-only.
1995-07-18 13:10:29 +00:00
Fergus Henderson
a5860bfc01 Remove the actions for `mmake clean' etc., since they are now
scripts/Mmake.rules:
	Remove the actions for `mmake clean' etc., since they are now
	unnecessary (it's handled implicitly by adding dependencies
	in the .dep files).
1995-07-15 04:52:12 +00:00
Zoltan Somogyi
9f587aef89 Left out a backslash from last change. 1995-07-14 02:10:30 +00:00