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 ours taken: 0.5
Branches: main, release
compiler/compile_target_code.m:
Fix bug where `mmc --target asm --pic' was not naming the output
file as `.o' rather than `.pic_o'.
Estimated hours taken: 0.75
Branches: main, release
compiler/compile_target_code.m:
Fix bugs where `mmc --target asm --pic' was not passing the
correct options to gcc.
Estimated hours taken: 0.5
Branches: main, release
compiler/compile_target_code.m:
Fix bugs in the code to link executables and libraries
created with `--use-grade-subdirs' into the user's
directory.
tests/grade_subdirs/Mmakefile:
Check that building libraries with `--use-grade-subdirs'
works.
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.
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.
Estimated hours taken: 0.25
Branches: main, release
compiler/compile_target_code.m:
Apply a patch to the MSVC command line for compiling
Managed C++, which Fergus previous applied in Mmake.rules -
s/-link -noentry mscoree.lib -dll/\/LD/
Fill in the options for debugging for .NET compilers.
Fix missing spaces in command lines.
Estimated hours taken: 2.5
Branches: main
Improve the handling of `--use-grade-subdirs' so that it can
be documented.
compiler/compile_target_code.m:
With `--use-grade-subdirs', link or copy executables
and libraries into the user's directory.
compiler/make.program_target.m:
compiler/modules.m:
Move code to create a symlink into modules.m, next to
the code to create directories (all of this should really
go in the standard library).
Add a predicate to copy a file (which should also go
in the standard library).
compiler/make.program_target.m:
Make the realclean target delete the symlinks or copies
of executables and libraries.
NEWS:
library/io.m:
Add io__binary_input_stream_foldl, etc. for use in copying files.
NEWS:
compiler/options.m:
doc/user_guide.texi:
Document `--use-grade-subdirs'.
tests/Mmakefile:
tests/grade_subdirs:
tests/grade_subdirs/Mmakefile:
tests/grade_subdirs/Mercury.options:
tests/grade_subdirs/hello.{m,exp}:
Test case.
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.
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: 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: 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: 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: 12
Branches: main
Optimize shallow traced modules by not adding calls to MR_trace to shallow
traced procedures which cannot be called from a deep traced environment.
A shallow traced procedure can be optimized in this way if it is neither
exported from its defining module nor has its address taken.
The main purpose of this optimization is not the avoidance of the cost of the
MR_trace calls as much as it is the restoration of tail recursion optimization.
Previously, compiling a program in a debug grade would disable all tail
recursion in the program (since debug grades require at least shallow tracing
every module). This was a problem because it limited the sizes of the inputs
the debugged program could process before running out of memory. As long as
the procedures that recurse on the input are in the implementation section
of a shallow traced module, this should no longer happen.
compiler/trace_params.m:
Introduce the concept of a procedure's effective trace level. This is
identical to the global trace level, except if the procedure is not
exported and doesn't have its address taken, and the global trace level
is shallow. In that case, we say that the procedure's effective trace
level is none.
Computing a procedure's effective trace level requires its proc_info
and its parent pred_info, so require callers to supply these as
parameters.
compiler/code_info.m:
Store the current pred_info as well as the current proc_info, for
trace parameter lookups.
compiler/continuation_info.m:
compiler/code_gen.m:
Record the required trace parameters of a procedure in its layout
structure, since it can no longer be computed from the global trace
level.
compiler/stack_layout.m:
Use the trace parameters in procedures' layout structures, instead of
trying to compute them from the global trace level.
compiler/inlining.m:
compiler/liveness.m:
compiler/stack_alloc.m:
compiler/store_alloc.m:
compiler/trace.m:
Use procedures' effective trace level instead of the global trace level
where relevant.
compiler/llds.m:
Record the required trace parameter of a procedure in its c_procedure
representation, since it can no longer be computed from the global
trace level.
Delete an obsolete field.
compiler/optimize.m:
compiler/jumpopt.m:
Use a required trace parameter of a procedure in its c_procedure
representation, since it can no longer be computed from the global
trace level.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
Trivial changes to conform to updated interfaces.
compiler/stack_opt.m:
Use the option opt_no_return_calls, instead of approximating it
with the trace level. (The old code was a holdover from before the
creation of the option.)
tests/debugger/shallow.m:
tests/debugger/shallow2.m:
tests/debugger/shallow.{inp,exp*}:
Divide the old test case in shallow.m in two. The top level predicates
stay in shallow.m and continue to be shallow traced. The two bottom
predicates move to shallow2.m and are now deep traced.
The new test input checks whether the debugger can walk across the
stack frames of procedures in shallow traced modules whose effective
trace level is "none" (such as queen/2).
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.5
Branches: main
Clean up the handling of the exit status in the compiler.
This doesn't fix any known bugs, but may prevent new ones.
compiler/passes_aux.m:
Don't set the exit status to 1 if a system command fails. That
should be done by a caller if the failed command means that the
compilation as a whole fails.
Add a predicate maybe_set_exit_status to set the exit status
to 1 if the boolean argument representing the success or failure
of a command is `no'.
compiler/compile_target_code.m:
Don't set the exit status if a compilation fails -- leave
that the mercury_compile.m.
compiler/mercury_compile.m:
Call maybe_set_exit_status to check the result of target
code compilations.
Estimated hours taken: 0.1
Branches: main
compiler/passes_aux.m:
compiler/compile_target_code.m:
compiler/mercury_compile.m:
Back out my last change. I thought I had sent it for
review, but I can't find the message in the archive.
Estimated hours taken: 0.5
Branches: main
Clean up the handling of the exit status. This doesn't fix any
known bugs, but may prevent new ones.
compiler/passes_aux.m:
Don't set the exit status to 1 if a system command fails. That
should be done by a caller if the failed command means that the
compilation as a whole fails.
Add a predicate maybe_set_exit_status to set the exit status
to 1 if the boolean argument representing the success or failure
of a command is `no'.
compiler/compile_target_code.m:
Don't set the exit status if a compilation fails -- leave
that the mercury_compile.m.
compiler/mercury_compile.m:
Call maybe_set_exit_status to check the result of target
code compilations.
Estimated hours taken: 2.5
Branches: main
Recently I changed the interactive query facility in the debugger
to use `mmc --make' to build the shared library containing the query.
There were two problems with this. The entire program was included in
the shared library, not just the query module. Also, invoking
`mmc --make query.realclean' cleaned up the user's files.
compiler/options.m:
compiler/compile_target_code.m:
Add an option `--compile-to-shared-lib', which causes
mmc to package the modules on the command line into
a shared library, not an executable. This option is
intended only for use by browser/interactive_query.m,
so it isn't documented.
browser/interactive_query.m:
Use `mmc --compile-to-shared-lib', not `mmc --make'
to build the query shared library.
Name the query source file mdb_query.m rather than query.m
to reduce the chance of overwriting a user's file.
tests/debugger/Mmakefile:
Use `lmc' to compile the query if `WORKSPACE' is set,
rather than using a Mercury.options file to set up
for the workspace.
tests/debugger/interactive.exp:
Update expected output.
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: 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: 0.1
Branches: main
compiler/compile_target_code.m:
- % Are we generating position indepedent code (for use in a
+ % Are we generating position independent code (for use in a
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: 0.25
Branches: main
compiler/compile_target_code.m:
compiler/make.program_target.m:
compiler/make.util.m:
Put the `lib' prefix on the filenames for `.a' and `.so' files.
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.
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.