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.
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.
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".
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.
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.
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.
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.
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.
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.
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'.
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.
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'.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Estimated hours taken: 2.5
Branches: main
Complete the support for building libraries with `mmc --make'.
compiler/make.m:
compiler/make.module_target.m:
compiler/mercury_compile.m:
compiler/compile_target_code.m:
Generate the `.pic_o' files needed to build shared libraries.
scripts/mmc.in:
Add `--pic-object-extension', `--create-archive-command'
`--create-archive-command-output-flag',
`--create-archive-commandflags' and `--ranlib-command'
options to DEFAULT_MCFLAGS.
Allow DEFAULT_MCFLAGS to be overridden in the environment,
for consistency with the other *FLAGS variables.
Estimated hours taken: 5
Branches: main
More changes to make `mmc --make' work with mmake.
scripts/Mmake.vars.in:
Pass MCFLAGS, CFLAGS, MLFLAGS, etc. to mmc in an options file
on standard input.
Don't add options for EXTRA_LIBRARIES to CFLAGS and MLFLAGS
when compiling with `mmc --make'. mmc handles those options
itself.
compiler/options.m:
compiler/options_file.m:
doc/user_guide.texi:
`--options-file -' now makes the compiler read an options
file from standard input.
Make `--options-file' behave as a standard accumulating option
rather than attempting to copy the behaviour of make's `-f' option.
s/--link_object/--link-object/
Mmake.workspace:
Put the `.a' files for the libraries in MLOBJS, not MLLIBS.
`mmc --make' will now relink when they change.
compiler/modules.m:
Link MLOBS into `module.split'.
tests/debugger/Mmakefile:
Create a Mercury.options file for use in compiling
the queries in interactive.m test.
Estimated hours taken: 0.1
Branches: main
scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
s/MC_MAKE_FILES/MC_BUILD_FILES/ as suggested by rafe.
Estimated hours taken: 2.5
Branches: main
Allow `mmc --make' to be used with Mmake.
scripts/mmake.in:
Add an option `--use-mmc-make', which tells mmake
to use `mmc --make' to build Mercury targets.
scripts/Mmake.vars.in:
Add a variable MC_MAKE_FILES, which should contain
files (e.g. generated header files) which should be
build with `mmc --make'.
Add a variable MERCURY_MAIN_MODULES which should
contain the top-level module names of the programs
or libraries in the directory. The targets for
the modules appearing in MERCURY_MAIN_MODULES
are added to MC_MAKE_FILES.
Add a variable MC_MAKE_FLAGS, which is like
MCFLAGS, but is only passed to `mmc --make'.
scripts/Mmake.rules:
Disable Mercury-specific rules when `--use-mmc-make'
is passed to mmake.
Use `mmc --make' for targets for which there are no
rules, or for targets appearing in MC_MAKE_FILES.
Estimated hours taken: 0.1
Branches: main
scripts/Mmake.rules:
Fix a bug with `--use-subdirs'. Mmake was looking for `.il' files
in the `Mercury/os' directory.
Estimated hours taken: 8
Branches: main
Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.
Mmake.workspace:
Similar to tools/lmc. Sets up Mmake variables to
use the library files in a workspace rather than
an installed library.
configure.in:
Check for the `--no-mercury-stdlib-dir' mmc option.
Bootstrap CVS tag: bootstrap_20020429_stdlib_dir
Mmake.common.in:
*/Mmakefile:
Move common code into Mmake.workspace.
browser/Mmakefile:
library/Mmakefile:
Avoid invoking the linker explicitly when creating
libraries of Mercury code. That won't work well
with `mmc --make'.
tools/bootcheck:
tests/Mmake.common:
Use Mmake.workspace instead of setting up environment
variables in bootcheck.
scripts/Mmake.vars.in:
mmc compiles split C files to object code itself,
so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
compiling with `--split-c-files'.
browser/interactive_query.m:
Use `mmc --make' when compiling the query. This is needed
to make tests/debugger/interactive_query.m work when linking
against a workspace using options rather than environment
variables. This also fixes a bug -- mmc options were being
passed to ml.
Clean up after the query.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
Generate the input file to this test so that MCFLAGS
and MC_MAKE_FLAGS (from Mmake.workspace) are used when
compiling queries.
tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
to allow the use of $(...) style command substitution
(`...` style command substitution can't be nested).
tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
Include tests/Mmake.common.
tools/*:
scripts/c2init.in:
scripts/ml.in:
Update the lists of files containing the library names.
Estimated hours taken: 0.1
Branches: main
Fix bugs in my change to improve the handling of linking
with a non-installed standard library.
scripts/mmake.in:
Export MERCURY_STDLIB_DIR.
scripts/Mmake.rules:
Always set MERC_INT_DIR to avoid undefined variable warnings.
Estimated hours taken: 6
Branches: main
Allow alternative locations for the standard library files
to be specified using options to the various Mercury scripts
rather than environment variables. This change is necessary
to allow the compiler to be compiled using `mmc --make', because
`mmc --make' does not support the environment variables.
All of the Mercury scripts now accept an option
`--mercury-standard-library-directory' to specify the installed
library to use, or `--no-mercury-standard-library-directory' to
disable the use of the installed library. The location
of the alternate files to use can then be specified
using ordinary options to the scripts.
There is a new environment variable MERCURY_STDLIB_DIR, which has
the same effect as the `--mercury-standard-library-directory' option.
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
scripts/mmc.in:
scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
Handle MERCURY_STDLIB_DIR and `--mercury-standard-library-directory'.
Remove support for the MERCURY_C_INCL_DIR, MERCURY_MOD_LIB_DIRS
and MERCURY_TRACE_LIB_DIRS environment variables -- they aren't
used anywhere. MERCURY_C_INCL_DIR is being removed because the
assumption it makes (that all header files are installed into
a single directory) will not hold for much longer because the
generated header files for hl* grades are grade dependent.
compiler/options.m:
compiler/compile_target_code.m:
Add an option `--trace-init-file', used to specify `.init'
files which should only be used when tracing is enabled,
such as browser/mer_browse.init.
Allow `--mercury-stdlib-dir' as an abbreviation for
`--mercury-standard-library-directory'.
tools/lmc:
Use options rather than environment variables.
doc/user_guide.texi:
Document MERCURY_STDLIB_DIR, MERCURY_TRACE_LIB_MODS
and the `--trace-init-file' mmc option.
Remove documentation for the no longer used MERCURY_C_INCL_DIR,
MERCURY_MOD_LIB_DIRS, MERCURY_TRACE_LIB_DIRS and
MERCURY_NC_BUILTIN environment variables.
Estimated hours taken: 0.25
Branches: main
scripts/mmc.in:
Pass the default options in the DEFAULT_MCFLAGS environment
variable, not on the mercury_compile command line. This allows
the options to be overridden by the setting of MCFLAGS in the
Mercury.options file (options on the command line override
options in the MCFLAGS variable).
Estimated hours taken: 500
Add an alternative implementation of Mmake as part of the compiler.
The advantages of this are
- more accurate dependencies
- no `mmake depend' step
- less process creation (no processes are created to
build interface files).
Still to do:
- handle --split-c-files
- handle the IL backend properly
- library installation
- allow the compiler to be built and the nightly tests
to be run with `mmc --make'
compiler/make.m:
Control the build process.
compiler/make.program_target.m:
Build executables and libraries.
compiler/make.module_target.m:
Build C files, object files, interface files etc.
compiler/make.dependencies.m:
Work out the depenendencies between targets.
compiler/make.module_dep_file.m:
Record the inter-module dependencies between invocations of mmc.
compiler/make.util.m:
Utility predicates used by `mmc --make'.
compiler/compile_target_code.m:
This module will eventually contain the predicates used
to compile the target code files generated by the compiler
which are now in mercury_compile.m. (That will be done
as a separate change for ease of reviewing).
For now compile_target_code.m
compiler/mercury_compile.m:
Export the predicates used to compile target code.
Call make.m.
Pass the name of the top-level module in the source file to modules.m.
It is needed when generating the `.module_dep' files.
Lookup the option defaults (which will eventually be stored in
DEFAULT_MCFLAGS by the mmc script) before compiling. Up until now
the option defaults have been passed on the command line by the
mmc script, but with `mmc --make' the default options need
to be overridden by the value of the MCFLAGS make variable, but
the MCFLAGS make variable is overridden by command line options.
Pass the value of `--link-flags' to c2init.
Remove some uninformative messages printed when a C, IL, etc.
compilation fails.
compiler/options_file.m:
Read files containing Make style variable assignments.
compiler/options.m:
doc/user_guide.texi:
Add a new options category: build system options.
Add some extra options:
--warn-undefined-options-variables - like mmake --warn-undefined-vars
--verbose-commands - print commands that the user might be
interested in, like C compilation, but not things
like mercury_update_interface.
--output-compile-error-lines - print the first n lines
of the error file generated by a command.
--generate-mmc-make-modules-dependencies - generate dependencies
for use by `mmc --make' even when using Mmake.
--il-assembler, --ilasm-flags, --mcpp-compiler, --mcpp-flags,
--csharp-compiler, --csharp-flags, --install-prefix,
--install-command, --libgrades, --options-files,
--options-search-directories.
compiler/modules.m:
Add fields to the `module_imports' type for use by make.*m.
Don't try to fill in fields of the module_imports structure
lazily. It's error prone, and probably doesn't save much
anyway.
Clean up the code to compute what foreign languages
are used by a list of item.
Simplify the handling of fact tables by recording that a module
containing fact tables has foreign code to implement them,
rather than requiring separate checks everywhere.
Generalise predicates like get_interface so that they
work even after the imported items have been read.
Fix the handling of header files with the LLDS backend.
Install the `.module_dep' files created for use by
`mmc --make'.
compiler/*.m:
Use record syntax rather than explicit deconstruction to
refer to fields of the `module_imports' type.
compiler/*.m:
Be more careful about where output goes.
mercury_compile.m sets the output stream to be io__stderr_stream
at the start of compilation, so remove all explicit writes to
io__stderr_stream (with `--make' the error output stream may be
a `.err' file, not io__stderr_stream).
Change all occurrences of io__tell/io__told to use
io__open_output/io__close_output (io__told restores the current
output stream to io__stdout_stream, not the previous value).
compiler/passes_aux.m:
Make the output from system commands go to the current
output stream, not C stdout and stderr.
Allow commands to be printed with `--verbose-commands'.
Remove uninformative error messages when a command fails.
compiler/timestamp.m:
Add functions oldest_timestamp and newest_timestamp.
compiler/llds_out.m:
Record the number of C files written with `--split-c-files'
in <module>.num_split.
compiler/prog_io.m:
compiler/*.m:
`search_for_file' now returns the directory in which the
file was found.
compiler/foreign.m:
Use sub-typing to make some calls to predicates in this
module `det' rather than `semidet'.
compiler/handle_options.m:
Return the option arguments.
compiler/Mmakefile:
make.util.m refers to kill() and `struct sigaction' which
are not exported from <signal.h> unless `--no-ansi' is
passed to gcc.
compiler/notes/compiler_design.html:
Document the new modules.
runtime/mercury_signal.h:
runtime/mercury_signal.c:
Add a function MR_signal_should_restart() which alters
whether a signal restarts or interrupts system calls.
In general restarting is the preferred behaviour, but
the wait() for a child process needs to be interruptible.
scripts/Mmake.vars.in:
Add subdirs for `.module_dep', `.err_date'
and `.num_split' files.
library/io.m:
Add a version of io_call_system which returns the signal
that killed the command rather than converting it into
an error message.
Add a predicate to interpret the result of system() or wait().
library/list.m:
Add list__map_foldl2 and a unique mode for list__foldl3.
NEWS:
Document the new library predicates.
configure.in:
runtime/mercury_conf.h.in:
Check for siginterrupt().
doc/user_guide.texi:
Document the new options.
Add a description of `mmc --make' to the "Using Mmake" chapter.
Estimated hours taken: 0.25
Branches: main
Finish bootstrapping the --dotnet-library-version change.
This has been tagged with bootstrap_20020311_dotnet_library_version.
configure.in:
Check that we accept --dotnet-library-version on the mmc
command line.
scripts/mmc.in:
Pass the autoconfed --dotnet-library-version to
mercury_compile.
Estimated hours taken: 2.5
Branches: main
Configure the version of the .NET std library that we are using instead
of hard-coding it in the compiler.
aclocal.m4:
Find the version number of the mscorlib assembly and record it in
MS_DOTNET_LIBRARY_VERSION.
compiler/mlds_to_il.m:
doc/user_guide.texi:
Use and document the option --dotnet-library-version. This option
is used to determine what version of the .NET standard libraries
that we are using.
compiler/mlds_to_il.m:
We no longer need to hard-code the hash for the mscorlib.dll.
scripts/mmc.in:
Use the autoconfigured MS_DOTNET_LIBRARY_VERSION to set the
--dotnet-library-version. This is commented out for the moment
until this change bootstraps.
Estimated hours taken: 1
Branches: main
scripts/Mmake.vars.in:
Fix an Mmake bug which broke tests/hard_coded/integer_test and
tests/hard_coded/rational_test in grade asm_fast when built with
--use-subdirs. The problem was that target-specific variable
definitions where not getting set correctly when building the
*_init.c file, because various references to `%_init.c' in this
file should have been `$(cs_subdir)%_init.c'.
Estimated hours taken: 2
Branches: main
Add Mmake support for the Java back-end.
XXX TODO: Document it.
compiler/modules.m:
Add rules for generating `foo.javas' and `foo.classes' targets
and variables.
scripts/Mmake.rules:
compiler/modules.m:
Add rules for building .java, .java_date, and .class files.
scripts/Mmake.vars.in:
Add variables JAVAC, ALL_JAVACFLAGS, JAVACFLAGS, EXTRA_JAVACFLAGS,
TARGET_JAVACFLAGS, LIB_JAVACFLAGS, javas_subdir, java_dates_subdir,
and classes_subdir.
Also add some comments.
Estimated hours taken: 1.5
Branches: main
Avoid problems with very long command lines by using xargs.
compiler/modules.m:
Use xargs to rm all the files for the clean and realclean targets.
scripts/mmake.in:
Use xargs to cat the .d and .dv files.
Estimated hours taken: 0.5
Fix Mmake's handling of linker options.
scripts/Mmake.vars.in:
Add Mmake variables LDFLAGS, used for linker flags for
executables, and LD_LIBFLAGS, used for linker flags for
shared libraries. The separate variables are need because
on some architectures `ml' invokes the C compiler, but
`ml --make-shared-lib' invokes the linker directly.
Put `--' before CFLAGS in the construction of ALL_MGNUCFLAGS
to avoid confusion between C compiler options and mgnuc
options.
compiler/modules.m:
Pass LDFLAGS and LD_LIBFLAGS to ml.
doc/user_guide.texi:
Document CFLAGS, LDFLAGS and LD_LIBFLAGS.
scripts/parse_ml_options.sh_subr.in:
scripts/ml.in:
Define options `--print-link-command' and
`--print-shared-lib-link-command', which print
the commands ml uses to link executables and
shared libraries.
Estimated hours taken: 10
Improve the handling of the mdb's `--window' option.
`mdb --window' now creates a window for mdb, not the program.
The main advantage of this is that redirection of the program's
input and output now works. The new behaviour should also be
implementable using the Windows API. The old behaviour is still
available with `mdb --program-in-window'.
Unfortunately, the code to open a pseudo-terminal for mdb's I/O
isn't very portable. It works on everything we run nightly tests on,
but isn't likely to work on older systems or BSD systems.
NEWS:
Document the change.
scripts/mdb.in:
Handle the new behaviour of `--window'.
Add `--program-in-window'.
trace/mercury_trace_internal.c:
If `--window' was passed in MERCURY_OPTIONS, redirect
mdb's I/O to a window created using `xterm -S'.
Rename occurrences of `close' to avoid gcc warnings.
runtime/mercury_trace_base.h:
runtime/mercury_trace_base.c:
Kill the mdb window on exit.
runtime/mercury_wrapper.h:
runtime/mercury_wrapper.c:
Add a runtime options `--mdb-in-window' for use by the mdb script.
runtime/mercury_signal.h:
runtime/mercury_signal.c:
Add a version of MR_setup_signal which doesn't cause
system calls to be restarted after a signal is received.
This is needed to allow a read() from the mdb window
to timeout if the window failed to start.
Add functions to get and set the action for a given signal.
configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES.
Check for functions open, close, dup, dup2, fdopen, setpgid,
fork, execlp, wait, kill, grantpt, unlockpt, pstname, tcgetattr,
tcsetattr and ioctl.
Check for type pid_t.
Check for header files <fcntl.h>, <termios.h>, <sys/ioctl.h>,
<sys/stropts.h>.
Check for /dev/ptmx, used to open pseudo-terminals.
runtime/mercury_misc.c:
runtime/mercury_misc.h:
Add MR_mdb_warning, which prefixes messages from the
debugger with "mdb: ".
Add MR_perror and MR_mdb_perror, which are versions
of perror which prefix the printed message with
"Mercury runtime: " and "mdb: " respectively.
runtime/mercury_prof_time.c:
runtime/mercury_prof.c:
runtime/mercury_memory_handlers.c:
Don't prefix error messages passed to MR_setup_signal
with "Mercury runtime:". MR_setup_signal now uses
MR_perror.
Estimated hours taken: 1.5
Branches: main
Allow Mercury runtime options to be set at compile time.
scripts/parse_ml_options.sh-subr.in:
Add an initialization option `--runtime-flags'.
runtime/mercury_wrapper.h:
Add a global variable MR_runtime_flags.
util/mkinit.c:
Set MR_runtime_flags.
runtime/mercury_wrapper.c:
Add the value of MR_runtime_flags to the dummy
command line passed to getopt().
tests/hard_coded/Mmakefile:
Use `--runtime-flags' rather than MERCURY_OPTIONS.
Estimated hours taken: 0.1
Branches: main
scripts/Mmake.rules:
Remove some unused code left over from an old method
of handling dependencies on MLOBJS.
Estimated hours taken: 0.5
Branches: main
Allow MLOBJS-module Mmake variables.
scripts/Mmake.vars.in:
Define TARGET_MLOBJS, ALL_MLOBJS and ALL_MLPICOBJS.
scripts/Mmake.rules:
compiler/modules.m:
Use ALL_MLOBJS and ALL_MLPICOBJS instead of
MLOBJS and MLPICOBJS.