Estimated hours taken: 70
Branches: main
Add Java support to the foreign language interface.
mercury/compiler/compile_target_code.m:
mercury/compiler/make.module_target.m:
mercury/compiler/mercury_compile.m:
Pass `compile_java_file' a Java filename rather than a module name.
mercury/compiler/globals.m:
Add `java' as a `foreign_language'.
mercury/compiler/handle_options.m:
Allow Java as a back-end foreign language if the target language
is Java.
mercury/compiler/hlds_data.m:
Allow Java foreign_types.
mercury/compiler/intermod.m:
mercury/compiler/foreign.m:
mercury/compiler/make.util.m:
mercury/compiler/make_hlds.m:
mercury/compiler/mercury_compile.m:
mercury/compiler/mercury_to_mercury.m:
mercury/compiler/ml_code_gen.m:
mercury/compiler/mlds.m:
mercury/compiler/mlds_to_c.m:
mercury/compiler/mlds_to_il.m:
mercury/compiler/mlds_to_ilasm.m:
mercury/compiler/mlds_to_java.m:
mercury/compiler/pragma_c_gen.m:
mercury/compiler/prog_data.m:
mercury/compiler/prog_io_pragma.m:
Add or modify existing code to support `java' as a `foreign_language'
and Java `foreign_type's.
mercury/compiler/mlds_to_java.m:
Nicely indent the generated code that unboxes arguments from
return-argument arrays which are used for methods with multiple
return arguments.
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.
Estimated hours taken: 28
Branches: main
Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.
This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.
Various fixes were also added so that `mmc --make --grade il' could make
an executable.
compiler/compile_target_code.m:
Change il_assemble so that we always build a .dll version
irrespective of whether it contains main or not, as MC++ or C#
code may refer to the dll.
Add Mercury/dlls to the search path for the C# and MC++
compilers.
s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
understand / as a directory seperator.
Add the referenced dlls to the C# compilers command line.
Export maybe_pic_object_file_extension.
compiler/handle_options.m:
Fix a bug where copmute_grade incorrectly generated `hl.il'
instead of `il' as the grade name because we weren't always
considering the --target option.
compiler/make.m:
Add to the compilation_task_type type the alternatives
foreign_code_to_object_code and fact_table_foreign_code_file.
Add to the module_target_type type the alternatives
foreign_asm, foreign_object and factt_object.
compiler/make.dependencies.m:
Add code to handle the new module_target_type alternatives.
Add code to build the new alternatives to
compilation_task_type.
compiler/make.module_target.m:
Add rules to build the foreign_code_to_object_code and
fact_table_code_to_object_code.
compiler/make.program_target.m:
Determine the targets needed to be built for all the external
foreign files and add them to build target list.
compiler/make.util.m:
Add code to handle the new module_target_type alternatives.
Change write_target_file to output the correct name when
building the foreign_asm and foreign_object targets.
compiler/modules.m:
Move referenced_dlls into the interface for use by
`compile_target_code.m'.
Don't place dlls in a sub-directory because on the IL backend
the dlls are `part' of the executable file.
Add a `MkDir' argument to fact_table_file_name which
optionally creates a directory to store the generated
file_name in.
tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
Add a test case.
Estimated hours taken: 28
Branches: main
Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.
This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.
Various fixes were also added so that `mmc --make --grade il' could make
an executable.
compiler/compile_target_code.m:
Change il_assemble so that we always build a .dll version
irrespective of whether it contains main or not, as MC++ or C#
code may refer to the dll.
Add Mercury/dlls to the search path for the C# and MC++
compilers.
s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
understand / as a directory seperator.
Add the referenced dlls to the C# compilers command line.
Export maybe_pic_object_file_extension.
compiler/handle_options.m:
Fix a bug where copmute_grade incorrectly generated `hl.il'
instead of `il' as the grade name because we weren't always
considering the --target option.
compiler/make.m:
Add to the compilation_task_type type the alternatives
foreign_code_to_object_code and fact_table_foreign_code_file.
Add to the module_target_type type the alternatives
foreign_asm, foreign_object and factt_object.
compiler/make.dependencies.m:
Add code to handle the new module_target_type alternatives.
Add code to build the new alternatives to
compilation_task_type.
compiler/make.module_target.m:
Add rules to build the foreign_code_to_object_code and
fact_table_code_to_object_code.
compiler/make.program_target.m:
Determine the targets needed to be built for all the external
foreign files and add them to build target list.
compiler/make.util.m:
Add code to handle the new module_target_type alternatives.
Change write_target_file to output the correct name when
building the foreign_asm and foreign_object targets.
compiler/modules.m:
Move referenced_dlls into the interface for use by
`compile_target_code.m'.
Don't place dlls in a sub-directory because on the IL backend
the dlls are `part' of the executable file.
Add a `MkDir' argument to fact_table_file_name which
optionally creates a directory to store the generated
file_name in.
tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
Add a test case.
Estimated hours taken: 0.25
Branches: main, release
compiler/make.module_target.m:
compiler/modules.m:
Address some review comments from stayl from a long time ago.
Estimated hours taken: 1
Branches: main
With `--make', warn if a target specified on the command line
is already up to date.
compiler/make.util.m:
Check whether a target that was found to be up to date
was specified on the command line.
compiler/make.m:
Add the targets specified on the command line to the make_info.
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.dependencies.m:
Call make__util__maybe_warn_up_to_date_target when a target
is found to be up to date.
Remove targets from the list of targets specified on the command
line as they are processed to avoid generating multiple warnings.
compiler/options.m:
doc/user_guide.texi:
Add an option `--no-warn-up-to-date'.
tests/warnings/Mmakefile:
tests/warnings/up_to_date.{m,exp}:
Test case.
Estimated hours taken: 2
Branches: main
Fix bugs in `--rebuild'.
compiler/compile_target_code.m:
Always recompile the `module_init.c' file with `--rebuild'.
compiler/handle_options.m:
The code to make `--rebuild' imply `--make' was after some
uses of the value of `--make', in particular the code to
make `--make' imply `--use-subdirs'.
compiler/make.dependencies.m:
compiler/make.program_target.m:
compiler/make.module_target.m:
Add a sanity check to make sure that all files that should
have been produced when building a target have been produced,
and reporting a proper error message if they have not.
Estimated hours taken: 2
Branches: main
Fix quoting of arguments to commands invoked by mmc.
compiler/compile_target_code.m:
compiler/make.module_target.m:
Quote arguments passed to commands.
compiler/options_file.m:
Pass each word in the value of CFLAGS (MLFLAGS, etc) as a
separate `--cflag' option so it can be quoted correctly.
NEWS:
compiler/options.m:
doc/user_guide.texi:
For each `--Xflags' option, add a `--Xflag' option which
quotes its argument if necessary then adds it to
the `--Xflags' option.
Estimated hours taken: 0.5
Branches: main
When intermodule optimization is enabled make the .o file depend on all
the possible imported .mh files. This avoids unneccessary recompilation
because the .mh files are less likely to change, as well as a directory
search for .m files.
compiler/export.m:
Always produce a .mh file because intermodule optimization relies on
it.
compiler/modules.m:
Make the .o file depend on all the possible .mh files which could be
imported when intermodule optimization is enabled.
compiler/modules.m:
compiler/make.module_target.m:
Correctly calculate the set of .mh files.
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: 3
Branches: main
Fix the handling of header files with `mmc --make'.
compiler/make.module_target.m:
Check that all files made by the command are present
(for example, previously only the `.c_date' files were
checked, not the `.c' files).
compiler/make.util.m:
In high-level C grades, don't rebuild the `.o' file if an
irrelevant part of a `.mih' file has changed. If a relevant
part of a `.mih' file changed, the interface files of the
imported module must have changed in a way that would force
the `.c' and `.o' files of the current module to be rebuilt.
When finding the timestamps for header files, make sure
the current directory is searched.
Header files are created using mercury_update_interface,
so to check whether a header file is up to date we need
to check the timestamp on the `.c_date' or `.s_date' file,
not the header file itself.
compiler/make.dependencies.m:
Add some more debugging messages.
Fix the format of some error messages.
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: 3
Handle `mmc --make lib<module>' target, which builds all the files
required to use a library in the current grade.
compiler/make.m:
Check for `lib<module>' when attempting to classify a target.
compiler/make.program_target.m:
compiler/compile_target_code.m:
Make `.init' files when building the `.a' file.
Invoke the command given by `--pre-link-command' before linking.
compiler/make.module_target.m:
compiler/make.util.m:
Move find_oldest_timestamp into make.util.m for
use by make.program_target.m.
compiler/options.m:
doc/user_guide.texi:
Add an option `--make-init-file-command', to specify an
alternative command to make the `.init' file. This is needed
for the standard library.
Add an option `--pre-link-command', which specifies a
command to be run before linking. This is useful if there
are foreign files which depend on headers produced by
the Mercury compiler.
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: 1
Branches: main
compiler/make.module_target.m:
The `.int0' file for a module depends on the `.int0' file for the
parent module, which caused circular dependencies with nested
sub-modules, resulting in a compiler abort. The circular dependencies
are now removed from the list of dependencies to make.
Test case: tests/valid/foreign_type_spec.m.
The main aim of this change is to make the overall, high-level structure
of the compiler clearer, and to encourage better encapsulation of the
major components.
compiler/libs.m:
compiler/backend_libs.m:
compiler/parse_tree.m:
compiler/hlds.m:
compiler/check_hlds.m:
compiler/transform_hlds.m:
compiler/bytecode_backend.m:
compiler/aditi_backend.m:
compiler/ml_backend.m:
compiler/ll_backend.m:
compiler/top_level.m:
New files. One module for each of the major components of the
Mercury compiler. These modules contain (as separate sub-modules)
all the other modules in the Mercury compiler, except gcc.m and
mlds_to_gcc.m.
Mmakefile:
compiler/Mmakefile:
Handle the fact that the top-level module is now `top_level',
not `mercury_compile' (since `mercury_compile' is a sub-module
of `top_level').
compiler/Mmakefile:
Update settings of *FLAGS-<modulename> to use the appropriate
nested module names.
compiler/recompilation_check.m:
compiler/recompilation_version.m:
compiler/recompilation_usage.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/recompilation.version.m:
Convert the `recompilation_*' modules into sub-modules of the
`recompilation' module.
compiler/*.m:
compiler/*.pp:
Module-qualify the module names in `:- module', `:- import_module',
and `:- use_module' declarations.
compiler/base_type_info.m:
compiler/base_type_layout.m:
Deleted these unused empty modules.
compiler/prog_data.m:
compiler/globals.m:
Move the `foreign_language' type from prog_data to globals.
compiler/mlds.m:
compiler/ml_util.m:
compiler/mlds_to_il.m:
Import `globals', for `foreign_language'.
Mmake.common.in:
trace/Mmakefile:
runtime/Mmakefile:
Rename the %.check.c targets as %.check_hdr.c,
to avoid conflicts with compiler/recompilation.check.c.
Estimated hours taken: 1.5
Branches: main
Rearrange some code after the `--make' change. This was not done
as part of that change for ease of reviewing.
compiler/mercury_compile.m:
compiler/compile_target_code.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Move code to compile the generated code into compile_target_code.m.
compiler/make.util.m:
compiler/passes_aux.m:
compiler/process_util.m:
Move process and signal handling functionality into process_util.m.
compiler/Mmakefile:
Compile process_util.c with `--no-ansi' so that the declarations
of `struct sigaction' and `kill' are available on Linux.
compiler/notes/compiler_design.html:
Document compile_target_code.m and process_util.m.
Move timestamp.m into the "Miscellaneous" section (it's
used by make as well as smart recompilation).
Fix the documentation of options_file.m.
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.