Estimated hours taken: 20
Branches: main
Allow reconfiguration of existing installations, for example
to use a different C compiler. The reconfiguration works
by making a new copy of the scripts and mercury_conf.h,
and storing them in a partial installation directory tree
which uses the libraries and executables from the existing
installation.
Use this method to configure binary distributions, rather
than using a cut down version of the configuration script,
to avoid code duplication and to handle the case where the
C compiler in use on the installation machine is different
than that used to build the binary distribution.
This is more robust than the previous method of using a different
C compiler, which was to set the MERCURY_C_COMPILER variable and
hope the different C compilers were compatible enough.
Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
Modify the `install' targets to store files needed to create
a new configuration in $INSTALL_LIBDIR/reconf.
runtime/Mmakefile:
Install mercury_conf.h in $INSTALL_LIBDIR/conf, rather than
$INSTALL_LIBDIR/inc, so that it can be overridden by a
different configuration.
scripts/mercury_config.in:
Create a new configuration, by creating part of a Mercury
source tree from the files stored in $INSTALL_LIBDIR/reconf,
running configure, then copying the files into a partial
installation tree.
scripts/Mmake.vars.in:
Define ENABLE_DEEP_PROFILER, for use by bindist/bindist.Makefile.
Define variables INSTALL_CONF_DIR (contains the files describing
the configuration) and INSTALL_RECONF_DIR (contains files needed
to reconfigure an installation).
configure.in:
Add an option `--enable-reconfigure', for use by
mercury_config.in.
Don't look for runtime/mercury_wrapper.c when checking
for the sources -- it isn't present when reconfiguring.
Look for scripts/mmc.in instead.
Look for the runtime headers in the installation hierarchy
rather than the `runtime/' and `trace/' directories when
reconfiguring.
Output the help message for the `configure' script to
`configure.help'. This is included in the help message
for `mercury_config'.
Add new configuration variables CONFIG_PREFIX and CONFIG_LIBDIR,
which are like PREFIX and LIBDIR except that they point
to the configuration files, not the library files.
In the normal case PREFIX and CONFIG_PREFIX will be the same.
bindist/bindist.INSTALL.in:
bindist/bindist.Makefile.in:
Use mercury_config to configure binary distributions.
bindist/Mmakefile:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
Remove bindist.configure.in and bindist.build_vars.in.
compiler/options.m:
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
doc/user_guide.texi:
Add an option `--mercury-config-dir', and an environment
variable MERCURY_CONFIG_DIR, which tell the compiler and
scripts where to find the configuration files for the
installation.
MERCURY_CONFIG_DIR is not documented because it should
only be used by the scripts.
compiler/compile_target_code.m:
Pass `--mercury-config-dir' to the scripts.
compiler/handle_options.m:
Add `--c-include-directory $MERCURY_CONFIG_DIR/conf'.
library/getopt.m:
Handle `maybe_string_special' options.
doc/user_guide.texi:
Update the "Using a different C compiler" chapter.
NEWS:
Document the changes.
Estimated hours taken: 80
Branches: main
A first implementation of the inter-module analysis framwork.
Currently only unused argument analysis is supported.
The current inter-module analysis scheme using `.trans_opt' files
has some major limitations. The compilation dependencies introduced
by `.trans_opt' files are too complicated for Mmake without major
limitations on which modules can use the contents of which `.trans_opt'
files. Also, the `.trans_opt' file system only computes greatest fixpoints,
which is often too weak to find opportunities for optimization.
A better solution is to provide a library which manually handles
the dependencies introduced by inter-module analysis, and can deal with
the complications introduced by cyclic module dependencies.
TODO:
- support other analyses, e.g. termination, type specialization
- dependency tracking and invalidation after source modifications
- garbage collection of unused versions
- least fixpoint analyses
analysis/Mmakefile:
analysis/mer_analysis.m:
analysis/analysis.m:
analysis/analysis.file.m:
The analysis library.
analysis/README:
Description and design documentation.
Mmake.workspace:
Mmakefile:
compiler/Mmakefile:
tools/bootcheck:
Link the analysis library into mercury_compile.
compiler/hlds_module.m:
Store analysis information in the module_info.
compiler/options.m:
doc/user_guide.texi:
Add an option `--intermodule-analysis'.
compiler/mercury_compile.m:
Call the analysis library to write the gathered
information at the end of a compilation.
compiler/unused_args.m:
Call the analysis library to retrieve information
about imported procedures. This replaces code which
used the `.opt' files.
Change the names created for unused arguments procedures
to include the arguments removed, rather than a sequence
number. I think Zoltan is working on a change to name
mangling, so I haven't updated the demangler.
compiler/prog_util.m:
Generate the new predicate names for unused_args.m.
library/std_util.m:
Add a polymorphic version of unit, which is useful
for binding type variables.
compiler/modules.m:
scripts/Mmake.vars.in:
Clean up files created by the analysis framework
in `mmake realclean'.
util/mdemangle.c:
profiler/demangle.m:
Document the change in the name mangling of procedures with
unused arguments.
configure.in:
Check for state variables and fixes for some typeclass bugs.
tests/warnings/Mmakefile:
tests/warnings/unused_args_analysis.{m,exp}:
Test case.
Estimated hours taken: 2
Branches: main
Apply Zoltan's deep profiler changes to the main branch. Zoltan committed
these changes to the release branch, but forgot to commit them to the main
branch.
Mmakefile:
NEWS:
configure.in:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
doc/user_guide.texi:
library/exception.m:
library/io.m:
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
runtime/mercury_misc.c:
runtime/mercury_misc.h:
scripts/Mmakefile:
deep_profiler/.nocopyright:
deep_profiler/Mercury.options:
deep_profiler/Mmakefile:
deep_profiler/callgraph.m:
deep_profiler/cliques.m:
deep_profiler/conf.m:
deep_profiler/html_format.m:
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/query.m:
deep_profiler/startup.m:
deep_profiler/timeout.m:
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
Merge in changes from the release branch.
Enclosed below is Zoltan's original log message.
----------
Estimated hours taken: 0.3 (on release branch)
Branches: release
Make the deep profiler work again.
The existing process structure of the deep profiler made it very hard to debug,
mainly because the Mercury debugger is confused by forks and stymied by execs.
This change completely replaces the process structure. The old structure had
two separate programs, mdprof_cgi and mdprof_server, the first always acting
as client and the second always acting as server. The new structure has only
one program, mdprof_cgi, which acts as a server if there is no existing server
for the relevant profiling data file, and as a client otherwise.
Although mdprof_cgi normally forks when it becomes a server to let the parent
exit and let the web server know that the web page it has generated is
complete, the fork can be disabled for debugging via an option. This allows
the communication between client and server to be debugged by running two
instances of mdprof_cgi in different windows, one or both under mdb.
deep_profiler/DESIGN:
New file describing the new process structure, its race conditions,
and their solutions.
deep_profiler/.nocopyright:
Add DESIGN.
deep_profiler/mdprof_cgi.m:
A complete rewrite of this module to enable it act as both client and
server.
deep_profiler/mdprof_test.m:
A new module to hold the testing functionality of mdprof_server.m.
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
Delete these now unnecessary modules.
Mmakefile:
Replace references to mdprof_server with references to mdprof_test.
deep_profiler/Mmakefile:
Replace references to mdprof_server with references to mdprof_test.
Move the include of Mmake.deep.params, to allow it to override
top level parameter settings.
deep_profiler/Mercury.options:
Work around a compiler bug by turning off the offending optimization.
deep_profiler/timeout.m:
A rewrite of major parts of this module to support the new design
of mdprof_cgi.m, and to make unexpected signals easier to debug.
deep_profiler/interface.m:
Implement the mechanisms needed by the new process structure.
Change the characters we use to separate components of the URL.
The old ones were special to the shell, and screwed up command lines.
(As double insurance, we ignore the command line anyway when invoked
by the web server.)
Change some names to be more expressive.
deep_profiler/conf.m:
Add a new function, getpid, for use by interface.m.
Rewrite some code to use streams explicitly, not implicitly.
deep_profiler/callgraph.m:
deep_profiler/cliques.m:
Add (now commented out) code to help debug these modules, for use
in cases where mdb doesn't help, because the program works perfectly
with debugging enabled :-(
deep_profiler/query.m:
Move the predicate try_exec here from the deleted file server.m.
deep_profiler/html_format.m:
Trivial change to conform to name change in interface.m.
deep_profiler/startup.m:
Generate debugging output to a caller specified stream, not to
stdout and stderr.
Disable the generation of statistics temporarily, since the diff
to make statistics reporting routines write to a specified stream
instead of stdout and stderr won't be committed on the release branch.
Currently, they always write to stdout, which in the new design
goes to the web page, not to the startup file.
configure.in:
Detect the presence of opendir, readdir and closedir, and the header
file they need, dirent.h. Enable the deep profiler only if all exist,
since the deep profiler now needs them.
runtime/mercury_conf.h.in:
Support the changes to configure.in.
runtime/mercury_misc.[ch]:
Add a mechanism for registering cleanup functions to be executed when
we terminate the program due to an uncaught exception.
library/exception.m:
Invoke the registered cleanup functions just before terminating
the program due to an uncaught exception.
Estimated hours taken: 0.1
Branches: main
Mmakefile:
Build WORK_IN_PROGRESS and TODO before building the
binary distribution.
bindist/Mmakefile:
Add TODO to the binary distribution.
Estimated hours taken: 0.5
Branches: main
Make the "work in progress" file appear on the web site.
compiler/notes/work_in_progress.html:
compiler/notes/Mmakefile:
Add a a htmlized version of WORK_IN_PROGRESS.
WORK_IN_PROGRESS:
Removed.
Mmakefile:
Generate WORK_IN_PROGRESS and TODO from the files
in compiler/notes.
w3/information/include/developer.inc:
Add the "work in progress" file to the developer documentation.
Estimated hours taken: 0.25
Branches: main
Mmakefile:
Support the case when $(LIBGRADES) is empty.
Normally it won't be, since $(LIBGRADES) now includes $(GRADE),
but it turns out that tools/test_mercury needs to be able
to invoke `mmake install_split_library' with $(LIBGRADES) empty.
tools/test_mercury needs to override $(LIBGRADES), but it can't
easily include $(GRADE) in $(LIBGRADES) since it doesn't know
what grade configure has chosen for $(GRADE).
Estimated hours taken: 1
Branches: main
A first step towards building RPM distributions for ROTD releases.
Mmakefile:
.mercury-compiler.spec.in:
Handle dashes in the version name when creating mercury-compiler.spec.
List the ftp location as being from the beta-releases subdirectory
if the version is rotd-* or *beta*.
Estimated hours taken: 1
Branches: main
Change things so that LIBGRADES includes the default grade.
This fixes a bug that sometimes caused the libraries not to be
installed in the default grade, e.g. when $(GRADE) is set in Mmake.params.
configure.in:
Don't delete $(GRADE) from $(LIBGRADES).
Mmakefile:
scripts/Mmake.rules:
compiler/make.program_target.m:
Change the loops over $(ALL_LIBGRADES) so that they skip $(GRADE).
scripts/Mmake.vars.in:
Delete an bogus assignment setting LIBGRADES to empty, since it
wasn't being used (LIBGRADES was being assigned again below).
Update the documentation for LIBGRADES.
Estimated hours taken: 2
Branches: main
tools/run_all_tests_from_cron:
tools/test_mercury:
Some changes to make the tests work on machines that are not part
of the Mercury network (i.e. that don't NFS-mount /home/mercury):
- Use $HOME/public rather than /home/mercury/public if the latter
doesn't exist.
- Don't make files group-writable unless /home/mercury/public
exists.
- Remove some obsolete directories (gcc-2.7.2, egcs, nu-prolog,
sicstus3) from the PATH.
- Simplify the logic for which bootstrap compiler to use.
- Avoid hard-coding the list of hosts and their architectures,
grades, etc.
Mmakefile:
Add `echo_libgrades' target, for use by tools/test_mercury.
Estimated hours taken: 10
Branches: main
In the presence of foreign code the `.opt' and `.trans_opt' files
aren't grade independent, so install them in grade-dependent
directories.
scripts/Mmake.vars.in:
Define $(INSTALL_GRADE_INT_DIR), which holds `.opt'
and `.trans_opt' files.
Pass the extra libraries to mmc using `--ml' and `--mld'
(`--mercury-library' and `--mercury-library-directory')
options, rather than just a `-I' option. This is needed
so that $(INSTALL_GRADE_INT_DIR) is searched for `.opt'
files before $(INSTALL_INT_DIR)
Fix a bug -- the `-I' options for libraries should
go in CFLAGS, not MGNUCFLAGS.
scripts/Mmake.rules:
Create INSTALL_GRADE_INT_DIR in the install_grade_dirs target.
compiler/modules.m:
Install `.opt' and `.trans_opt' files in $(INSTALL_GRADE_INT_DIR).
`.int0' files are needed by `.opt' files for sub-modules, so
install them.
<module>.int0s now only contains the names of modules with sub-modules
(this is needed to avoid attempting to install nonexistent `.int0'
files).
compiler/handle_options.m:
Add $(INSTALL_GRADE_INT_DIR) for each `--mercury-library' option
to `--intermod-directories'.
Mmakefile:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
Simplify the code to copy/remove the grade dependent files
before building the libraries in a new grade when installing.
Copy/remove all grade-dependent files, including `.opt' files
and `.dv' files.
Estimated hours taken: 5
Branches: main
Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
The tests don't work yet.
compiler/make.m:
compiler/make.module_target.m:
Handle targets such as `<module>.cs' and `<module>.ints',
which are used when building stage 3.
Mmake.common.in:
*/Mmakefile:
*/Mercury.options:
Add Mercury.options files to pass module-specific flags to
`mmc --make'.
Avoid triggering the .DEFAULT rule introduced with `--use-mmc-make'
for optional files like Mmake.params.
compiler/modules.m:
Build the interface files when building a library in IL grades,
for consistency with C grades.
library/Mmakefile:
Improve performance by removing the dependency on the interface
files when building the library. The files are now always built
by the libmer_std target.
Pass the command to build libmer_std.init to `mmc --make'.
tools/bootcheck:
Add an option `--use-mmc-make'.
Copy the Mercury.options files into the stage2 and stage3 directories.
scripts/Mmake.rules:
Don't include the rules for `.dep' files with `--use-mmc-make'.
Include the rule for `--convert-to-mercury' even with `--use-mmc-make'.
compiler/Mmakefile:
tools/bootcheck:
tools/binary_step:
`mmc --make' doesn't handle `<module>_init.c' targets, so
don't make the `cs' target depend on `top_level_init.c'.
As far as I can tell, that dependency is only present so
that the stage2 and stage3 compilers have the same set of
C files. bootcheck and binary_step now only compare `.c'
files which are present in the stage3 directory.
Estimated hours taken: 0.25
Branches: main
Fix a bug in my change to generate grade dependent header files.
The `.mih' files weren't being installed for the default grade.
scripts/Mmake.rules:
Run `lib<main_module>.install_grade_hdrs' for
all grades, including the default grade.
Mmakefile:
library/Mmakefile:
libmer_std.install_grade_hdrs is now run by
libmer_std.install_library, so it doesn't
need to be explicitly invoked here.
Estimated hours taken: 25
Branches: main
Fix problems with the compiler-generated header files:
1. the header files are grade dependent, but the header files
can only be installed for one grade.
2. the generated header files can clash with system headers.
To solve these problems, the compiler now generates a
grade dependent `.mih' file containing the declarations
needed when a module is imported in a high-level C code
grade, and a grade independent `.mh' file, which contains
the prototypes for `:- pragma export' declarations.
compiler/export.m:
Generate a `.mh' rather than a `.h' file for the `:- pragma export'
declarations.
Allow the header file generated by export.m to be used with
`--high-level-code'.
compiler/modules.m:
library/Mmakefile:
Add a module.install_grade_hdrs target to install the `.mih'
files in a grade-dependent directory.
compiler/arg_info.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
Make it easier to tell if the arg_info field of the proc_info
has been set.
compiler/mlds_to_c.m:
Include both the `.mh' and `.mih' files for imported modules.
The type used as the return value for a semidet procedure
exported to C is `MR_bool', not `MR_Word'.
compiler/mlds_to_c.m:
compiler/modules.m:
Don't add a `mercury.' prefix to the standard library
header file names. They can't clash with the system
headers any more.
compiler/mercury_compile.m:
compiler/mlds_to_c.m:
Use export.m to generate the header file for `:- pragma export'
declarations even in hlc grades.
compiler/mlds.m:
compiler/ml*.m:
Distinguish between the `.mh' and `.mih' files
in `mlds__import's.
compiler/handle_options.m:
scripts/Mmake.vars.in:
scripts/mgnuc.in:
Add C include directory options for the installed grade
dependent `.mih' files.
Mmakefile:
scripts/Mmake.rules:
s/h/mih/ in the commands to save the grade dependent
files when installing the library grades.
compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.util.m:
Handle dependencies on `.mh' and `.mih' files.
NEWS:
doc/user_guide.texi:
Document the change.
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: 0.5
Branches: main
Mmakefile:
Delete `extras/Mmake.params' before building the tar file;
this avoids problems where the nightly tests would leave a
an extras/Mmake.params file with some wierd GRADE in it,
and this would get included in the extras tar file, which
resulted in user confusion.
Estimated hours taken: 0.5
Branches: main
mercury/java/Makefile:
Renamed to `Mmakefile'.
mercury/Mmakefile:
Invoke mmake in the mercury/java directory to create symbolic
links for java class directories at build time.
Estimated hours taken: 0.1
Branches: main
Mmakefile:
After installing each grade with `--use-subdirs', remove
`Mercury/c_dates/*.c_date' as well as `Mercury/cs/*.c'
in the library and browser directories.
Estimated hours taken: 0.25
Mmakefile:
tests/Mmakefile:
tests/debugger/Mmakefile:
tests/general/Mmakefile:
tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
Prefix commands which recursively invoke mmake with `+'.
This allow parallel make to work in the subdirectories,
and avoids warnings such as:
"gmake[1]: warning: jobserver unavailable: using -j1.
Add `+' to parent make rule."
Without the `+', the parent gmake does not attempt to
communicate with the child gmake to decide how many processes
the child gmake is allowed to run.
Estimated hours taken: 2
Branches: main
Add rules for installing the deep profiler from source. (Installing it from
binary distributions is future work.)
configure.in:
Add an option, --enable-deep-profiler=/path/name, that specifies the
path name of the directory in which the CGI script should be installed
(the default is apache's /usr/lib/cgi-bin).
Report an error if the user requests deep profiling but it is not
available.
Mmakefile:
Remind the user to copy the CGI script to its directory.
scripts/Mmakefile:
Document why we can't install the CGI script automatically.
Be consistent about the order of rules.
scripts/Mmake.vars.in:
Record the CGI directory for use in the toplevel Mmakefile.
scripts/mdprof.in:
Record that mdprof_cgi and mdprof_server are installed in the directory
for non-user-visible programs, alongside mercury_compile and
mercury_profile.
Estimated hours taken: 3
Use a timestamp file mechanism similar to that used for `.int' files
to avoid rechecking whether a module needs to be recompiled on each
mmake if no used interfaces have changed.
compiler/mercury_compile.m:
Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
after compilation has finished.
compiler/recompilation_check.m:
Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
if a module does not need to be recompiled.
compiler/modules.m:
scripts/Mmake.rules:
Set up the make dependencies for timestamp files, in a similar
manner to the `.date' files.
Remove the timestamp files in the `clean' mmake target.
Handle `.s' and `.pic_s' files as for the `.o' files
when using `--target asm'. There are no `.s' or `.pic_s'
files for nested modules.
scripts/Mmake.vars.in:
Set up the subdir variables for the timestamp files.
Mmakefile:
scripts/mercury_cleanup_install:
Save/restore the timestamp files and the `.used' files
across the library grade installation.
configure.in:
Remove the `.c_date' files for the `.c' files that
need to be rebuilt.
doc/user_guide.texi:
Document the new file extensions.
Estimated hours taken: 500
Branches: main
Implement deep profiling; merge the changes on the deep2 branch back
onto the trunk.
The main documentation on the general architecture of the deep profiler
is the deep profiling paper.
doc/user_guide.texi:
Document how to use the deep profiler.
deep_profiler:
deep_profiler/Mmakefile:
A new directory holding the deep profiler and its mmakefile.
Mmakefile:
Add targets for the new directory.
Add support for removing inappropriate files from directories.
deep_profiler/interface.m:
The deep profiler consists of two programs: mdprof_cgi.m, which acts
as a CGI "script", and mdprof_server.m, which implements the server
process that the CGI script talks to. Interface.m defines the
interface between them.
script/mdprof.in:
A shell script template. ../configure uses it to generate mdprof,
which is a wrapper around mdprof_cgi that tells it how to find
mdprof_server.
deep_profiler/mdprof_cgi.m:
The CGI "script" program.
deep_profiler/mdprof_server.m:
The top level predicates of the server.
deep_profiler/profile.m:
The main data structures of the server and their operations.
deep_profiler/read_profile.m:
Code for reading in profiling data files.
deep_profiler/startup.m:
Code for post-processing the information in profiling data files,
propagating costs from procedures to their ancestors and performing
various kinds of summaries.
deep_profiler/server.m:
Code for responding to requests from the CGI script.
deep_profiler/cliques.m:
Code to find cliques in graphs.
deep_profiler/array_util.m:
deep_profiler/util.m:
Utility predicates.
deep_profiler/dense_bitset.m:
An implementation of (part of) the set ADT with dense bit vectors.
deep_profiler/measurements.m:
Operations on profiling measurements.
deep_profiler/timeout.m:
An implementation of a timeout facility.
deep_profiler/conf.m:
Functions that depend on autoconfigured settings.
configure.in:
Find out what command to use to find the name of the local host.
Install deep profiling versions of the standard library along with the
other profiling versions.
runtime/mercury_conf.h.in:
Add some macros for deep_profiler/conf.m to use.
library/profiling_builtin.m:
runtime/mercury_deep_call_port_body.h:
runtime/mercury_deep_leave_port_body.h:
runtime/mercury_deep_redo_port_body.h:
A new library module that implements deep profiling primitives.
Some of these primitives have many versions, whose common code is
factor is factored out in three new include files in the runtime.
compiler/deep_profiling.m:
New module to perform the program transformations described in the
paper.
compiler/notes/compiler_design.html:
Document the new compiler module.
compiler/mercury_compiler.m:
Invoke the new module in deep profiling grades. Allow global static
data to be generated by deep_profiling.m.
compiler/options.m:
Add options to turn on deep profiling and (for benchmarking purposes)
control its implementation.
Add an optiooption disable tailcall optimization in the LLDS backend,
to help benchmarking deep profiling.
compiler/jumpopt.m:
compiler/optimize.m:
Obey the option to disable tailcalls.
compiler/handle_options.m:
Handle the implications of deep profiling.
compiler/modules.m:
In deep profiling grades, automatically import profiling_builtin.m.
compiler/prog_util.m:
doc/Makefile:
library/library.m:
Handle the new builtin module.
compiler/export.m:
In deep profiling grades, wrap deep profiling code around exported
procedures to handle the "unscheduled call" aspects of callbacks to
Mercury from the foreign language.
compiler/higher_order.m:
profiler/demangle.m:
util/demangle.c:
When creating a name for a higher-order-specialized predicate, include
the mode number in the name.
compiler/add_trail_ops.m:
compiler/type_util.m:
Move c_pointer_type from add_trail_ops to type_util, so it can also be
used by deep_profiling.m.
compiler/hlds_goal.m:
Add a new goal feature that marks a tail call, for use by
deep_profiling.m.
compiler/hlds_pred.m:
Add a new field to proc_info structures for use by deep_profiling.m.
Add a mechanism for getting proc_ids for procedure clones.
Remove next_proc_id, an obsolete and unused predicate.
compiler/hlds_data.m:
Add a new cons_id to refer to the proc_static structure of a procedure.
compiler/bytecode_gen.m:
compiler/code_util.m:
compiler/dependency_graph.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/ml_unify_gen.m:
compiler/opt_debug.m:
compiler/prog_rep.m:
compiler/rl_exprn.m:
compiler/switch_util.m:
compiler/unify_gen.m:
Trivial changes to handle the new cons_id, goal feature and/or
proc_info argument.
compiler/rtti.m:
Add a utility predicate for extracting pred_id and proc_id from an
rtti_proc_label, for use by hlds_out.m
compiler/layout.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/llds_common.m:
Add support for proc_static and call_site_static structures.
compiler/layout_out.m:
compiler/llds_out.m:
Add code for the output of proc_static structures.
compiler/code_util.m:
Make code_util__make_proc_label_from_rtti a function, and export it.
util/mkinit.c:
compiler/llds_out.m:
compiler/layout.m:
compiler/modules.m:
Add support for a fourth per-module C function, for writing out
proc_static structures (and the call_site_static structures they
contains).
Since proc_static structures can be referred to from LLDS code (and not
just from other static structures and compiler-generated C code),
reorganize the declarations of static structures slightly.
Change the schema for the name of the first per-module C function
slightly, to make it the addition of the fourth function easier.
The scheme now is:
mercury__<modulename>__init
mercury__<modulename>__init_type_tables
mercury__<modulename>__init_debugger
mercury__<modulename>__write_out_proc_statics
Improve formatting of the generated C code.
library/*.m:
runtime/mercury.c:
runtime/mercury_context.c:
runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
trace/mercrury_trace.[ch]:
trace/mercrury_trace_declarative.c:
trace/mercrury_trace_external.c:
trace/mercrury_trace_internal.c:
Conform to the new scheme for initialization functions for hand-written
modules.
compiler/mercury_compile.m:
library/benchmarking.m:
runtime/mercury_conf_param.h:
runtime/mercury.h:
runtime/mercury_engine.c:
runtime/mercury_goto.c:
runtime/mercury_grade.h:
runtime/mercury_ho_call.c:
runtime/mercury_label.[ch]:
runtime/mercury_prof.[ch]:
Add an MR_MPROF_ prefix in front of the C macros used to control the
old profiler.
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Make deep profiling completely separate from the old profiling system,
by making the deep profiling grade independent of MR_MPROF_PROFILE_TIME
and the compiler option --profile-time.
library/array.m:
library/builtin.m:
library/std_util.m:
runtime/mercury_hand_unify_body.h:
runtime/mercury_hand_compare_body.h:
In deep profiling grades, wrap the deep profiling call, exit, fail
and redo codes around the bodies of hand-written unification
and comparison procedures.
Make the reporting of array bounds violations switchable between
making them fatal errors, as we currently, and reporting them by
throwing an exception. Throwing an exception makes debugging code
using arrays easier, but since exceptions aren't (yet) propagated
across engine boundaries, we keep the old behaviour as the default;
the new behaviour is for implementors.
runtime/mercury_deep_profiling_hand.h:
New file that defines macros for use in Mercury predicates whose
definition is in hand-written C code.
library/exception.m:
runtime/mercury_exception_catch_body.h:
runtime/mercury_stacks.h:
In deep profiling grades, wrap the deep profiling call, exit, fail
and redo codes around the bodies of the various modes of builtin_catch.
Provide a function that C code can use to throw exceptions.
library/benchmarking.m:
library/exception.m:
library/gc.m:
library/std_util.m:
runtime/mercury_context.[ch]:
runtime/mercury_engine.[ch]:
runtime/mercury_debug.c:
runtime/mercury_deep_copy.c:
runtime/mercury_overflow.h:
runtime/mercury_regs.h:
runtime/mercury_stacks.h:
runtime/mercury_thread.c:
runtime/mercury_wrapper.c:
Add prefixes to the names of the fields in the engine and context
structures, to make code using them easier to understand and modify.
runtime/mercury_deep_profiling.[ch]:
New module containing support functions for deep profiling and
functions for writing out a deep profiling data file at the end of
execution.
runtime/mercury_debug.[ch]:
Add support for debugging deep profiling.
Add support for watching the value at a given address.
Make the buffered/unbuffered nature of debugging output controllable
via the -du option.
Print register contents only if -dr is specified.
runtime/mercury_goto.h:
runtime/mercury_std.h:
Use the macros in mercury_std.h instead of defining local variants.
runtime/mercury_goto.h:
runtime/mercury_stack_layout.h:
runtime/mercury_stack_trace.c:
runtime/mercury_tabling.c:
trace/mercury_trace.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_vars.c:
Standardize some of the macro names with those used in the debugger
paper.
runtime/mercury_heap.h:
Add support for memory profiling with the deep profiler.
runtime/mercury_prof.[ch]:
runtime/mercury_prof_time.[ch]:
Move the functionality that both the old profiler and the deep profiler
need into the new module mercury_prof_time. Leave mercury_prof
containing stuff that is only relevant to the old profiler.
runtime/mercury_prof.[ch]:
runtime/mercury_strerror.[ch]:
Move the definition of strerror from mercury_prof to its own file.
runtime/mercury_wrapper.[ch]:
Add support for deep profiling.
Add suppory for controlling whether debugging output is buffered or
not.
Add support for watching the value at a given address.
runtime/Mmakefile:
Mention all the added files.
scripts/mgnuc.in:
Add an option for turning on deep profiling.
Add options for controlling the details of deep profiling. These
are not documented because they are intended only for benchmarking
the deep profiler itself, for the paper; they are not for general use.
tools/bootcheck:
Compile the deep_profiler directory as well as the other directories
containing Mercury code.
Turn off the creation of deep profiling data files during bootcheck,
since all but one of these in each directory will be overwritten
anyway.
Add support for turning on --keep-objs by default in a workspace.
tools/speedtest:
Preserve any deep profiling data files created by the tests.
trace/mercury_trace.c:
Trap attempts to perform retries in deep profiling grades, since they
would lead to core dumps otherwise.
util/Mmakefile:
Avoid compile-time warnings when compiling getopt.
tests/*/Mmakefile:
tests/*/*/Mmakefile:
In deep profiling grades, switch off the tests that test features
that don't work with deep profiling, either by design or because
the combination hasn't been implemented yet.
Estimated hours taken: 0.25
Mmakefile:
Fix a bug in my recent change to build the sources in
extras/dynamic_linking: we can't use $(SUBDIR_MMAKE), since
that uses `../scripts', whereas for the extras/dynamic_linking
directory, we need `../../scripts'. Instead define a new
variable SUBSUBDIR_MMAKE, and use that.
Estimated hours taken: 1
Eliminate the code duplication problem with the source files
in the extras/dynamic_linking and browser directories.
extras/dynamic_linking/dl.m:
extras/dynamic_linking/name_mangle.m:
Remove these from the cvs repository.
extras/dynamic_linking/Mmakefile:
Add rules to build dl.m and name_mangle.m from
the copies in the browser directory.
Mmakefile:
Make sure to build the .m files in the extras/dynamic_linking
directory before creating the extras distribution.
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 version 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.
RATIONALE
The main advantage is improved compilation speed.
(The improvement is not huge, since the current front-end is so slow,
but improving the speed of the back-end increases the incentive to
improve the speed of the front-end, since it means that any increases
in the speed of the front-end will get bigger overall speedups.)
Another advantage is that it gives us more opportunity to give the GCC
back-end information about how to optimize the code that we generate.
For example:
- We can tell GCC when it is safe to treat function calls
as tail calls. (The gcc back-end already has some support
for doing tail calls. But its check to determine when
it is safe to do them is much too conservative for Mercury.
I've been working on extending the gcc back-end infrastructure
so that front ends can tell the gcc back-end when it is safe.)
- We can use `__builtin_{set,long}jmp' rather than ordinary
`{set,long}jmp'. (We can also do this for the C back-end,
as it happens, since those are supported in GNU C too, but
I wouldn't have found out about it if not for doing this
back-end.) Or we can use gcc's exception handling;
the gcc developers have told me that using exception
handling may be more efficient on some platforms.
- We can mark GC_malloc as an allocation function,
so that GCC knows that stuff allocated with it won't
alias other pointers.
- In general we could give GCC more information about aliasing.
I haven't investigated this much yet, but I think the GCC
back-end has support for keeping track of alias sets and
recording which set each pointer points to and which sets
may be subsets of which other sets.
Another advantage is that it provides a demonstration of how to
compile logic languages or functional languages using the GNU C
back-end. This may be useful to researchers or open-source developers
who are working on other languages.
It is also good public relations, because it removes one more
barrier towards acceptance of Mercury. Some people want a language
implementation that has a "native code compiler", and don't want one
that compiles via C. These people may be more willing to consider
Mercury now.
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: 8
Add options to configure that allow the user to specify the set of library
grades to be installed more precisely.
configure.in:
Add an option --enable-libgrade=<gradelist> that specifies
the list of library grades precisely.
Add an option, --disable-most-grades, that reduces the installed
grades to a "minimum" level for developers (asm_fast.gc,
asm_fast.gc.debug.tr and hlc.gc), since this is useful to minimize
installation time e.g. when installing a release of the day on a
laptop.
Add an option, --disable-nogc-grades, that prevents the installation
of grades without garbage collection.
Add an option, --disable-prof-grades, that prevents the installation
of profiling grades.
Add an option, --disable-trail-grades, that prevents the installation
of trailing grades.
Add an option, --disable-pair-grades, that prevents the installation
of thread-safe grades.
.INSTALL.in:
Mention the new configure options, as well as some previously
undocumented old ones.
scripts/canonical_grade.in:
A new script to be used by configure.in. Its jobs is to print the
canonical version of a grade string.
scripts/canonical_grade.sh-subr:
A new sh subroutine, containing code previously from ml.in that is
now also needed by canonical_grade.in.
scripts/ml.in:
Move code from here to canonical_grade.sh-subr.
Mmakefile:
Include scripts/canonical_grade in tar files, since configure.in
needs it.
bindist/Mmakefile:
Include scripts/canonical_grade in binary distributions, since
configure.in needs it.
trax/board.m:
Remove this file, since it doesn't belong here.
Mmakefile:
Ensure that the empty `trax' directory doesn't get included
in the source distribution.
Estimated hours taken: 0.5
Mmakefile:
Include scripts/Mmake.vars.in, so that we pick up the right
configuration settings (e.g. --prefix), rather than using the
configuration settings from the old `mmake' that we're installing with.
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: 8
When generating the .dv and .dep files use autoconfed settings for
such things as: object and library file extensions, and how to create a
library. Change the compiler Mmakefiles to handle files with the new
extensions.
compiler/modules.m:
When generating the '.dv' and '.dep' files use '.$O' and '.$A'
instead of '.o' and '.a'. Use $EXT_FOR_EXE when generating the
realclean target, as you need to pass the full file name to rm.
Use $AR_LIBFILE_OPT when creating libraries.
scripts/Mmake.vars.in:
Set the value EXT_FOR_EXE, which is the extension which must be
placed on executables.
Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
scripts/Mmake.rules:
tools/bootcheck:
trace/Mmakefile:
Use '.$O' for '.o' and '.$A' for '.a'.
util/Mmakefile:
You need to remove PROGFILENAMES not PROGS, as PROGFILENAMES
includes the executable extension.
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: 1
configure.in:
When testing whether the installed compiler is sufficiently up-to-date,
use `--high-level-code', since the installation process now requires
the compiler to generate .dep files that support --high-level-code.
Mmakefile:
In the rule for `install_grades', override MC with `mmc',
so that we build the different grades of the libraries
using the newly installed compiler rather than the bootstrap
compiler.
Estimated hours taken: 0.25
Mmakefile:
scripts/Mmake.rules:
In the rule for `install_grades', invoke `install_hdrs',
so that we install the header files too, not just the
`.a' and `.so' files. This is needed for MLDS grades.
Estimated hours taken: 0.5
Fix a couple of bugs in my recent change to fix the Mmake rules
for `make install' for the MLDS back-end.
compiler/modules.m:
Fix a bug that broke the non-MLDS installs:
when we're generating the `.dep' file for a non-MLDS grade,
make sure that the `install_hdrs' target has no dependencies.
Mmakefile:
Fix a bug that broke `mmake install_split_library':
in the rule for `install_split_library', make sure to
run `mmake depend' in the library directory before
running `mmake install_split_library' there.
Estimated hours taken: 3
Change the Mmake rules for `mmake install' so that they install the
compiler-generated header files for MLDS grades.
compiler/modules.m:
Generate a new rule for `lib<module>.install_hdrs' in the `.dep' files.
If --high-level-code is enabled, this rule installs the header
files, otherwise it does nothing.
scripts/Mmake.rules:
Make `lib<module>.install' depend on `lib<module>.install_hdrs'.
library/Mmakefile:
- Override the default definition of `mercury.hs', so that
the header file names include the `mercury.' prefix that
the MLDS back-end uses for header files in the standard library.
- Simplify the code by using the automatically generated rule for
`liblibrary.install_ints' rather than hand-coding it, and by
using `install_lib_dirs' and `install_grade_dirs' (which
are defined by scripts/Mmake.rules) rather than hand-coding
a rule for `install_dirs'.
Mmakefile:
scripts/Mmake.rules:
scripts/mercury_cleanup_install:
In the rules for `mmake install_grades', make sure to move
the `.h' and `.dep' files out of the way too, like we do for the
`.c', `.o', etc. files, since the contents of the `.h' and `.dep'
files now depend on the grade.
Estimated hours taken: 0.5
mercury/Mmakefile:
dep_browser should depend on the mdb.dep file.
This fixes a bug where the current rotd would fall over attempting
to make the dependencies in the browser directory before a version
of the compiler existed!