Commit Graph

326 Commits

Author SHA1 Message Date
Peter Ross
fc1ce8cf47 Another --use-subdirs bug fix when using sicstus.
Estimated hours taken: 3

Another --use-subdirs bug fix when using sicstus.

scripts/msl.in:
    Detect the special case file 'sp_lib.ql' even when the file name has
    leading directory info.

    Also update the copyright notice.
1998-06-03 01:32:25 +00:00
Fergus Henderson
38ae5fe0c5 Fix a bug which caused link errors in some grades for some test cases
Estimated hours taken: 1

Fix a bug which caused link errors in some grades for some test cases
where the module name wasn't the same as the file name, and which
probably would have caused runtime errors in some grades for test
cases using nested modules.

compiler/modules.m:
	Call $(C2INIT) with $(foo.cs) instead of $(foo.ms).
	This is necessary now that a single .m file can get compiled
	to multiple .c files, if it contains nested modules,
	or to a .c file whose name reflects the module name rather
	than the source file name.

util/mkinit.c:
scripts/c2init.in:
	For efficiency, change c2init and mkinit so that when c2init's
	arguments are `.c' files, it computes the init function based
	on the filename (like it used to do with `.m' files), rather
	than by reading the file contents and searching for "** INIT"
	comments.  Add a new option `-x' (`--extra-inits') which keeps
	the old behaviour.

compiler/modules.m:
scripts/Mmake.rules:
	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.)
1998-05-30 13:34:17 +00:00
Fergus Henderson
306ed77dd5 Fix a typo.
Estimated hours taken: 0.1

scripts/mmake.in:
	Fix a typo.
1998-05-29 21:30:20 +00:00
Fergus Henderson
c578810748 Improve the efficiency of code added in my previous change,
Estimated hours taken: 0.25

scripts/mmake.in:
	Improve the efficiency of code added in my previous change,
	as suggested by zs: avoid using `...`.
1998-05-29 07:53:37 +00:00
Fergus Henderson
587f0a3233 If the current directory contains a `Mercury' subdirectory,
Estimated hours taken: 0.5

scripts/mmake.in:
	If the current directory contains a `Mercury' subdirectory,
	then enable `--use-subdirs' by default.
1998-05-29 04:27:18 +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
fcdf5e117b Fix a cut-and-paste error in the handling of `debug' grade.
Estimated hours taken: 0.1

scripts/parse_grade_options.sh-subr:
	Fix a cut-and-paste error in the handling of `debug' grade.
	(Thanks to Warwick Harvey for reporting this bug.)
1998-05-27 13:47:36 +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
6921e0e015 Add a `--debug' option for Mercury-level debugging
Estimated hours taken: 6

Add a `--debug' option for Mercury-level debugging
using the trace-based debugger.

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
	Split the old `--debug' option into `--low-level-debug'
	(formerly the absence of -DSPEED, now handle by -DLOWLEVEL_DEBUG)
	and `--c-debug' (passes -g to C compiler).
	Delete the old `debug' grade.
	Add support for new options `--require-tracing'
	(makes --trace minimum equivalent to --trace interfaces,
	and passes -DMR_REQUIRE_TRACING to C compiler)
	`--stack-trace' (passes -DMR_STACK_TRACE to C compiler;
	actually this one was already supported)
	and `--debug' (implies previous two),
	with corresponding grade modifiers `.trace', `.strce', and `.debug'.
	Actually I think there's little point in specifying just one
	of `--require-tracing' and `--stack-trace' so for the moment
	I'm just providing `--debug': the code for the more fine-grained
	options and grade modifiers has been added but commented out.

runtime/mercury_conf_param.h:
	Document the new configuration parameter MR_REQUIRE_TRACING
	and the existing but undocumented parameter MR_STACK_TRACE.

runtime/mercury_grade.h:
	Include MR_REQUIRE_TRACING in the mangled grade identifier.

compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
	Allow new tracing type `--trace default', and make it the default.
	This gets replaced with `full' if require_tracing is yes
	or `minimal' if require_tracing is no.
	Also `--trace minimum' gets replaced with `interface' if
	require_tracing is yes.

doc/user_guide.texi:
	Document the new `--debug', `--low-level-debug', and `--c-debug'
	options.

scripts/mgnuc.in:
compiler/mercury_compile.m:
doc/user_guide.texi:
	Change things so that `--c-debug' does not imply `--no-c-optimize'.

configure.in:
	Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on alpha-*.
	Empirically, this seems to be needed, otherwise lots of
	the test cases fail when compiled with `--no-c-optimize'.
	(It might also be needed for other architectures, I don't know.)
1998-05-20 11:11:57 +00:00
Zoltan Somogyi
67d8308260 Same as previous message. 1998-04-08 11:36:13 +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
Tyson Dowd
5efca12a76 Use
Estimated hours taken: 0.05

scripts/mmake.in:
	Use
		if mkdir .... ; then
			true
		else
			error case
		fi
	since it's a bit neater than a case statement.
1998-03-31 05:48:03 +00:00
Zoltan Somogyi
b636671a97 Replace "if ! mkdir ..." with "if mkdir ... then true else ...",
Estimated hours taken: 0.1

scripts/ml.in:
	Replace "if ! mkdir ..." with "if mkdir ... then true else ...",
	since the former doesn't work in sh.
1998-03-31 02:05:02 +00:00
Fergus Henderson
6f065be64a Fix some Mmakefile errors that were diagnosed by `--warn-undefined-variables'.
Estimated hours taken: 1

Fix some Mmakefile errors that were diagnosed by `--warn-undefined-variables'.
Also, make a small fix to mmake.in and add empty definitions for various
Mmake variables to avoid spurious warnings.

scripts/mmake.in:
	Add ` dep*' to the patterns for which we do not
	pass `--warn-undefined-variables'; previously it
	matched "$@" against `dep*', which did not catch the
	case of `mmake -k depend'.
		       ^^^

scripts/Mmake.vars.in:
	Add definition for `ds_subdir'.
	Define `MLLIBS' as `$(EXTRA_MLLIBS)' rather than empty,
	and add empty definition for `EXTRA_MLLIBS'.
	Add empty definition for `MAIN_TARGET'.

Mmakefile:
	Fix misspelling: `deps_subdir' not `dep_subdir'.
	Add empty definitions for `PREINSTALL_HACK', `POSTINSTALL_HACK',
	and `MMAKEFLAGS'.

boehm_gc/Mmakefile:
	Add empty definition for `PROF'.

runtime/Mmakefile:
	Add empty definition for `DLL_CFLAGS'.

library/Mmakefile:
	Add empty definition for `CHECK_TERM_OPTS'.

compiler/Mmakefile:
	Add empty definition for `MTAGSFLAGS'.
1998-03-30 13:03:17 +00:00
Tyson Dowd
dbc819121a Bugfix for previous change, mmake wasn't working on murlibobo.
Estimated hours taken: 0.05

scripts/mmake.in:
	Bugfix for previous change, mmake wasn't working on murlibobo.
	"if ! mkdir... " seems to be a bash-ism.  Use mkdir ...., then
	check $? instead.
1998-03-30 06:11:24 +00:00
Tyson Dowd
d928e526a0 Fix two security holes in the way temporary files in /tmp are handled.
Estimated hours taken: 1

Fix two security holes in the way temporary files in /tmp are handled.

configure.in:
	Look for mktemp.

scripts/ml.in:
	Previously, if a file /tmp/ml$$ existed, linker errors would
	be missed (or fake linker errors could be provided).
	Use
		mkdir /tmp/ml.$$ || exit 1
	approach to create a directory, then use a file in that
	directory as the fifo for linker errors.

scripts/mmake.in:
	Previously, if a file /tmp/mmake.$$ existed, it would stop
	the generation of a mmake file, and the system would invoke
	gmake on the existing file (possibly executing arbitrary
	commands).
	Use mktemp (if available) to create the file, and exit if
	it is not possible to create the file.
	If mktemp is not available, use mkdir || exit 1 technique.
1998-03-30 05:26:33 +00:00
Fergus Henderson
0856a71ed1 Fix a syntax error in my last change.
Estimated hours taken: .1

scripts/msc.in:
	Fix a syntax error in my last change.
1998-03-29 13:51:34 +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
207a57a3bc Add empty definitions for a few more variables, to avoid warnings with
Estimated hours taken: 0.25

scripts/Mmake.vars.in:
	Add empty definitions for a few more variables, to avoid warnings with
	`--warn-undefined-variables'.
