Estimated hours taken: 1
Branches: main
Make smart recompilation work where the module name doesn't
match the file name (e.g. in the compiler).
compiler/modules.m:
Where the module name doesn't match the file name
and there is a Mercury.modules file, pass the
module name to mmc, not the file name.
compiler/source_file_map.m:
Add a predicate `have_source_file_map' for use
by modules.m.
Don't put the Mercury.modules file in the Mercury
subdirectory. It's the user's responsibility to clean
it up, so it should be in the main directory.
compiler/mercury_compile.m:
Suggest creating the Mercury.modules file if passed
a file name which doesn't match the module name.
compiler/Mmakefile:
browser/Mmakefile:
Generate the Mercury.modules file.
tests/hard_coded/Mmakefile:
The Mercury.modules file is no longer generated in
the Mercury subdirectory.
Estimated hours taken: 0.5
Branches: main
Fix a problem triggered by Zoltan's recent pseudo-typeinfo RTTI changes,
which resulted in a link error when building the gcc back-end.
compiler/Mmakefile:
Define MR_NO_BACKWARDS_COMPAT rather than MERCURY_BOOTSTRAP_H.
This is needed because runtime/mercury_bootstrap.h now contains
stuff that is there for reasons other than bootstrapping(!).
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.
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.
Estimated hours taken: 0.1
compiler/Mmakefile:
Fix a bug in the clean target. When a generated `.m' file
is removed the corresponding `.pp_date' file needs to be
removed as well.
Estimated hours taken: 0.1
Branches: main, release
compiler/Mmakefile:
Make sure the `Mercury/dates' directory exists before
attempting to add `.pp_date' files to it.
Estimated hours taken: 0.25
Fix a bug which caused problems when trying to bootstrap from the source
distribution.
compiler/Mmakefile:
Build mlds_to_gcc.c and gcc.c rather than mlds_to_gcc.err and gcc.err.
Make the `cs' target, which is used by the `tar' target in ../Mmakefile,
depend on mlds_to_gcc.c and gcc.c.
Estimated hours taken: 0.5
Branches: main
Fix a problem that used to cause installs into not-yet-created directories
to fail.
scripts/Mmake.rules:
Instead of invoking $(MC) --errorcheck-only when creating .err files,
invoke the macros $(MCE).
scripts/Mmake.vars:
Define the default value of $(MCE) as $(MC) --errorcheck-only.
compiler/Mmakefile:
Override the default value of $(MCE) to specify the search path,
just as all the other invocations of the Mercury compiler in this
directory do. The absence of such override could lead to a raft
of messages about interface files not being found when trying to
create maybe_mlds_to_gcc.err.
Estimated hours taken: 0.25
Branches: main
compiler/Mmakefile:
Fix a bug in my previous change:
*.depend targets must *not* be declared .PHONY,
since doing that suppresses the implicit rule search.
Estimated hours taken: 0.5
Branches: main
compiler/Mmakefile:
Make sure that mlds_to_gcc.m and gcc.m get compiled by the
Mercury compiler, even if the GCC back-end isn't enabled.
This is to reduce the likelihood of people making changes
that break the GCC back-end.
Estimated hours taken: 1
Branches: main
compiler/Mmakefile:
Back out previous change, i.e. reinstate the code to pass the
C compiler options needed for the GCC back-end when compiling
mlds_to_gcc.m. Even though mlds_to_gcc.m no longer contains any
C code that references the GCC back-end headers, this still seems
to be needed, at least at higher optimization levels, because
compiler/mlds_to_gcc.c includes compiler/gcc.h.
Estimated hours taken: 2
Branches: main
Clean up some of the code in the GCC back-end.
compiler/gcc.m:
compiler/mlds_to_gcc.m:
Move the code for initializing the GCC back-end and calling
back to the Mercury front-end from mlds_to_gcc.m to gcc.m, at the
same time generalizing it (the callback procedure is now passed
as a parameter to gcc__run_backend, rather than being hard-coded).
This changes means that all of the code for interfacing with
GCC is now in gcc.m, and mlds_to_gcc.m only talks to GCC via
that interface.
compiler/Mmakefile:
There's no longer any need to pass the CFLAGS options needed
for GCC when compiling mlds_to_gcc.m.
Estimated hours taken: 20
Various fixes to get the GCC back-end interface to bootstrap.
library/exception.m:
Define function versions of mercury__exception__builtin_catch_3_p_*.
This is needed (a) in case we take their address, and (b) for the
GCC back-end interface, where we can't use C macros, since we're
compiling to assembler.
browser/dl.m:
browser/util.m:
browser/interactive_query.m:
compiler/stack_layout.m:
Add #includes for header files needed by these modules.
browser/dl.m:
Delete an unnecessary nested extern declaration, to avoid
a warning from `gcc -Wshadow'.
compiler/mlds_to_gcc.m:
When calling mlds_to_c to process foreign_code, make all
definitions public, so that the can be used from the assembler
code that we generate in mlds_to_gcc.
Don't call mlds_to_c to generate `.c' and `.h' files if the
module contains only `pragma foreign_decls', not `pragma
foreign_code', `pragma foreign_proc', or `pragma export'.
This change is needed to avoid calling mlds_to_c when
intermodule optimization is enabled and `pragma c_header_code'
declarations have been read in from the `.opt' file and have
propagated through to the MLDS. Calling mlds_to_c when the
module itself doesn't contain C code breaks things, since
Mmake won't compile and link in the generated `.c' files, but
those files contain the definition of the `*__init_type_tables()'
functions that are referenced by `*_init.c'.
XXX This is not quite right, since if the module itself contains
`pragma foreign_decls', the `.h' file might be needed.
But the Mercury standard library needs intermodule optimization
enabled for `make install' to work.
A better fix would be to ignore foreign_decls that were defined
in other modules, but to call mlds_to_c for foreign_decls
that were defined in the module that we're compiling.
compiler/modules.m:
Change the code which decides when to link in extra object files
for foreign code to reflect the above change to when mlds_to_gcc.m
invokes mlds_to_c.m.
compiler/mlds_to_c.m:
When target=asm, i.e. we're compiling to asm, but mlds_to_c.m
has been invoked to generate C code for a `foreign_code',
`foreign_proc', or `pragma export' declaration, don't generate
#include directives for the imported modules, since we may not
have generated any header file for them.
XXX This is a bit of a hack; it might sometimes lead to
problems, since the header files might sometimes be needed.
But including them unconditionally is definitely wrong,
since they may not exist, and so this change is needed to get
the compiler to bootstrap.
compiler/Mmakefile:
Add a dependency of mercury_compile on $(GCC_BACK_END_LIBS),
so that we know to relink it if the GCC back-end has changed.
(That variable is set to empty if we're not linking in the GCC
back-end, so it won't cause problems when not using the GCC
back-end.)
library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
Add an `ss' target, for use by tools/bootcheck.
tools/bootcheck:
Add `--target asm' option. If that is set, pass `--target asm'
to mmake, and build and compare the stage 3 `.s' files rather
than the `.c' files.
Also add `--make-opts' option, for passing options to `make'.
Put `-k' in `--make-opts', not `--mmake-opts', since `-k' is
an option to `make', not to `mmake'. This makes a difference
since although `make' options can be passed to `mmake', any
options after the first `make' option are assumed to be
options to `make', not to `mmake'.
Estimated hours taken: 0.75
Fix some problems that broke the GCC back-end interface
when the compiler was builtin in hlc* grades.
compiler/gcc.m:
compiler/mlds_to_gcc.m:
Add a macro guard around the #includes of the GCC
headers, since the GCC headers aren't safe against
multiple inclusion.
#include the GCC headers using "gcc/" prefixes.
This avoids a clash between mercury/compiler/tree.h
(which is generated from mercury/compiler/tree.m)
and gcc/tree.h.
compiler/Mmakefile:
Include $(GCC_SRC_DIR) in the include search path, so that
#including the GCC headers using "gcc/" prefixes works.
Estimated hours taken: 1
Link with the shared version of the C standard library,
rather than linking the C library in statically.
This works around an lcc bug with static linking.
compiler/Mmakefile:
profiler/Mmakefile:
Add `--shared' to `MLFLAGS'.
The overrides the default `--static' on Linux.
(Since we name all the Mercury libraries that we link with
explicitly, this only affects the way we link with the C
library, not with the Mercury runtime or standard library.)
Estimated hours taken: 0.25
Fix some bugs in my changes to add the GCC back-end interface.
tools/bootcheck:
Link main.c into the stage2 and stage3 directories.
compiler/Mmakefile:
Use `$O' rather than `.o'.
Make sure to clean up ../main.$O.
Estimated hours taken: 120
Connect the Mercury compiler to the GCC back-end.
These changes give us a version of the Mercury compiler which
compiles to assembler without going via any intermediate files.
This new back-end for the Mercury compiler generates GCC's `tree' data
type, and then calls functions in the GCC "middle-end" to convert that
to GCC's RTL (Register Transfer Language) and to invoke the rest of
the GCC middle-end and back-end to compile it to assembler.
I don't plan to commit the changes to mercury_compile.m yet, since the
new module that it imports have references to functions defined in the
GCC back-end, and so they require you to have a copy of the gcc
back-end built to link in to the Mercury compiler. I'm not sure what
the best solution to that is; probably a configure option and some
conditional compilation, like we do for the Aditi back-end, is the
best approach.
gcc/mercury:
New directory.
This contains the C side of the Mercury <-> GCC interface.
gcc/mercury/Make-lang.in:
gcc/mercury/config-lang.in:
gcc/mercury/lang-specs.h:
Makefile/configure/specs fragments (respectively)
that are required by GCC.
gcc/mercury/lang-options.h:
Documents the Mercury-specific gcc options,
in particular the `--mmc-flag=' option.
gcc/mercury/mercury-gcc.c:
gcc/mercury/mercury-gcc.h:
This is the "meat" on the C side of the Mercury <-> GCC interface.
These files provide the C code that GCC requires of each
language front-end. They also define some routines for
building parts of the GCC `tree' data structure that are
used by the Mercury compiler.
gcc/mercury/Makefile:
A Makefile which just runs `make mercury' in the parent directory.
Just for convenience.
gcc/mercury/README:
gcc/mercury/ChangeLog:
Some (very basic) documentation.
gcc/mercury/test.m:
A sample Mercury module, to serve as a simple test case.
gcc/mercury/testmercury.c:
C driver program for the test Mercury module.
mercury/compiler/gcc.m:
New file. This is an interface to the tree data structure defined
in gcc/tree.h, and to functions for manipulating that data structure
which are defined in gcc/mercury/mercury-gcc.c and in other parts
of the GCC back-end. It's almost entirely composed of simple
pragma c_code routines that each just call a single C function.
mercury/compiler/mlds_to_gcc.m:
New file. This converts the MLDS into the gcc tree representation
whose interface is in gcc.m, using the routines defined in gcc.m.
This is the "meat" on the Mercury side of the Mercury <=> GCC interface.
mercury/compiler/globals.m:
Define new target `asm', for compiling directly to assembler
(without any intermediate files), via the gcc back-end.
mercury/compiler/handle_options.m:
`--target asm' implies `--high-level-code'.
mercury/compiler/mercury_compile.m:
Handle `--target asm' by invoking mlds_to_gcc.m.
mercury/main.c:
New file, containing main() that calls mercury_main().
mercury/compiler/Mmakefile:
Add C2INITFLAGS=--library, so that we can link `libmercury_compile.a'
as a library without main(). For the mercury_compile executable,
get main by linking in ../main.o.
Add `libmmc' target, for building libmercury_compile.a and
mercury_compile_init.a.
Add the appropriate `-D' and `-I' options to CFLAGS-gcc so that we
can compile gcc.m.
mercury/runtime/mercury.c:
Define out-of-line copies of MR_box_float() and MR_unbox_float(),
so that the new `--target asm' back-end can generate calls to them.
mercury/runtime/mercury.h:
mercury/runtime/mercury_heap.h:
Add comments warning about code duplication between
the inline and out-of-line versions of various functions.
mercury/Makefile:
mercury/Mmakefile:
Add `libmmc' target, for use by gcc/mercury/Make-lang.in.
mercury/runtime/mercury_std.h:
When IN_GCC is defined, use safe_ctype.h rather than
ctype.h, since the latter conflicts with the GCC headers.
Comment out the definition of the `reg' macro, since
that too conflicts with the GCC headers.
mercury/runtime/mercury_dlist.c:
mercury/runtime/mercury_hash_table.c:
mercury/runtime/mercury_stacks.h:
Delete unnecessary uses of the `reg' macro.
Estimated hours taken: 4
This is part 2 of a change that provides a register of all the types defined
in the program.
util/mkinit.c:
After part 1 of this change, each compiler-generated module has three
initialization functions: the old one (to register label addresses
etc), one to register type_ctor_infos, and one to register module
layouts for the debugger. However, only the first was invoked from
the mkinit generated <mainmodule>_init.c file.
This change invokes the other two as well. One complication is that
hand-written "modules" do not have the two new kinds of initialization
functions, so only their first initialization function should be
called. We do this by requiring those "modules" to have one of two
specific forms: an initial prefix of either sys_init or
mercury_sys_init.
scripts/c2init.in:
Rerrange the mechanism we use to allow the overriding of the locations
of the init files to be passed to mkinit. The previous mechanism used
a single environment variable, MERCURY_MOD_LIB_MODS, to hold the names
of these init files. While the default setting of this variable was
conditional on whether the --trace option was given to c2init
(including the init file for the browser only with --trace),
there was no way to override the default value in a similarly
conditional manner. This is now a problem, because including the
browser init file in the list of init files passed to mkinit will
cause mkinit to emit code that causes the browser's modules to be
linked in, without also linking in the libraries (e.g. -ldl) on which
the browser depends. The reason why this hasn't bitten us earlier
is that the code that drags in the browser was #ifdef'ed out
in the first initialization function; the reason why it would
bite us now is that it is *not* #ifdef'ed out in the second
initialization function (the one that register type_ctor_infos).
The new mechanism uses two environment variables, MERCURY_MOD_LIB_MODS
and MERCURY_TRACE_LIB_MODS, with the first normally containing
the filenames of the init files of the runtime and library directories
and the second the filename of the init file of the browser directory.
The value of the second environment variable is passed to mkinit
only if c2init is invoked with the --trace flag.
There is also a new environment variable MERCURY_TRACE_LIB_DIR,
which has a role parallel to MERCURY_MOD_LIB_DIR.
compiler/Mmakefile:
profiler/Mmakefile:
tools/bootcheck:
Specify the filename of the browser init file in
MERCURY_TRACE_LIB_MODS.
library/array.m:
library/builtin.m:
library/private_builtin.m:
library/std_util.m:
Add code to initialization functions to register the type_ctor_infos
of hand-defined types.
Note that this code is in the usual initialization function, the one
called by do_init_modules(). Putting this code in a separate
initialization function that is called by do_init_modules_type_tables()
would require complicating mkinit.c considerably.
runtime/mercury_wrapper.c:
Make do_init_modules_type_tables() call do_init_modules(), so that
calling do_init_modules_type_tables() guarantees the registration
of all the type_ctor_infos in the program, including the hand-defined
ones.
runtime/mercury_context.c:
Make the name of the handwritten module follow the convention now
required by mkinit.
Estimated hours taken: 1
Bootstrapping fixes for the MLDS.
compiler/Mmakefile:
We need to include the browser directory in the C include search
path as prog_rep.m imports modules from the browser directory.
runtime/mercury.h:
Include mercury_memory.h so that MR_GC_NEW_ARRAY is defined for
use in table_builtin.
Estimated hours taken: 20
Make procedure bodies available to the declarative debugger.
browser/program_representation.m:
Add _rep suffixes to the function symbols, to make iit easier to
distinguish HLDS goals and goal representations.
compiler/static_layout.m:
If --trace-decl is specified, include a representation of the procedure
body in the procedure's layout structure.
compiler/prog_rep.m:
A new module, containing the code that converts goals from HLDS
to a term in the format we want to put in the layout structure.
compiler/static_term.m:
A new module, containing the code that converts Mercury terms
to the LLDS rval we need to give to llds_out.m.
compiler/code_gen.m:
compiler/continuation_info.m:
Preserve the information needed by prog_rep
compiler/Mmakefile:
Extend the search path to the browser directory, since the new file
prog_rep.m imports one of the submodules of mdb.m stored there.
compiler/notes/compiler_desigm.html:
Document the new modules.
library/std_util.m:
Add a mechanism for static_term.m to use in converting terms into
rvals. This mechanism uses RTTI information to deconstruct terms,
and return not only their arguments, but also information about how
the term can be constructed from its arguments.
runtime/mercury_type_info.h:
Add a couple of macros to make construction and deconstruction of univs
easier, for use in std_util.m.
trace/mercury_trace_internal.c:
Add a new command, "proc_body", that prints out the representation
of the body of the current procedure. This is meant only for developers
to use to check that the procedure body representation is OK; it is
deliberately not documented.
Also fix a bug: make sure that we do not pass a NULL pointer to fputs
when echoing a line of input that isn't there (because we got EOF).
Estimated hours taken: 0.25
Fix a bug in the Mercury 0.9 binary distribution.
bindist/bindist.Makefile.in:
Change EMACS_SCRIPTS to INSTALL_EMACS_SCRIPTS,
to match the name used in the install_emacs_scripts rule.
Estimated hours taken: 3
Support installing both `.par' and non-`.par' versions of the GC library.
scripts/ml.in:
Change the code for computing which version of the GC library
to link in so that it also takes the `.par' grade component
into account, rather than just the `.prof' grade component.
Add new options `--print-gc-grade' (for use by the top-level
Mmakefile) and `--print-grade' (for symmetry).
Mmakefile:
When invoking sub-makes in the boehm_gc directory,
pass down GC_GRADE instead of PROF.
Compute the GC_GRADE value using `scripts/ml ... --print-gc-grade`
rather than computing it manually, since this avoids code duplication.
boehm_gc/Mmakefile:
boehm_gc/Makefile:
boehm_gc/NT_MAKEFILE:
s/gc$(PROF)/$(GC_GRADE)/g
runtime/Mmakefile:
trace/Mmakefile:
browser/Mmakefile:
bytecode/Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
Change the code for computing which version of the GC library
to link in so that it also takes the `.par' grade component
into account, rather than just the `.prof' grade component.
Estimated hours taken: 2
Name library files with the default extension for the system used.
Mmake.common.in:
Record the default extension for library files.
Add the variable BOEHMGC_MAKEFILE only needed for building the
compiler.
scripts/Mmake.vars.in:
Delete BOEHMGC_MAKEFILE as it is only needed for building the
compiler.
configure.in:
Define the default for EXT_FOR_SHARED_LIB to be the extension
for libraries defined in Mmake.common.
boehm_gc/NT_MAKEFILE:
Use .lib instead of .a, seeing we only use this Makefile for
building the library on win32 systems.
Mmakefile:
boehm_gc/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
trace/Mmakefile:
Use the variable defined in Mmake.common for the extension of
library files.
Estimated hours taken: 0.25
browser/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
Add `-I$(LIBRARY_DIR)' to ALL_C_INCL_DIRECTORIES, since this
is needed for the MLDS back-end, which generates a C header file
for each module in the library.
Estimated hours taken: 0.25
compiler/Mmakefile:
The tests run on hg occur on a MS-DOS filesystem, so the chmod
during .pp processing will fail, causing mmake to abort with an
error.
Estimated hours taken: 0.75
Mmakefile:
*/Mmakefile:
*/*/Mmakefile:
*/*/*/Mmakefile:
Use `clean_local' instead of `clean' and `realclean_local' instead
of `realclean' where appropriate. This is necessary now that
`realclean' does not depend on `clean'.
Estimated hours taken: 3
Improve build and installation on MS-Windows.
configure.in:
Mmake.common.in:
Set extension for executables (.exe for Windows, nothing
otherwise).
Detect presence of perl, makeinfo, texi2dvi and dvips.
Mmakefile:
README.MS-Windows:
Remove old preinstall and postinstall hacks for windows.
compiler/Mmakefile:
profiler/Mmakefile:
util/Mmakefile:
Use the extension for executables when installing.
doc/Mmakefile:
Don't generate documentation unless the appropriate tools
are available. Use the auto-detection of perl,
makeinfo, texi2dvi and dvips to build documentation.
doc/generate_mdb_doc:
Don't insist on rm being in /bin
Estimated hours taken: 1
Mmake.common.in:
Document that `mmake depend' needs to be run
in the compiler directory if the setting
of `INCLUDE_ADITI_OUTPUT' is changed.
compiler/Mmakefile:
Change the action of `mmake depend' so that it always
regenerates the `.m' files for which `.pp' files exist.
Don't update the timestamp on a `.m' file if regenerating
it does not change it.
tools/bootcheck:
Link rather than copy `.pp' files now that reprocessing
them is handled by `mmake depend'.
Estimated hours taken: 1
browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Simplify the code by deleting unnecessary uses of $(EXTRA_*), etc.
This is now handled once and for all in scripts/Mmake.vars, and
so it doesn't need to be separately handled by */Mmakefile.
This patch also fixes an annoyance where if you set EXTRA_CFLAGS,
the flags that you set were being passed to mgnuc twice.
Estimated hours taken: 3
Preprocess mercury_compile.m and rl_file.m to remove dependencies
on rl_code.m. This is done to avoid major mode analysis efficiency
problems on the alias branch.
Mmake.common.in:
Include the Aditi support by default.
compiler/Mmakefile:
Add rules to process `.pp' files.
compiler/rl_out.pp:
compiler/rl_file.pp:
Add preprocessing to remove dependencies on rl_code.m.
compiler/rl_out.m:
compiler/rl_file.m:
Removed.
compiler/rl_out.m:
compiler/rl.m:
compiler/rl_gen.m:
compiler/magic.m:
Move the code to convert schemas to strings into rl.m,
since these are not just used for RL output.
Estimated hours taken: 2
Simplify the Mmakefiles. Fix a few minor latent bugs.
*/Mmakefile:
- Factor out some common code by defining a new variable M_ENV
which holds settings of environment variables for mmc, mgnuc, etc.
- For consistency, always override MERCURY_C_ALL_INCL_DIRS rather
than passing extra `-I' options to mgnuc.
- Make sure to always include `$(BOEHM_GC)/include' in the search path,
so that it will work if we try to compile with `-O6'.
- Make sure to always include `--cflags $(ALL_CFLAGS)' in MCS, so
that the EXTRA_CFLAGS etc. will get passed down to gcc via mmc.
- Make sure that the Mmakefiles in all directories set
all the MC* variables: MCPI, MCSI, MCOI, MCTOI, etc.
Estimated hours taken: 0.5
boehm_gc/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
Separated out all the commands to create installation directories
into a single target in each Mmakefile, upon which all targets which
used to create directories depend. This avoids a race condition
with parallel installs into a new directory tree, whereby two or
more `mkdir -p' commands simultaneously try to create the same
missing path component, resulting in all but one failing.
Estimated hours taken: 10
Introduce two new directories, trace and browser, containing libraries
holding the C and Mercury code of the debugger respectively. (Although
the browser directory does not have a browser in it yet, the browser
should soon become its biggest component.) Take the opportunity to
rename the existing libraries, for consistency.
After this change, the linking order becomes:
the object of the auto-generated init file
program object files
trace library (libmer_trace.a)
browser library (libmer_browser.a)
standard library (libmer_std.a)
runtime library (libmer_rt.a)
Boehm collector (libgc.a)
To avoid circularities, libraries cannot contain direct calls to
any routines that are defined in libraries (or object files) that
occur earlier in the above list. Any such calls must be made into
indirect calls via function pointers.
In particular, there was a circularity caused by the library calling
MR_trace() which invokes the tracer which in turn invokes the
library. This circularity was broken by having MR_trace(),
which is defined in the runtime, call the tracer indirectly via
a global variable named MR_trace_func_ptr. This global variable
is initialized by the auto-generated *_init.c file.
To avoid linking in the tracer even when it is not being used,
this global variable is only set to point to MR_trace_real()
if you're using a debugging grade or if c2init was invoked
with the `-t' flag. Otherwise it is set to MR_trace_fake()
which just prints an error message telling the user to
rebuild the executable with debugging enabled.
Makefile.DLLs:
Reserve random locations for the two new libraries. Whether they work
will be decided by testing on Windows.
Mmake.common.in:
Add variables naming the new directories, and create variables
naming the libraries.
Mmakefile:
Add targets for the new directories, and modify existing rules
as appropriate.
browser/Mmakefile:
Mmakefile for the new directory, modelled on library/Mmakefile.
browser/browser_library.m:
Umbrella file for the new directory, modelled on library/library.m.
{browser,library}/debugger_interface.m:
Moved this file from library to browser without change.
browser/help.m:
A new module for the help system of the debugger. Not yet used.
compiler/Mmakefile:
Update to refer to the new directories and libraries where
appropriate.
compiler/mercury_compile.m:
If we are doing tracing, then pass -t instead of -i to c2init.
compiler/modules.m:
When generating the .dep file, get the grade flags passed to c2init.
doc/Mmakefile:
Remove the special treatment of library/debugger_interface.m.
library/Mmakefile:
Update to refer to the new directories and libraries where
appropriate, and to conform to the new name of the library.
library/library.m:
Do not import debugger_interface.
profiler/Mmakefile:
Update to refer to the new directories and libraries where
appropriate.
runtime/Mmakefile:
Update to refer to the new directories and libraries where
appropriate, and to conform to the new name of the library.
Remove references to files being moved to the trace directory.
runtime/mercury_init.h:
Refer to the automatically generated dll header file by its new name
(renamed because the runtime library is renamed).
Add declarations to support the new global variable MR_trace_func_ptr.
runtime/mercury_memory_handlers.c:
runtime/mercury_memory_zones.c:
runtime/mercury_misc.c:
Remove inappropriate #includes of "mercury_trace.h", and substitute
a #include of "mercury_trace_base.h" if necessary.
{runtime,trace}/mercury_trace.[ch]:
{runtime,trace}/mercury_trace_external.[ch]:
{runtime,trace}/mercury_trace_internal.[ch]:
Move these files from the runtime to the trace directory.
The only changes are the removal from mercury_trace.h of declarations
added to runtime/mercury_trace_base.h, and the change from MR_trace
to MR_trace_real.
runtime/mercury_trace_base.[ch]:
Define MR_trace(), which does an indirect call through
MR_trace_func_ptr if the event should be traced.
Define MR_trace_fake, which just prints an error message.
Its address will be assigned to MR_trace_func_ptr if tracing
is not enabled.
Define the types needed by the signature of MR_trace.
Fix an old bug: s/MERCURY_TRACE_PERMANENT_H/MERCURY_TRACE_BASE_H/.
runtime/mercury_wrapper.[ch]:
Add the new global variable MR_trace_func_ptr.
scripts/c2init.in:
Add a new option, -t/--trace, which enables tracing by causing the
address of MR_trace_real to be assigned to MR_trace_func_ptr.
Have this option be implied by the grade. Also have the old option
-i (need initialization code) be implied by the grade, as well as by
-t.
scripts/ml.in:
Include the new libraries in the link command.
tests/debugger/Mmakefile:
Include -t instead of -i in the list of c2init options. (-t implies
-i.)
tools/bootcheck:
Copy and build the new directories as appropriate. The trace directory
is treated like the runtime, the browser directory is treated like the
library.
trace/Mmakefile:
Mmakefile for the new directory, modelled on runtime/Mmakefile.
util/mkinit.c:
Add the new option -t, as discussed above.
Mmakefile for the new directory, modelled on runtime/Mmakefile.
util/Mmakefile:
Specify -O0, since with the default optimization level, gcc on
cyclone ignores the assignment of TRUE to need_tracing when -t is
given (!!!).
Estimated hours taken: 1
Fix some Mmakefile errors that were diagnosed by `--warn-undefined-variables'.
Also, make a small fix to mmake.in and add empty definitions for various
Mmake variables to avoid spurious warnings.
scripts/mmake.in:
Add ` dep*' to the patterns for which we do not
pass `--warn-undefined-variables'; previously it
matched "$@" against `dep*', which did not catch the
case of `mmake -k depend'.
^^^
scripts/Mmake.vars.in:
Add definition for `ds_subdir'.
Define `MLLIBS' as `$(EXTRA_MLLIBS)' rather than empty,
and add empty definition for `EXTRA_MLLIBS'.
Add empty definition for `MAIN_TARGET'.
Mmakefile:
Fix misspelling: `deps_subdir' not `dep_subdir'.
Add empty definitions for `PREINSTALL_HACK', `POSTINSTALL_HACK',
and `MMAKEFLAGS'.
boehm_gc/Mmakefile:
Add empty definition for `PROF'.
runtime/Mmakefile:
Add empty definition for `DLL_CFLAGS'.
library/Mmakefile:
Add empty definition for `CHECK_TERM_OPTS'.
compiler/Mmakefile:
Add empty definition for `MTAGSFLAGS'.
Estimated hours taken: 6
Fix some problems with the `--use-subdirs' option.
The compiler itself now compiles and bootstraps fine with --use-subdirs.
compiler/modules.m:
Put `.h' files in the source directory, rather than
in the `Mercury/hs' subdirectory.
compiler/mercury_compile.m:
scripts/Mmake.rules:
If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
so that #include statements work relative to the source directory
rather than relative to the `Mercury/cs' subdirectory.
scripts/Mmake.vars.in:
Define $(cs_subdir), $(os_subdir) etc. variables;
these are set to the directory to use for .c, .o, etc. files,
(including the trailing `/'), or to the empty string,
if --use-subdirs is not set.
scripts/Mmake.rules:
Use $(cs_subdir), $(os_subdir) etc. to avoid the code
duplication created by my previous change to handle
--use-subdirs.
Also add lots of comments, and reorder the code
in a more logical order.
Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
file-names (e.g. *.dep, *_init.[co], tree234.o) that were
used in some of the rules.
library/Mmakefile:
Add `rm -f tags' to the rule for `mmake realclean'.
tools/bootcheck:
Add `--use-subdirs' option (defaults to setting of the
MMAKE_USE_SUBDIRS environment variable).
Change the code which compares the stage2 & stage3 C files
to use the appropriate location for them based on the
setting of this option.
Estimated hours taken: 12
Add support for stack dumps, do a stack dump from error/1.
compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
Insert EXTRA_MGNUCFLAGS before CFLAGS or EXTRA_CFLAGS
becasue mgnuc stops processing its options when it
encounters a non-mgnuc option.
library/require.m:
Call MR_dump_stack if error is called.
runtime/Mmakefile:
runtime/mercury_imp.h:
Add #includes of new files.
runtime/mercury_type_info.h:
Remove conditional definition of MR_STATIC_CODE_ADDRESSES
(moved into mercury_conf.h.in).
runtime/mercury_accurate_gc.h:
Remove stack_layout stuff, leave this file for accurate
GC specific definitions.
runtime/mercury_conf.h.in:
Add conditional definitions of MR_INSERT_LABELS,
MR_USE_STACK_LAYOUTS, MR_NEED_INITIALIZATION_CODE and
MR_STATIC_CODE_ADDRESSES, depending on various other options.
runtime/mercury_goto.h:
Insert labels into label table if MR_INSERT_LABELS is defined,
rather than NATIVE_GC.
util/mkinit.c:
Initialize if MR_NEED_INITIALIZATION_CODE is defined, rather than
NATIVE_GC.
runtime/mercury_stack_layout.h:
All the old stack layout definitions from mercury_accurate_gc.h.
Add code for MR_DETISM_DET_CODE_MODEL.
runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
Implement MR_dump_stack which just provides a dump of the stack
as far as possible.
Set MR_INSERT_LABELS and MR_USE_STACK_LAYOUTS if MR_STACK_TRACE
is set.
runtime/mercury_grade.h:
Add _strce if stack tracing is enabled in the grade. This
might not be a permanent change.
runtime/mercury_ho_call.c:
Remove unused label declarations.
scripts/mgnuc.in:
Add --stack-trace and --no-stack-trace options.
Consolidate some duplicate code.
Estimated hours taken: 1.5
Bug fixes for inter-module optimization
compiler/Mmakefile
Use the `.int' files in $(LIBRARY_DIR) rather than the installed
`.int' files when creating `.opt' files for the compiler.
compiler/intermod.m
Handle higher-order function calls properly. This caused
mmc --make-optimization-interface --enable-termination \
tests/hard_coded/agg.m to fail.
Make sure types used by abstract exported types are made
exported when compiling to C. This ensures that the
base_type_infos are exported, avoiding link errors.
tests/general/intermod_type.m
tests/general/intermod_type2.m
tests/general/intermod_type.exp
Regression test for abstract exported types.