Commit Graph

633 Commits

Author SHA1 Message Date
Simon Taylor
886d2ae474 Make it easier to use shared libraries on x86 with
Estimated hours taken: 20
Branches: main

Make it easier to use shared libraries on x86 with
`mmc --make'.

There is now a third kind of object file, `.lpic_o'.
These files are compiled with `--pic-reg' but not with
CFLAGS_FOR_PIC, so they can be linked with shared Mercury
libraries.

On x86, executables which are linked with shared Mercury
libraries now depend on $(main_module.lpic_os), not
$(main_module.os).

This doesn't work with Mmake because ml doesn't know
which libraries are Mercury libraries, so it can't
link with the static versions of those libraries if
MERCURY_LINKAGE is set to "static".

configure.in:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
	Work out whether `.lpic_o' files are needed.

compiler/modules.m:
	Add `.lpic_o' to the list of grade or architecture
	dependent files.

NEWS:
README.Linux:
compiler/options.m:
doc/user_guide.texi:
	Document MERCURY_LINKAGE, LINKAGE, --linkage,
	--mercury-linkage and -R.

compiler/options_file.m:
compiler/make.program_target.m:
	Handle LINKAGE and MERCURY_LINKAGE variables.

	Allow LIBGRADES, LINKAGE and MERCURY_LINKAGE to be target-specific.

scripts/mmc.in:
	Set up the default linkage using the MERCURY_LINKAGE
	variable.

compiler/compile_target_code.m:
	Build `.lpic_o' files.

	Work out which type of object files to link with.

	When linking statically with Mercury libraries,
	find the absolute pathname for the `.a' file
	for each Mercury library, and pass that to ml,
	rather than just using `-lname'.

	Pass `-R' options to ml for each `-R' option to mmc.

compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile.m:
	Specify which type of object files to build.

compiler/make.program_target.m:
compiler/make.module_target.m:
	Make sure all generated object files are cleaned up.

compiler/prog_io.m:
	Add a better message for files which can't be found.

compiler/make.util.m:
	Add `.lpic_o' to the list of extensions.

compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	Pass `--linkage shared' to mmc (`--shared' is in MLFLAGS).

tests/Mmakefile:
tests/mmc_make/Mmakefile:
tests/mmc_make/Mercury.options:
tests/mmc_make/complex_test.{m,exp}:
tests/mmc_make/hello.{m,exp}:
	Test `mmc --make'.

tests/lib/complex*.m:
	The complex numbers library from the extras distribution,
	for use in the mmc_make tests.
2003-01-23 00:24:20 +00:00
Fergus Henderson
b0963db13c Enabled demangling for the MLDS back-end.
Estimated hours taken: 0.1
Branches: main

scripts/ml.in:
	Enabled demangling for the MLDS back-end.
2003-01-22 03:04:51 +00:00
Simon Taylor
585fca09ae Pass the configured values for --executable-file-extension,
Estimated hours taken: 0.1
Branches: main, release

scripts/mmc.in:
	Pass the configured values for --executable-file-extension,
	--shared-library-extension and --pic-object-extension.
2003-01-16 04:11:30 +00:00
Simon Taylor
4b14085c72 A first implementation of the inter-module analysis framwork.
Estimated hours taken: 80
Branches: main

A first implementation of the inter-module analysis framwork.
Currently only unused argument analysis is supported.

The current inter-module analysis scheme using `.trans_opt' files
has some major limitations. The compilation dependencies introduced
by `.trans_opt' files are too complicated for Mmake without major
limitations on which modules can use the contents of which `.trans_opt'
files. Also, the `.trans_opt' file system only computes greatest fixpoints,
which is often too weak to find opportunities for optimization.
A better solution is to provide a library which manually handles
the dependencies introduced by inter-module analysis, and can deal with
the complications introduced by cyclic module dependencies.

TODO:
- support other analyses, e.g. termination, type specialization
- dependency tracking and invalidation after source modifications
- garbage collection of unused versions
- least fixpoint analyses

analysis/Mmakefile:
analysis/mer_analysis.m:
analysis/analysis.m:
analysis/analysis.file.m:
	The analysis library.

analysis/README:
	Description and design documentation.

Mmake.workspace:
Mmakefile:
compiler/Mmakefile:
tools/bootcheck:
	Link the analysis library into mercury_compile.

compiler/hlds_module.m:
	Store analysis information in the module_info.

compiler/options.m:
doc/user_guide.texi:
	Add an option `--intermodule-analysis'.

compiler/mercury_compile.m:
	Call the analysis library to write the gathered
	information at the end of a compilation.

compiler/unused_args.m:
	Call the analysis library to retrieve information
	about imported procedures. This replaces code which
	used the `.opt' files.

	Change the names created for unused arguments procedures
	to include the arguments removed, rather than a sequence
	number. I think Zoltan is working on a change to name
	mangling, so I haven't updated the demangler.

compiler/prog_util.m:
	Generate the new predicate names for unused_args.m.

library/std_util.m:
	Add a polymorphic version of unit, which is useful
	for binding type variables.

compiler/modules.m:
scripts/Mmake.vars.in:
	Clean up files created by the analysis framework
	in `mmake realclean'.