1998-03-27 16:31:25 +00:00
Fergus Henderson
60eac4cd0c Pass `--warn-undefined-variables', except when making dependencies.
Estimated hours taken: 0.75

scripts/mmake.in:
	Pass `--warn-undefined-variables', except when making dependencies.

runtime/Mmakefile:
scripts/Mmake.vars.in:
	Add empty definitions of a few variables, to avoid warnings with
	`--warn-undefined-variables'.
1998-03-27 08:34:23 +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
f58ee880df Add support for stack dumps, do a stack dump from error/1.
Estimated hours taken: 12

Add support for stack dumps, do a stack dump from error/1.


compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
	Insert EXTRA_MGNUCFLAGS before CFLAGS or EXTRA_CFLAGS
	becasue mgnuc stops processing its options when it
	encounters a non-mgnuc option.

library/require.m:
	Call MR_dump_stack if error is called.

runtime/Mmakefile:
runtime/mercury_imp.h:
	Add #includes of new files.

runtime/mercury_type_info.h:
	Remove conditional definition of MR_STATIC_CODE_ADDRESSES
	(moved into mercury_conf.h.in).

runtime/mercury_accurate_gc.h:
	Remove stack_layout stuff, leave this file for accurate
	GC specific definitions.

runtime/mercury_conf.h.in:
	Add conditional definitions of MR_INSERT_LABELS,
	MR_USE_STACK_LAYOUTS, MR_NEED_INITIALIZATION_CODE and
	MR_STATIC_CODE_ADDRESSES, depending on various other options.

runtime/mercury_goto.h:
	Insert labels into label table if MR_INSERT_LABELS is defined,
	rather than NATIVE_GC.

util/mkinit.c:
	Initialize if MR_NEED_INITIALIZATION_CODE is defined, rather than
	NATIVE_GC.

runtime/mercury_stack_layout.h:
	All the old stack layout definitions from mercury_accurate_gc.h.
	Add code for MR_DETISM_DET_CODE_MODEL.

runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
	Implement MR_dump_stack which just provides a dump of the stack
	as far as possible.
	Set MR_INSERT_LABELS and MR_USE_STACK_LAYOUTS if MR_STACK_TRACE
	is set.

runtime/mercury_grade.h:
	Add _strce if stack tracing is enabled in the grade.  This
	might not be a permanent change.

runtime/mercury_ho_call.c:
	Remove unused label declarations.

scripts/mgnuc.in:
	Add --stack-trace and --no-stack-trace options.
	Consolidate some duplicate code.
1998-03-11 06:01:17 +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
Fergus Henderson
1dffaac715 Add support for -L' (--lib-dir').
Estimated hours taken: 1

scripts/ml.in:
	Add support for `-L' (`--lib-dir').
	`-L' options are basically just passed on to the system linker.
1998-03-06 03:20:57 +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
Zoltan Somogyi
c318fa907b Use a new environment variable MERCURY_ALL_C_INCL_DIRS, which may
Estimated hours taken: 1

scripts/mgnuc.in:
	Use a new environment variable MERCURY_ALL_C_INCL_DIRS, which may
	be defined by the user as a list of -I<dir> options, whose default
	value is -I$MERCURY_C_INCL_DIR. This replaces MERCURY_GC_INCL_DIR.
	The advantage of the new arrangement is that it allows the garbage
	collector header files to be in more than one directory, as they
	are with the Boehm collector (the file gc_inl.h, which is needed at
	-O6, is in boehm_gc/include, while the usual gc.h is in boehm_gc).

tools/bootcheck:
	Set up MERCURY_ALL_C_INCL_DIRS instead of MERCURY_GC_INCL_DIR.
	Tidy some other parts of the script.

doc/user_guide.texi:
	Document the change.
1998-03-03 06:12:35 +00:00
Fergus Henderson
3434794fd9 Fix a bug (missing backslash before "`" in an error message)
Estimated hours taken: 0.1