util/mdemangle.c:
profiler/demangle.m:
	Document the change in the name mangling of procedures with
	unused arguments.

configure.in:
	Check for state variables and fixes for some typeclass bugs.

tests/warnings/Mmakefile:
tests/warnings/unused_args_analysis.{m,exp}:
	Test case.
2003-01-02 06:54:03 +00:00
Peter Ross
8248fb3327 Fix a bug where passing il or java as the argument to
Estimated hours taken: 2
Branches: main

scripts/canonical_grade.sh-subr:
	Fix a bug where passing il or java as the argument to
	./canonical_grade --grade <grade> was returning "hl".
2002-12-23 11:21:56 +00:00
Peter Ross
7743abd9d1 Use a shy-group (one which doesn't record its result in a
Estimated hours taken: 0.1
Branches: main, release

scripts/gud.el:
	Use a shy-group (one which doesn't record its result in a
	matched substring).
2002-12-04 17:08:45 +00:00
Peter Ross
ff4acab0b0 Fix the regexp which matches a procedure specification so that
Estimated hours taken: 1
Branches: main, release

scripts/gud.el:
	Fix the regexp which matches a procedure specification so that
	it matches procedures which are contained in sub-modules.
2002-12-04 16:45:50 +00:00
Peter Ross
e22b7ae84a Add gud.el.
Estimated hours taken: 0.1
Branches: main, release

scripts/.nocopyright:
	Add gud.el.
2002-12-04 16:44:05 +00:00
Fergus Henderson
6d01f7e69a Fix a bug introduced in Zoltan's recent change to the main branch:
Estimated hours taken: 0.25
Branches: main

scripts/Mmakefile:
        Fix a bug introduced in Zoltan's recent change to the main branch:
        delete a reference to the "install_cgi_scripts" target, since that
        target no longer exists.
2002-11-29 04:16:40 +00:00
Zoltan Somogyi
3da281372f Delete refs to the mdprof shell script.
Estimated hours taken: 0.1
Branches: main

scripts/Mmakefile:
	Delete refs to the mdprof shell script.
2002-11-28 05:53:14 +00:00
Fergus Henderson
20d4ab3dda Be consistent about using -' rather than /' for options to cl.
Estimated hours taken: 1
Branches: main, release

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Be consistent about using `-' rather than `/' for options to cl.
	Use `-o ' rather than `-link -out:'.
	Ensure that `-o' comes before $(MS_CL_LIBS).
	Resynchronize the release branch with the main branch.
2002-11-20 12:33:02 +00:00
Simon Taylor
5158b782e1 Search /usr/local/lib for shared libraries.
Estimated hours taken: 1
Branches: main, release

Search /usr/local/lib for shared libraries. This fixes
problems linking debugging executables on mundroo.

configure.in:
aclocal.m4:
	Check for /usr/local/lib.

scripts/ml.in:
	Document why we don't default to static linking for
	all libraries on Solaris/x86.
2002-11-19 08:16:07 +00:00
Peter Ross
dc060b2ed3 Fix a bug in my previous change to fix a bug in fjh's previous change.
Estimated hours taken: 0.5
Branches: main

Fix a bug in my previous change to fix a bug in fjh's previous change.
Revert back to using '/out:', and instead add the flag '/link' so that '/out:'
is passed to the linker instead to avoid problems compiling the library.

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Add '/link' before the '/out:'.

scripts/Mmake.rules:
	Also add fjh's change for /LD to other rules building .dlls.
2002-11-15 12:09:18 +00:00
Peter Ross
e79cb48f1d Fix a bug in fjh's previous change where we are passing the linker
Estimated hours taken: 0.5
Branches: main

Fix a bug in fjh's previous change where we are passing the linker
flag for naming the output file to the C compiler, not the C compiler
flag.

scripts/Mmake.rules:
	'-o' is the flag for naming the output file for the C compiler.
2002-11-15 10:11:02 +00:00
Fergus Henderson
29679e979a When invoking $(MS_CL) to create DLLs, use the option "/LD" which
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	When invoking $(MS_CL) to create DLLs, use the option "/LD" which
	is documented in the help message, rather than the (undocumented?)
	options "-link -noentry mscoree.lib -dll".
2002-11-06 04:24:22 +00:00
Simon Taylor
8687a17aea Fix "cygpath: command not found" errors with `mmake --use-mmc-make'.
Estimated hours taken: 0.25
Branches: main

Fix "cygpath: command not found" errors with `mmake --use-mmc-make'.

configure.in:
bindist/bindist.configure.in:
scripts/Mmake.vars.in:
	Check that `cygpath' exists, rather than hard-coding
	it in Mmake.vars.in.
2002-11-04 01:49:10 +00:00
Peter Ross
adf0488373 Make --c-debug work correctly when using MSVC as your C compiler.
Estimated hours taken: 1
Branches: main

Make --c-debug work correctly when using MSVC as your C compiler.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	Use /Zi when --c-debug is enabled and we are using MSVC for
	our C compiler.

scripts/ml.in:
	Pass /DEBUG to the linker when --c-debug is enabled and we
	are using MSVC for our C compiler.

runtime/Mmakefile:
	Pass --c-debug to mgnuc rather than passing -g through to the
	underlying C compiler.
2002-10-30 16:35:37 +00:00
Fergus Henderson
6d7c9629a4 Fix a bug where `mercury.dll' was not being found by the C# compiler.
Estimated hours taken: 3
Branches: main

Fix a bug where `mercury.dll' was not being found by the C# compiler.
when you configured with a non-MS C compiler.  This bug broke
tests/hard_coded/foreign_type in grade il.

configure.in:
bindist/bindist.build_vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC.

scripts/Mmake.vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC,
	and add new variables FIX_PATH_FOR_CL and FIX_PATH_FOR_CSC.
	The new variables are currently hard-wired as `cygpath -w',
	since currently we only support the MS versions of CL and CSC.

	Also, change the definition of MERC_DLL_DIR to use $(GRADE)
	rather than hard-coding "ilc".

scripts/Mmake.rules:
	Use the new variables, rather than $(CYGPATH).

	Also, update various comments, and delete the unnecessary version
	number from the MS_VC7_INCLUDES_DIR and MS_VC7_INCLUDES variable
	names.

scripts/ml.in:
	Use @FIX_PATH_FOR_CC@ rather than @CYGPATH@.
2002-10-24 09:16:11 +00:00
Fergus Henderson
9aa7de6f56 Fix a bug where `mercury.dll' was not being found by the C# compiler.
Estimated hours taken: 3
Branches: main

Fix a bug where `mercury.dll' was not being found by the C# compiler.
when you configured with a non-MS C compiler.  This bug broke
tests/hard_coded/foreign_type in grade il.

configure.in:
bindist/bindist.build_vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC.

scripts/Mmake.vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC,
	and add new variables FIX_PATH_FOR_CL and FIX_PATH_FOR_CSC.
	The new variables are currently hard-wired as `cygpath -w',
	since currently we only support the MS versions of CL and CSC.

	Also, change the definition of MERC_DLL_DIR to use $(GRADE)
	rather than hard-coding "ilc".

scripts/Mmake.rules:
	Use the new variables, rather than $(CYGPATH).

	Also, update various comments, and delete the unnecessary version
	number from the MS_VC7_INCLUDES_DIR and MS_VC7_INCLUDES variable
	names.

scripts/ml.in:
	Use @FIX_PATH_FOR_CC@, rather than @CYGPATH@.
2002-10-24 07:36:19 +00:00
Fergus Henderson
1af57b2855 Run $(RANLIB) on the installed libraries.
Estimated hours taken: 0.75
Branches: main

scripts/Mmake.rules:
boehm_gc/Mmakefile:
runtime/Mmakefile:
library/Mmakefile:
trace/Mmakefile:
	Run $(RANLIB) on the installed libraries.
	This is needed on MacOS 10.1, where the linker checks the date
	stamp on the .a file, refusing to link if this date is greater
	than the date when ranlib was run.  Since installing the
	libraries with `cp' updates their timestamp, we need to rerun ranlib.

scripts/Mmake.rules:
	Change some hard-coded occurrences of `.a' to `.$A'.  This is
	probably needed to make things work properly when building with MSVC.
2002-10-18 04:16:18 +00:00
Fergus Henderson
ffee30fa53 Change things so that LIBGRADES includes the default grade.
Estimated hours taken: 1
Branches: main

Change things so that LIBGRADES includes the default grade.
This fixes a bug that sometimes caused the libraries not to be
installed in the default grade, e.g. when $(GRADE) is set in Mmake.params.

configure.in:
	Don't delete $(GRADE) from $(LIBGRADES).

Mmakefile:
scripts/Mmake.rules:
compiler/make.program_target.m:
	Change the loops over $(ALL_LIBGRADES) so that they skip $(GRADE).

scripts/Mmake.vars.in:
	Delete an bogus assignment setting LIBGRADES to empty, since it
	wasn't being used (LIBGRADES was being assigned again below).
	Update the documentation for LIBGRADES.
2002-10-15 16:23:57 +00:00
Fergus Henderson
e412866758 Avoid warnings with gcc 3.1, 3.1.1 and 3.2: don't add -I/usr/local/include for
Estimated hours taken: 3
Branches: main

Avoid warnings with gcc 3.1, 3.1.1 and 3.2: don't add -I/usr/local/include for
gcc.  Also don't add -I/usr/local/include or -L/usr/local/lib if those
directories don't exist, because that too can result in annoying warnings.

configure.in:
	Move the code to check whether to add -I/usr/local/include from
	configure.in to a new macro MERCURY_CHECK_LOCAL_INCL_DIRS in
	aclocal.m4, so that it can also be used by
	bindist/bindist.configure.in.
	Also, don't add /usr/local/lib to LIBS if that doesn't exist.

aclocal.m4:
	Define the new macro.
	Change that code so that it does not add -I/usr/local/include
	if the C compiler is GCC, or if /usr/local/include doesn't exist.
	Record whether or not to add -I/usr/local/include in a new autoconf
	substitution variable ALL_LOCAL_INCL_DIRS.

bindist/bindist.configure.in
	Call the new macro.

scripts/mgnuc.in:
	Use @ALL_LOCAL_INCL_DIRS@ rather than -I$MERCURY_LOCAL_C_INCL_DIR or
	-I/usr/local/include.  (The ability to set the MERCURY_LOCAL_C_INCL_DIR
	environment variable was not documented and was not used anywhere else
	in the Mercury distribution.)
2002-10-06 15:45:30 +00:00
Fergus Henderson
700b983325 Update to include recently added generated files.
Branches: main
Estimated hours taken: 0.25

scripts/.cvsignore:
deep_profiler/.cvsignore:
extras/dynamic_linking/.cvsignore:
	Update to include recently added generated files.

compiler/.cvsignore:
	Fix a typo: s/aditi_backend/aditi_backend.m/
2002-10-02 06:59:19 +00:00
Fergus Henderson
411f5a427d Fix missing ";;" in case statement.
Estimated hours taken: 0.1
Branches: main

scripts/mgnuc.in:
	Fix missing ";;" in case statement.
	(This only showed up when trying to build GCC-related grades
	with a non-GCC C compiler.)
2002-10-02 06:40:04 +00:00
Fergus Henderson
16cbea5ca7 Define ERR_REDIRECT in Mmake.vars.in, rather than Mmake.rules,
Branches: main
Estimated hours taken: 0.25

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Define ERR_REDIRECT in Mmake.vars.in, rather than Mmake.rules,
	so that it can be overridden by the user's Mmakefile.
2002-09-15 10:01:51 +00:00
Fergus Henderson
bf5a95b6d7 Make the redirection of errors into `.err' files configurable,
Branches: main
Estimated hours taken: 1

scripts/Mmake.rules:
	Make the redirection of errors into `.err' files configurable,
	by abstracting out the code to redirect errors into a variable
	ERR_REDIRECT.  By default the behaviour remains the same, but if
	you run `mmake ERR_REDIRECT=', then errors will not be redirected.
2002-09-13 18:51:40 +00:00
Fergus Henderson
935fd45bd3 Support shared libraries on mundroo.
Estimated hours taken: 6
Branches: main

Support shared libraries on mundroo.

configure.in:
	Add support for shared libraries on x*86-*-solaris2.*.

boehm_gc/Makefile:
	Compile mach_dep.c with $(CFLAGS_FOR_PIC), like we do all the
	other C files in this directory.  This is needed for Solaris/x86,
	and should hopefully be harmless on other systems.

scripts/ml.in:
	Make static linking the default for x*86-*-solaris2.*,
	for the same reason as for Linux.
	Also, pass -L/usr/local/lib, even when `--mercury-libs none' or
	`--no-mercury-stdlib-dir' is specified.  This is needed to ensure
	that we find libreadline.a when building the Mercury standard
	library, if libreadline.a is installed in /usr/local/lib.
	(The Mercury configure script searches /usr/local/lib.)

runtime/Mmakefile:
trace/Mmakefile:
	Include -L/usr/local/lib in LDFLAGS, for the same reason as above.
2002-09-11 19:00:19 +00:00
Fergus Henderson
f33605beed Allow "__ppc__" as another alternative to "__powerpc__" and "_POWER"
Estimated hours taken: 2
Branches: main

runtime/mercury_regs.h:
	Allow "__ppc__" as another alternative to "__powerpc__" and "_POWER"
	for recognizing Power PC processors.

scripts/mgnuc.in:
	If $COMPILER is "unknown" (e.g. because $CC is "cc"),
	don't disable grades such as "reg.gc".
2002-09-09 18:07:39 +00:00
Zoltan Somogyi
c0f4d93a3c Add a new grade component, .decldebug. It is as proposed on mercury-developers,
Estimated hours taken: 2
Branches: main

Add a new grade component, .decldebug. It is as proposed on mercury-developers,
minus the implications about I/O tabling. Those will come later.

compiler/options.m:
	Add a new option, --decl-debug, that switches on declarative debugging.

compiler/trace_params.m:
	The procedure that converts strings representing trace levels to trace
	levels themselves now has an extra argument, which gives the value of
	the --decl-debug option. If set, it raises the minimum trace level,
	and turn explicitly specifying trace levels `shallow' and `deep'
	into errors (since they are not sufficient for declarative debugging).

compiler/handle_options.m:
	Pass the value of the --decl-debug option to trace_params, and handle
	the errors that may result. Handle the implications of --decl-debug
	and the .decldebug grade component.

compiler/compile_target_code.m:
	Define MR_DECL_DEBUG when invoking the C compiler if --decl-debug is
	set.

runtime/mercury_conf_param.h:
	Document MR_DECL_DEBUG, which is defined iff the grade is a .decldebug
	grade.

runtime/mercury_grade.h:
	Take MR_DECL_DEBUG into account when computing the grade component
	related to debugging.

	Update the list of places that need to be modified when adding new
	grade components.

doc/user_guide.texi:
	Document --decl-debug and the .decldebug grade component.

	Document the events used by declarative debugging, since Mark didn't.

	Fix some minor unrelated omissions.

scripts/init_grade.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade.sh-subr:
scripts/canonical_grade.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
	Add a new shell variable, decl_debug, to represent the value of
	MR_DECL_DEBUG, and handle it as appropriate.

tests/debugger/Mmakefile:
	Do not execute shallow traced tests in .decldebug grades, since we
	don't support shallow tracing in such grades.

	Specify --trace decl instead of --trace deep in .decldebug grades
	when compiling the other tests, since we don't support --trace deep
	in .decldebug grades.
2002-09-01 06:05:20 +00:00
Simon Taylor
634193dc4b Fix errors caused by attempting to move nonexistent files
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
	Fix errors caused by attempting to move nonexistent files
	when installing libraries.
2002-08-24 11:54:26 +00:00
Simon Taylor
a77d488245 In the presence of foreign code the .opt' and .trans_opt' files
Estimated hours taken: 10
Branches: main

In the presence of foreign code the `.opt' and `.trans_opt' files
aren't grade independent, so install them in grade-dependent
directories.

scripts/Mmake.vars.in:
	Define $(INSTALL_GRADE_INT_DIR), which holds `.opt'
	and `.trans_opt' files.

	Pass the extra libraries to mmc using `--ml' and `--mld'
	(`--mercury-library' and `--mercury-library-directory')
	options, rather than just a `-I' option. This is needed
	so that $(INSTALL_GRADE_INT_DIR) is searched for `.opt'
	files before $(INSTALL_INT_DIR)

	Fix a bug -- the `-I' options for libraries should
	go in CFLAGS, not MGNUCFLAGS.

scripts/Mmake.rules:
	Create INSTALL_GRADE_INT_DIR in the install_grade_dirs target.

compiler/modules.m:
	Install `.opt' and `.trans_opt' files in $(INSTALL_GRADE_INT_DIR).

	`.int0' files are needed by `.opt' files for sub-modules, so
	install them.

	<module>.int0s now only contains the names of modules with sub-modules
	(this is needed to avoid attempting to install nonexistent `.int0'
	files).

compiler/handle_options.m:
	Add $(INSTALL_GRADE_INT_DIR) for each `--mercury-library' option
	to `--intermod-directories'.

Mmakefile:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	Simplify the code to copy/remove the grade dependent files
	before building the libraries in a new grade when installing.

	Copy/remove all grade-dependent files, including `.opt' files
	and `.dv' files.
2002-08-22 02:34:21 +00:00
Fergus Henderson
c536e2516a A couple of additional parts of my change to add support for the
Estimated hours taken: 0.25
Branches: main

A couple of additional parts of my change to add support for the
MPS garbage collector which I forgot to commit in my previous change.

util/mkinit.c:
	Define the stack_bottom parameter of `mercury_init' to have type
	`void *' rather than `char *', and make sure that it is word-aligned.
	MPS requires that it be word-aligned.

scripts/mgnuc.in:
        Handle the new `mps' GC method.
2002-08-21 16:01:45 +00:00
Fergus Henderson
94f3e96ed1 Fix a bug in my previous change: handle the case where $gc_method
Estimated hours taken: 0.25
Branches: main

scripts/mgnuc.in:
	Fix a bug in my previous change: handle the case where $gc_method
	is `boehm' rather than `conservative', and pass -DMR_BOEHM_GC
	as well as -DMR_CONSERVATIVE_GC.
2002-08-21 15:34:15 +00:00
Fergus Henderson
17d5aa732e Add support for interfacing Mercury with the MPS garbage collector.
Estimated hours taken: 20
Branches: main

Add support for interfacing Mercury with the MPS garbage collector.

This change is broken into three parts:

	1. Import version 1.100.1 of the MPS kit into the Mercury
	   CVS repository, in the directory `mps_gc'.

	2. Make some changes to the MPS kit for Mercury,
	   to support fully-conservative collection and tagged pointers,
	   and to wrap it in an interface that is similar to that of
	   the Boehm collector.

	3. Modify the rest of the Mercury implementation
	   to support linking with the MPS kit instead
	   of the Boehm collector.  This involved defining
	   `mps' as a new GC method and a new grade component.

This is part 3 of 3.

Mmake.workspace:
	Include the MPS directories in the header file and library search
	paths.

tools/bootcheck:
	Link the mps_gc directory into the stage2 and stage3 directories.

Mmake.workspace:
runtime/Mmakefile:
scripts/ml.in:
	For *.mps grades, link in mps.a.
	(XXX ml.in is linking in libmps.a, which is wrong.)

runtime/Mmakefile:
trace/Mmakefile:
	In the rule for `check_headers', which checks macro namespace
	cleanliness, allow names to start with `MPS_' or `mps_'.

runtime/RESERVED_MACRO_NAMES:
	Add `mercury_mps_h', which is used by mps_gc/code/mercury_mps.h
	for its header guard.  (Normally it would be better to use
	uppercase for header guard macro names, but that would be
	inconsistent with the coding style used in mps_gc/code.)

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
	Handle the new `mps' GC method and grade component.

compiler/globals.m:
compiler/options.m:
doc/user_guide.texi:
	Replace gc_method `conservative' with two alternatives
	`boehm' and `mps'. ("--gc conservative" is still allowed,
	and treated as equivalent to "--gc boehm".)
	Add new function `gc_is_conservative' to globals.m.

compiler/mercury_compile.m:
compiler/handle_options.m:
	Use `gc_is_conservative' rather than `= conservative'.

compiler/handle_options.m:
	Handle the "mps" grade component.
	(XXX need to document this in options.m and user_guide.texi)

compiler/compile_target_code.m:
	Pass the appropriate C defines for the new GC methods.

compiler/mercury_compile.m:
	Wrap the work-around for a Boehm GC bug inside `#ifndef MR_MPS_GC'.

library/array.m:
	Use GC_FREE() rather than GC_free().
	This is needed for two reasons:
	- so that it works with MPS, which only defines GC_FREE
	- so that it works with then Boehm collector when
	  GC debugging is enabled

library/benchmarking.m:
	Output GC statistics for the MPS collector.

runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
	If MR_MPS_GC is defined, use mercury_mps.h rather than gc.h.

runtime/mercury_conf_param.h:
	Add configuration macros MR_BOEHM_GC and MR_MPS_GC.
	Set MR_CONSERVATIVE_GC if either of these is set.
	Default to MR_BOEHM_GC if only MR_CONSERVATIVE_GC is set.

runtime/mercury_context.h:
runtime/mercury_deep_copy.h:
runtime/mercury_engine.h:
runtime/mercury_float.h:
runtime/mercury_heap.h:
	Explictly #include "mercury_conf.h", so that
	MR_CONSERVATIVE_GC will be set properly before it is tested.

runtime/mercury_grade.h:
	Handle the .mps grade component.

runtime/mercury_memory.c:
runtime/mercury_wrapper.c:
runtime/mercury_memory_handlers.c:
	Move the call to MR_setup_signals() earlier in the
	initialization sequence, so that the MPS signal handlers
	get installed after our signal handlers.  This is needed
	because our signal handlers assume that any signals that
	they can't handle are fatal errors, which interfere's
	with MPS's use of signal handlers for memory barriers.

runtime/mercury_wrapper.c:
	Add code to initialize the MPS collector.
	Put code which is specific to the Boehm collector inside
	#ifdef MR_BOEHM_GC rather than #ifdef MR_CONSERVATIVE_GC.

runtime/mercury_wrapper.h:
	Update a comment.
2002-08-21 11:28:01 +00:00
Simon Taylor
3e448ade11 The code to pass the grade dependent C macros to the C compiler
Estimated hours taken: 0.1
Branches: main

scripts/mgnuc.in:
runtime/mercury_grade.h:
	The code to pass the grade dependent C macros to the C compiler
	recently moved from mercury_compile.m to compile_target_code.m,
	so update the pointers to places that need to be changed when a
	new grade is added.
2002-08-20 10:40:43 +00:00
Simon Taylor
f93cb36f0f Add lib*.install to the list of targets that should
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
	Add lib*.install to the list of targets that should
	be handled by mmc with `--use-mmc-make'.
2002-08-16 02:05:12 +00:00
Simon Taylor
7620b07c54 Use `DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-...}' rather than
Estimated hours taken: 0.25
Branches: main, release

scripts/mmc:
	Use `DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-...}' rather than
	`DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS=...}'. The latter form
	causes /bin/sh on mundroo (Solaris/x86 2.8) to crash when
	the RHS of the assignment is very long.
2002-08-08 06:22:00 +00:00
Simon Taylor
44ef4e118b Library installation with `mmc --make'.
Estimated hours taken: 10
Branches: main

Library installation with `mmc --make'.

compiler/make.m:
compiler/make.program_target.m:
	Handle `mmc --make lib<module>.install'.

compiler/options.m:
	Add an option `--use-grade-subdirs', which causes
	all grade-dependenent files to be placed in
	`Mercury/<grade>/<ext>s' subdirectories, even
	those files that are intended for use by the user.

	`--use-grade-subdirs' is not documented because it
	is only intended for use in library installation
	with `mmc --make' (it doesn't work at all with Mmake).
	Documenting it would require documenting (and setting
	in stone) the layout of the `Mercury' directory, which
	is probably a bad idea.

Mmake.workspace:
compiler/handle_options.m:
scripts/Mmake.rules:
	Header files are now always searched for using the plain
	file name (not Mercury/mihs/module.mih), so add a
	`--c-include-directory' option to search Mercury/mihs
	in the current directory.

compiler/modules.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/mercury_compile.m:
compiler/mlds_to_c.m:
compiler/trans_opt.m:
	Handle `--use-grade-subdirs' in module_name_to_file_name.

	Add module_name_to_search_file_name, which should be
	used to generate the names of files that might be part
	of an installed library. This is needed because installation
	and local directory hierarchies have a different layout,
	A better long-term fix would be to change things so that
	the installation and local directory layouts are the same.

compiler/make.util.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
	Add an extra argument to get_target_timestamp and
	get_file_name to specify whether the file should
	be searched for.

compiler/options_file.m:
scripts/Mmake.vars.in:
	Handle the LIBGRADES and INSTALL_PREFIX make variables.

doc/user_guide.texi:
	Remove the statement that library installation is
	not supported with `mmc --make'.
2002-08-07 13:12:11 +00:00
Simon Taylor
7de0228bcc Fix the code to add extra initialization functions to library/mer_std.init.
Estimated hours taken: 1.5
Branches: main

Fix the code to add extra initialization functions to library/mer_std.init.

compiler/options.m:
doc/user_guide.texi:
compiler/compile_target_code.m:
	Rename the `--make-init-file-command' as `--extra-init-command'.
	This should now only generated the extra entries in the `.init'
	file, not the whole file.

scripts/Mmake.vars.in:
compiler/modules.m:
	Allow $(EXTRA_INIT_COMMAND) as the Mmake equivalent
	of `--extra-init-command'. Append the output of
	$(EXTRA_INIT_COMMAND) to the `.init' file.

library/Mmakefile:
	Set EXTRA_INIT_COMMAND rather than overriding the
	libmer_std.init rule.
2002-07-29 07:51:07 +00:00
Simon Taylor
0c437e9ad0 Fix a bug -- the grade-specific `inc' directory
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
compiler/handle_options.m:
	Fix a bug -- the grade-specific `inc' directory
	for an installed library must be searched first.
	`.mih' files are installed into the non-grade-specific
	directory to avoid adding an extra entry in VPATH,
	but those files won't necessarily be the right ones
	for the current grade.
2002-07-15 07:03:53 +00:00
Simon Taylor
e3fd7e0c21 Pass INSTALL_PREFIX and LIBGRADES to mmc.
Estimated hours taken: 0.2
Branches: main

configure.in:
scripts/mmc.in:
	Pass INSTALL_PREFIX and LIBGRADES to mmc.
2002-07-05 13:51:06 +00:00
Simon Taylor
571e3318a1 In the presence of foreign code the .opt' and .trans_opt' files
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
compiler/modules.m:
	In the presence of foreign code the `.opt' and `.trans_opt' files
	aren't grade independent, so pass $(ALL_GRADEFLAGS) to mmc
	when creating them.
2002-06-26 08:20:58 +00:00
Simon Taylor
81db7bb118 My change to fix the handling of target specific MCFLAGS
Estimated hours taken: 1.5
Branches: main

My change to fix the handling of target specific MCFLAGS
variables didn't work with `--split-c-files'.

compiler/modules.m:
	Fix some bugs in the handling of `--split-c-files':

	- Make `--split-c-files' work where the module name doesn't
	  match the file name.

	- $(MCFLAGS-module) wasn't being passed to mmc when `module.dir/*.o'
	  were being rebuilt (it was being passed when the files were
	  being built from scratch).

scripts/Mmake.rules:
	The pattern rule for `%.dir/*.o' is now redundant, so remove it.
2002-06-25 14:24:10 +00:00
Simon Taylor
4c4530f72b The code to look up the target-specific MCFLAGS variable
Estimated hours taken: 1
Branches: main

scripts/Mmake.vars.in:
	The code to look up the target-specific MCFLAGS variable
	assumed that mmc is always invoked by a pattern rule, which
	isn't true if the module name doesn't match the file name.
2002-06-24 16:15:22 +00:00
Simon Taylor
9406f99f9d Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
Estimated hours taken: 5
Branches: main

Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
The tests don't work yet.

compiler/make.m:
compiler/make.module_target.m:
	Handle targets such as `<module>.cs' and `<module>.ints',
	which are used when building stage 3.

Mmake.common.in:
*/Mmakefile:
*/Mercury.options:
	Add Mercury.options files to pass module-specific flags to
	`mmc --make'.

	Avoid triggering the .DEFAULT rule introduced with `--use-mmc-make'
	for optional files like Mmake.params.

compiler/modules.m:
	Build the interface files when building a library in IL grades,
	for consistency with C grades.

library/Mmakefile:
	Improve performance by removing the dependency on the interface
	files when building the library. The files are now always built
	by the libmer_std target.

	Pass the command to build libmer_std.init to `mmc --make'.

tools/bootcheck:
	Add an option `--use-mmc-make'.

	Copy the Mercury.options files into the stage2 and stage3 directories.

scripts/Mmake.rules:
	Don't include the rules for `.dep' files with `--use-mmc-make'.

	Include the rule for `--convert-to-mercury' even with `--use-mmc-make'.

compiler/Mmakefile:
tools/bootcheck:
tools/binary_step:
	`mmc --make' doesn't handle `<module>_init.c' targets, so
	don't make the `cs' target depend on `top_level_init.c'.
	As far as I can tell, that dependency is only present so
	that the stage2 and stage3 compilers have the same set of
	C files. bootcheck and binary_step now only compare `.c'
	files which are present in the stage3 directory.
2002-06-22 19:16:15 +00:00
Simon Taylor
9e947575d6 Remove Prolog support.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Remove Prolog support.
2002-06-20 07:14:06 +00:00
Simon Taylor
0f2865b42b Avoid generating interface files for the library in
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	Avoid generating interface files for the library in
	the compiler directory by stripping the directory
	from the module name passed to mmc.
2002-06-10 07:03:14 +00:00
Simon Taylor
cc42c6d98a Fix a bug in my change to generate grade dependent header files.
Estimated hours taken: 0.25
Branches: main

Fix a bug in my change to generate grade dependent header files.
The `.mih' files weren't being installed for the default grade.

scripts/Mmake.rules:
	Run `lib<main_module>.install_grade_hdrs' for
	all grades, including the default grade.

Mmakefile:
library/Mmakefile:
	libmer_std.install_grade_hdrs is now run by
	libmer_std.install_library, so it doesn't
	need to be explicitly invoked here.
2002-05-31 07:02:37 +00:00
Simon Taylor
ac5c98bdaf Fix problems with the compiler-generated header files:
Estimated hours taken: 25
Branches: main

Fix problems with the compiler-generated header files:
1. the header files are grade dependent, but the header files
   can only be installed for one grade.
2. the generated header files can clash with system headers.

To solve these problems, the compiler now generates a
grade dependent `.mih' file containing the declarations
needed when a module is imported in a high-level C code
grade, and a grade independent `.mh' file, which contains
the prototypes for `:- pragma export' declarations.

compiler/export.m:
	Generate a `.mh' rather than a `.h' file for the `:- pragma export'
	declarations.

	Allow the header file generated by export.m to be used with
	`--high-level-code'.

compiler/modules.m:
library/Mmakefile:
	Add a module.install_grade_hdrs target to install the `.mih'
	files in a grade-dependent directory.

compiler/arg_info.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
	Make it easier to tell if the arg_info field of the proc_info
	has been set.

compiler/mlds_to_c.m:
	Include both the `.mh' and `.mih' files for imported modules.

	The type used as the return value for a semidet procedure
	exported to C is `MR_bool', not `MR_Word'.

compiler/mlds_to_c.m:
compiler/modules.m:
	Don't add a `mercury.' prefix to the standard library
	header file names. They can't clash with the system
	headers any more.

compiler/mercury_compile.m:
compiler/mlds_to_c.m:
	Use export.m to generate the header file for `:- pragma export'
	declarations even in hlc grades.

compiler/mlds.m:
compiler/ml*.m:
	Distinguish between the `.mh' and `.mih' files
	in `mlds__import's.

compiler/handle_options.m:
scripts/Mmake.vars.in:
scripts/mgnuc.in:
	Add C include directory options for the installed grade
	dependent `.mih' files.

Mmakefile:
scripts/Mmake.rules:
	s/h/mih/ in the commands to save the grade dependent
	files when installing the library grades.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.util.m:
	Handle dependencies on `.mh' and `.mih' files.

NEWS:
doc/user_guide.texi:
	Document the change.
2002-05-30 12:55:23 +00:00
Simon Taylor
efd28044af Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.
Estimated hours taken: 1
Branches: main

Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.

compiler/options.m:
doc/user_guide.texi:
	Add `--ml-flags' as a synonym for `--link-flags'.

	Add `--ld-flags' and `--ld-libflags', which are the
	options corresponding to the LDFLAGS and LD_LIBFLAGS
	Mmake variables.

	Add a comment that the `--output-file' option is
	ignored with `mmc --make'.

compiler/options_file.m:
	Handle LDFLAGS and LD_LIBFLAGS.

	Handle MLLIBS correctly. MLLIBS contains `-l' options
	(which can be handled by mmc), not flags for ml.

	The value of LIBRARIES (which contains Mercury libraries
	to link with) now comes before MLLIBS, because Mercury
	libraries depend on C libraries, but C libraries usually
	don't depend on Mercury libraries.

compiler/compile_target_code.m:
	Pass the value `--ldflags' or `--ld-libflags' to ml.

scripts/Mmake.vars.in:
	Add LDFLAGS and LD_LIBFLAGS to the options file
	passed to the options file passed to `mmc --make'
	on standard input.
2002-05-25 13:25:17 +00:00