scripts/ml.in:
	Fix a bug (missing backslash before "`" in an error message)
	reported by Kevet Duncombe <dunc@acm.org>.
	Apparently this bug broke things on FreeBSD 2.2.5.
1998-02-26 09:34:03 +00:00
Tyson Dowd
e4d9c1b334 Fix the handling of the default linking options (shared or static).
Estimated hours taken: 0.5

Fix the handling of the default linking options (shared or static).

Under Linux, the default linkage is supposed to be static, but
only the linkage of the mercury libraries was being set, so
if you tried to link with another library, you needed to add
-static by hand.

Note that this will link in other libraries (such as the C library)
statically as well.

scripts/ml.in:
	Set link flags after handling options, so the flags are
	only set in one place.
	Add default handling for -static and -shared, previously
	there were only defaults for --mercury-libs static/shared.

README.Linux:
	Document that you should use --shared, not just --mercury-libs
	shared, if you want to link statically against other libraries.


Estimated hours taken: _____

<overview or general description of changes>

<directory>/<file>:
	<detailed description of changes>
1998-02-16 06:50:21 +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
f777d1920c Move the `-I $INTDIR' so that it goes *after* the user's arguments
Estimated hours taken: 0.5

scripts/mmc.in:
	Move the `-I $INTDIR' so that it goes *after* the user's arguments
	to mmc, rather than before.  This ensures that any directories that
	the user specifies using `-I' options are searched before the
	standard Mercury library directory, which is consistent with
	the way `-L' and `-R' options are currently handled.

	This patch is needed to allow `-I ..' specified in Mmakefile in
	extras/clpr/samples to work.  Otherwise, it uses the installed
	`.int' files, but links with the local (and potentially different)
	libraries, resulting in link errors.
1998-02-05 03:41:56 +00:00
Fergus Henderson
274a7c9ae1 Add support to Mmake for new variables MLOBJS and MLPICOBJS,
Estimated hours taken: 2

Add support to Mmake for new variables MLOBJS and MLPICOBJS,
since simply listing object files in MLLIBS doesn't do the
right thing in the case when you're building a library package
rather than a program.

scripts/Mmake.vars.in:
	Add definitions of MLOBJS and MLPICOBJS.

compiler/modules.m:
	Add code to use the $(MLOBJS) and $(MLPICOBJS) variables
	to the rules for building programs and libraries that are
	output in the generated `.dep' files.

doc/user_guide.texi:
	Document the use of MLOBJS and MLPICOBJS.
1998-01-29 13:41:23 +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
Zoltan Somogyi
9261af2650 Fix the comment that said that this file was
Estimated hours taken: 0.1

init_grade_options.sh-subr:
	Fix the comment that said that this file was
	parse_grade_options.sh-subr.
1998-01-09 03:10:03 +00:00
Zoltan Somogyi
afeea74b44 Use the value of a new environment variable, MERCURY_GC_INCL_DIR,
Estimated hours taken: 0.5

scripts/mgnuc.in:
	Use the value of a new environment variable, MERCURY_GC_INCL_DIR,
	when invoking the C compiler. This allows the include directory
	for the garbage collector to be different from the include directory
	for the runtime system, which is useful when making incompatible
	changes to the runtime system.

	Fix a bug: the option signalling which argument passing convention
	to use was not being passed to the C compiler in all cases.

doc/user_guide.texi:
	Document the new environment variable.
1998-01-01 04:33:41 +00:00
Fergus Henderson
e6ac077bae Add support for memory profiling.
Estimated hours taken: 40 (+ unknown time by Zoltan)

Add support for memory profiling.

(A significant part of this change is actuallly Zoltan's work.  Zoltan
did the changes to the compiler and a first go at the changes to the
runtime and library.  I rewrote much of Zoltan's changes to the runtime
and library, added support for the new options/grades, added code to
interface with mprof, did the changes to the profiler, and wrote the
documentation.)

[TODO: add test cases.]

NEWS:
	Mention support for memory profiling.

runtime/mercury_heap_profile.h:
runtime/mercury_heap_profile.c:
	New files.  These contain code to record heap profiling information.

runtime/mercury_heap.h:
	Add new macros incr_hp_msg(), tag_incr_hp_msg(),
	incr_hp_atomic_msg(), and tag_incr_hp_atomic_msg().
	These are like the non-`msg' versions, except that if
	PROFILE_MEMORY is defined, they also call MR_record_allocation()
	from mercury_heap_profile.h to record heap profiling information.
	Also, fix up the indentation in lots of places.

runtime/mercury_prof.h:
runtime/mercury_prof.c:
	Added code to dump out memory profiling information to files
	`Prof.MemoryWords' and `Prof.MemoryCells' (for use by mprof).
	Change the format of the `Prof.Counts' file so that the
	first line says what it is counting, the units, and a scale
	factor.  Prof.MemoryWords and Prof.MemoryCells can thus have
	exactly the same format as Prof.Counts.
	Also cleaned up the interface to mercury_prof.c a bit, and did
	various other minor cleanups -- indentation changes, changes to
	use MR_ prefixes, additional comments, etc.

runtime/mercury_prof_mem.h:
runtime/mercury_prof_mem.c:
	Rename prof_malloc() as MR_prof_malloc().
	Rename prof_make() as MR_PROF_NEW() and add MR_PROF_NEW_ARRAY().

runtime/mercury_wrapper.h:
	Minor modifications to reflect the new interface to mercury_prof.c.

runtime/mercury_wrapper.c:
runtime/mercury_label.c:
	Rename the old `-p' (primary cache size) option as `-C'.
	Add a new `-p' option to disable profiling.

runtime/Mmakefile:
	Add mercury_heap_profile.[ch].
	Put the list of files in alphabetical order.
	Delete some obsolete stuff for supporting `.mod' files.
	Mention that libmer_dll.h and libmer_globals.h are
	produced by Makefile.DLLs.

runtime/mercury_imp.h:
	Mention that libmer_dll.h is produced by Makefile.DLLs.

runtime/mercury_dummy.c:
	Change a comment to refer to libmer_dll.h rather than
	libmer_globals.h.

compiler/llds.m:
	Add a new field to `create' and `incr_hp' instructions
	holding the name of the type, for heap profiling.

compiler/unify_gen.m:
	Initialize the new field of `create' instructions with
	the appropriate type name.

compiler/llds_out.m:
	Output incr_hp_msg() / tag_incr_hp_msg() instead of
	incr_hp() / tag_incr_hp().

compiler/*.m:
	Minor changes to most files in the compiler back-end to
	accomodate the new field in `incr_hp' and `create' instructions.

library/io.m:
	Add `io__report_full_memory_stats'.

library/benchmarking.m:
	Add `report_full_memory_stats'.  This uses the information saved
	by runtime/mercury_heap_profile.{c,h} to print out a report
	of memory usage by procedures and by types.
	Also modify `report_stats' to print out some of that information.

compiler/mercury_compile.m:
	If `--statistics' is enabled, call io__report_full_memory_stats
	at the end of main/2.  This will print out full memory statistics,
	if the compiler was compiled with memory profiling enabled.

compiler/options.m:
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/ml.in:
scripts/mgnuc.in:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Add new option `--memory-profiling' and new grade `.memprof'.
	Add `--time-profiling' as a new synonym for `--profiling'.
	Also add `--profile-memory' for more fine-grained control:
	`--memory-profiling' implies both `--profile-memory' and
	`--profile-calls'.

scripts/mprof_merge_runs:
	Update to handle the new format of Prof.Counts and to
	also merge Prof.MemoryWords and Prof.MemoryCells.

profiler/options.m:
profiler/mercury_profile.m:
	Add new options `--profile memory-words' (`-m'),
	`--profile memory-cells' (`-M') and `--profile time' (`-t').
	Thes options make the profiler select a different count file,
	Prof.MemoryWords or Prof.MemoryCells instead of Prof.Counts.
	specific to time profiling.

profiler/read.m:
profiler/process_file.m:
profiler/prof_info.m:
profiler/generate_output.m:
	Update to handle the new format of the counts file.
	When reading the counts file, look at the first line of
	the file to determine what is being profiled.

profiler/globals.m:
	Add a new global variable `what_to_profile' that records
	what is being profiled.

profiler/output.m:
	Change the headings to reflect what is being profiled.

doc/user_guide.texi:
	Document memory profiling.
	Document new options.

doc/user_guide.texi:
compiler/options.m:
	Comment out the documentation for `.proftime'/`--profile-time',
	since doing time and call profiling seperately doesn't work,
	because the code addresses change when you recompile with a
	different grade.  Ditto for `.profmem'/`--profile-memory'.
	Also comment out the documentation for
	`.profcalls'/`--profile-calls', since it is redundant --
	`.memprof' produces the same information and more.

configure.in:
	Build a `.memprof' grade.  (Hmm, should we do this only
	if `--enable-all-grades' is specified?)
	Don't ever build a `.profcalls' grade.
1997-12-05 15:58:34 +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
557e1591c4 Set GPATH to the same value as VPATH.
Estimated hours taken: 4

scripts/Mmake.vars.in:
	Set GPATH to the same value as VPATH.
	This is necessary to make things work with GNU Make versions >= 3.76.
	(Otherwise GNU Make tries to build the library interface files in
	the current directory rather than the library directory,
	if they are out-of-date with respect to the datestamp files,
	and then since they don't exist in the current directory,
	it thinks they have changed, even if they haven't.)
1997-10-18 17:25:14 +00:00
Fergus Henderson
9560996907 Change the layout of the `--help' message so that
Estimated hours taken: 0.5

scripts/mprof_merge_runs:
	Change the layout of the `--help' message so that
	the formatting of the automatically-generated man page
	comes out OK.
1997-10-15 16:44:33 +00:00
Fergus Henderson
6f6843745b When building foo from foo.in, check to ensure there were no
Estimated hours taken: 0.25

scripts/Mmakefile:
	When building foo from foo.in, check to ensure there were no
	mispelt autoconf variable names.
1997-10-15 16:30:33 +00:00
Fergus Henderson
e4786a27a3 New file. A script for merging multiple runs into a single
Estimated hours taken: 2

scripts/mprof_merge_runs:
	New file.  A script for merging multiple runs into a single
	profile.

scripts/Mmakefile:
	Add mprof_merge_runs to the list of scripts.

doc/Mmakefile:
	Add mprof_merge_runs to the list of things which need manpages.
	(The manpage will be created automatically by `make_manpage'.)

doc/user_guide.texi:
	Document the use of mprof_merge_runs.
1997-10-14 09:35:07 +00:00
Fergus Henderson
300761d01d Fix a bug in the setting of the MERCURY_LPSOLVE environment
Estimated hours taken: 0.25

scripts/mmc.in:
	Fix a bug in the setting of the MERCURY_LPSOLVE environment
	variable.
1997-10-14 03:29:02 +00:00
Fergus Henderson
3b1b5166f0 Make the user's -R' (-rpath') options precede the Mercury ones.
Estimated hours taken: 0.25

scripts/ml.in:
	Make the user's `-R' (`-rpath') options precede the Mercury ones.
	This allows the user to use their own local copies of the
	Mercury shared libraries.
1997-10-12 13:46:45 +00:00