Estimated hours taken: 6
Add a `--debug' option for Mercury-level debugging
using the trace-based debugger.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
Split the old `--debug' option into `--low-level-debug'
(formerly the absence of -DSPEED, now handle by -DLOWLEVEL_DEBUG)
and `--c-debug' (passes -g to C compiler).
Delete the old `debug' grade.
Add support for new options `--require-tracing'
(makes --trace minimum equivalent to --trace interfaces,
and passes -DMR_REQUIRE_TRACING to C compiler)
`--stack-trace' (passes -DMR_STACK_TRACE to C compiler;
actually this one was already supported)
and `--debug' (implies previous two),
with corresponding grade modifiers `.trace', `.strce', and `.debug'.
Actually I think there's little point in specifying just one
of `--require-tracing' and `--stack-trace' so for the moment
I'm just providing `--debug': the code for the more fine-grained
options and grade modifiers has been added but commented out.
runtime/mercury_conf_param.h:
Document the new configuration parameter MR_REQUIRE_TRACING
and the existing but undocumented parameter MR_STACK_TRACE.
runtime/mercury_grade.h:
Include MR_REQUIRE_TRACING in the mangled grade identifier.
compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
Allow new tracing type `--trace default', and make it the default.
This gets replaced with `full' if require_tracing is yes
or `minimal' if require_tracing is no.
Also `--trace minimum' gets replaced with `interface' if
require_tracing is yes.
doc/user_guide.texi:
Document the new `--debug', `--low-level-debug', and `--c-debug'
options.
scripts/mgnuc.in:
compiler/mercury_compile.m:
doc/user_guide.texi:
Change things so that `--c-debug' does not imply `--no-c-optimize'.
configure.in:
Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on alpha-*.
Empirically, this seems to be needed, otherwise lots of
the test cases fail when compiled with `--no-c-optimize'.
(It might also be needed for other architectures, I don't know.)
Estimated hours taken: 1
Fix two security holes in the way temporary files in /tmp are handled.
configure.in:
Look for mktemp.
scripts/ml.in:
Previously, if a file /tmp/ml$$ existed, linker errors would
be missed (or fake linker errors could be provided).
Use
mkdir /tmp/ml.$$ || exit 1
approach to create a directory, then use a file in that
directory as the fifo for linker errors.
scripts/mmake.in:
Previously, if a file /tmp/mmake.$$ existed, it would stop
the generation of a mmake file, and the system would invoke
gmake on the existing file (possibly executing arbitrary
commands).
Use mktemp (if available) to create the file, and exit if
it is not possible to create the file.
If mktemp is not available, use mkdir || exit 1 technique.
Estimated hours taken: 0.1
scripts/ml.in:
Fix a bug (missing backslash before "`" in an error message)
reported by Kevet Duncombe <dunc@acm.org>.
Apparently this bug broke things on FreeBSD 2.2.5.
Estimated hours taken: 0.5
Fix the handling of the default linking options (shared or static).
Under Linux, the default linkage is supposed to be static, but
only the linkage of the mercury libraries was being set, so
if you tried to link with another library, you needed to add
-static by hand.
Note that this will link in other libraries (such as the C library)
statically as well.
scripts/ml.in:
Set link flags after handling options, so the flags are
only set in one place.
Add default handling for -static and -shared, previously
there were only defaults for --mercury-libs static/shared.
README.Linux:
Document that you should use --shared, not just --mercury-libs
shared, if you want to link statically against other libraries.
Estimated hours taken: _____
<overview or general description of changes>
<directory>/<file>:
<detailed description of changes>
Estimated hours taken: 40 (+ unknown time by Zoltan)
Add support for memory profiling.
(A significant part of this change is actuallly Zoltan's work. Zoltan
did the changes to the compiler and a first go at the changes to the
runtime and library. I rewrote much of Zoltan's changes to the runtime
and library, added support for the new options/grades, added code to
interface with mprof, did the changes to the profiler, and wrote the
documentation.)
[TODO: add test cases.]
NEWS:
Mention support for memory profiling.
runtime/mercury_heap_profile.h:
runtime/mercury_heap_profile.c:
New files. These contain code to record heap profiling information.
runtime/mercury_heap.h:
Add new macros incr_hp_msg(), tag_incr_hp_msg(),
incr_hp_atomic_msg(), and tag_incr_hp_atomic_msg().
These are like the non-`msg' versions, except that if
PROFILE_MEMORY is defined, they also call MR_record_allocation()
from mercury_heap_profile.h to record heap profiling information.
Also, fix up the indentation in lots of places.
runtime/mercury_prof.h:
runtime/mercury_prof.c:
Added code to dump out memory profiling information to files
`Prof.MemoryWords' and `Prof.MemoryCells' (for use by mprof).
Change the format of the `Prof.Counts' file so that the
first line says what it is counting, the units, and a scale
factor. Prof.MemoryWords and Prof.MemoryCells can thus have
exactly the same format as Prof.Counts.
Also cleaned up the interface to mercury_prof.c a bit, and did
various other minor cleanups -- indentation changes, changes to
use MR_ prefixes, additional comments, etc.
runtime/mercury_prof_mem.h:
runtime/mercury_prof_mem.c:
Rename prof_malloc() as MR_prof_malloc().
Rename prof_make() as MR_PROF_NEW() and add MR_PROF_NEW_ARRAY().
runtime/mercury_wrapper.h:
Minor modifications to reflect the new interface to mercury_prof.c.
runtime/mercury_wrapper.c:
runtime/mercury_label.c:
Rename the old `-p' (primary cache size) option as `-C'.
Add a new `-p' option to disable profiling.
runtime/Mmakefile:
Add mercury_heap_profile.[ch].
Put the list of files in alphabetical order.
Delete some obsolete stuff for supporting `.mod' files.
Mention that libmer_dll.h and libmer_globals.h are
produced by Makefile.DLLs.
runtime/mercury_imp.h:
Mention that libmer_dll.h is produced by Makefile.DLLs.
runtime/mercury_dummy.c:
Change a comment to refer to libmer_dll.h rather than
libmer_globals.h.
compiler/llds.m:
Add a new field to `create' and `incr_hp' instructions
holding the name of the type, for heap profiling.
compiler/unify_gen.m:
Initialize the new field of `create' instructions with
the appropriate type name.
compiler/llds_out.m:
Output incr_hp_msg() / tag_incr_hp_msg() instead of
incr_hp() / tag_incr_hp().
compiler/*.m:
Minor changes to most files in the compiler back-end to
accomodate the new field in `incr_hp' and `create' instructions.
library/io.m:
Add `io__report_full_memory_stats'.
library/benchmarking.m:
Add `report_full_memory_stats'. This uses the information saved
by runtime/mercury_heap_profile.{c,h} to print out a report
of memory usage by procedures and by types.
Also modify `report_stats' to print out some of that information.
compiler/mercury_compile.m:
If `--statistics' is enabled, call io__report_full_memory_stats
at the end of main/2. This will print out full memory statistics,
if the compiler was compiled with memory profiling enabled.
compiler/options.m:
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/ml.in:
scripts/mgnuc.in:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Add new option `--memory-profiling' and new grade `.memprof'.
Add `--time-profiling' as a new synonym for `--profiling'.
Also add `--profile-memory' for more fine-grained control:
`--memory-profiling' implies both `--profile-memory' and
`--profile-calls'.
scripts/mprof_merge_runs:
Update to handle the new format of Prof.Counts and to
also merge Prof.MemoryWords and Prof.MemoryCells.
profiler/options.m:
profiler/mercury_profile.m:
Add new options `--profile memory-words' (`-m'),
`--profile memory-cells' (`-M') and `--profile time' (`-t').
Thes options make the profiler select a different count file,
Prof.MemoryWords or Prof.MemoryCells instead of Prof.Counts.
specific to time profiling.
profiler/read.m:
profiler/process_file.m:
profiler/prof_info.m:
profiler/generate_output.m:
Update to handle the new format of the counts file.
When reading the counts file, look at the first line of
the file to determine what is being profiled.
profiler/globals.m:
Add a new global variable `what_to_profile' that records
what is being profiled.
profiler/output.m:
Change the headings to reflect what is being profiled.
doc/user_guide.texi:
Document memory profiling.
Document new options.
doc/user_guide.texi:
compiler/options.m:
Comment out the documentation for `.proftime'/`--profile-time',
since doing time and call profiling seperately doesn't work,
because the code addresses change when you recompile with a
different grade. Ditto for `.profmem'/`--profile-memory'.
Also comment out the documentation for
`.profcalls'/`--profile-calls', since it is redundant --
`.memprof' produces the same information and more.
configure.in:
Build a `.memprof' grade. (Hmm, should we do this only
if `--enable-all-grades' is specified?)
Don't ever build a `.profcalls' grade.
Estimated hours taken: 0.25
scripts/ml.in:
Make the user's `-R' (`-rpath') options precede the Mercury ones.
This allows the user to use their own local copies of the
Mercury shared libraries.
compilation model options as mmc.
Allow the user to mix `--grade foo' options with
other options that affect the grade such as `--profiling'.
Compute the final grade to link with from the options.
Also add a few new options and grade modifiers.
compiler/options.m:
compiler/mercury_compile.m:
Add `--profile-time' and `--profile-calls' options.
Change `--profiling' to now just imply both of those.
Add `--pic-reg' option (just implies `-DPIC_REG' in cflags).
compiler/handle_options.m:
Add support for grade modifiers `.proftime' and `.profcalls'.
Make `.debug' a grade modifier, rather than having a base
grade `debug'.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
New files containing sh subroutines for parsing grade-related
options.
configure.in:
bindist/bindist.configure.in:
Use AC_SUBST_FILE to allow #inclusion of the above-mentioned
`.sh-subr' files.
scripts/ml.in:
scripts/mgnuc.in:
Use the above-mentioned sh subroutines.
scripts/ml.in:
compiler/mercury_compile.m:
compiler/handle_options.m:
Compute the final grade to link with from the various
grade-related options.
scripts/mgnuc.in:
Support the `--inline-alloc' option.
doc/user_guide.texi:
README.Linux:
Document the above changes.
Estimated hours taken: 0.5
scripts/ml.in:
For Linux, make `--make-shared-lib' imply `--mercury-libs shared',
since on Linux the shared and non-shared grades are not compatible.
Estimated hours taken: 0.25
Fix a bug that broke things on SunOS 4.x.
scripts/ml.in:
Don't pass -rpath options unless the system supports shared
libraries.
Estimated hours taken: 2
Add support to `ml' for creating and using shared libraries.
scripts/ml.in:
- Change the `--shared' option so that it does not pass
`-shared' to $CC. This is because passing `-shared' to gcc
would have the effect of *creating* a shared library, but
ml's documentation for `--shared' says that it means the
generated executable should *use* shared libs. Also rename
the variable $SHARED_OR_STATIC_OPT as $MAYBE_STATIC_OPT,
since the previous name was now misleading.
- Add a new option `--make-shared-lib', for creating shared libraries.
This is to allow users to create their own shared libraries.
- Add a new option `-R<dir>' / `--shared-lib-directory', that
adds a directory to the RPATH used by the dynamic linker to
search for shared libraries. This is to allow users to link
in their own shared libraries.
They weren't working because Linux requires the `-rpath' option
be specified when linking the shared libraries, as well as when
linking executables. Previously we only passed `-rpath' option
when linking executables.
configure.in:
Mmake.common.in:
bindist/bindist.build_vars.in:
Add new configuration variables for handling `-rpath' or `-R' options:
EXE_RPATH_OPT, EXE_RPATH_SEP, SHLIB_RPATH_OPT, and SHLIB_RPATH_SEP.
scripts/ml.in:
Rewrite the system-specific code for handling rpaths
to instead use the new rpath configuration variables.
library/Mmakefile:
runtime/Mmakefile:
When linking shared libraries that depend on other shared libraries,
pass appropriate rpath options using the rpath configuration variables.
Estimated hours taken: 0.1
scripts/ml.in:
Allow `*-cygwin32' as a another name for Windows running gnu-win32,
since that is the name that `config.guess' outputs.
in gc 4.11 meant that `ml -static' didn't work on Linux, because
you got unresolved references to _DYNAMIC in dyn_load.o.
scripts/ml.in:
If we're passed `-static' or `--static', then pass
`-static -Wl,-defsym,_DYNAMIC=0' to gcc, so that gcc
will pass `-defsym _DYNAMIC=0' to the linker.
Estimated hours taken: 0.25
scripts/ml.in:
Fix a bug in the code to parse the new -static, --static, -shared and
--shared options: add in some missing `shift' statements.
Estimated hours taken: 1
Some work towards making it easier to use shared libraries on Linux.
scripts/ml.in:
Add a `--mercury-libs {shared, static, none}' option
(`--mercury-libs none' replaces the old `--no-libs' option).
Add `--shared' and `--static' options.
Add a `--help' option.
Estimated hours taken: 0.5
One of several changes to add support for ELF shared libraries on Linux.
scripts/ml.in:
For i?86-*-linux*, pass the appropriate flags to the linker to
link in shared libraries, if there are any.
#endif
Estimated hours taken: 0.25
scripts/mc.in:
scripts/mgnuc.in:
scripts/ml.in:
Put @CC@ in quotes, so that it works in the case when someone
does `CC="gcc -some -options" configure'. Similarly for @MKFIFO@.
Estimated hours taken: 8 (to find the problem) + 0.25 (to fix it)
scripts/ml.in:
For gnu-win32, don't strip the executable by default, since
`gcc -s' seems to be broken on gnu-win32 for Windows NT.
Estimated hours taken: 1 summer studentship
scripts/ml.in:
Handle the new set of grades (*.cnstr).
scripts/mgnuc.in:
Pass -DCONSTRAINTS if the grade is *.cnstr
rename `libgc.prof.{a,so}' as `libgc_prof.{a,so}',
because SunOS 4.1.3 doesn't seem to like library names with `.' in them.
scripts/ml.in:
Link with -lgc_prof rather than -lgc.prof for `.prof' grades.
Estimated hours taken: 1
Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date.
(This change should hopefully fix a problem with the source distribution not
being able to bootstrap itself.)
Also a couple of minor tidy-ups.
scripts/mmake.in:
Export new variable MMAKE_MAKE_CMD, for use by Mmake.rules.
scripts/Mmake.rules:
In the rule for `.m' -> `.o', use a recursive invocatino of
make (via the MMAKE_MAKE_CMD variable) to build the `.c' file,
rather than unconditionally invoking `$(MCG)'.
scripts/.cvsignore:
Add Mmake.vars, since it is now automatically-generated.
scripts/ml.in:
Some stylistic changes: make sure that autoconf @var@ variables occur
only in assignments to shell variables at the start of the script,
not scattered throughout the body of the script.
scripts/ml.in:
Link with `-lmer -lmercury' not `-lmercury -lmer'.
The order matters: libmercury references things in libmer,
and each library is only searched once.
if configure can't find `mkfifo', configure will look for `mknod',
and set MKFIFO to `mkfifo_using_mknod', which is a new script
that basically just invokes `mknod $1 p'. Also, add a new
option --no-demangle; if this option is used, or if the system doesn't
have either `mknod' or `mkfifo', then demangling is disabled.
These changes are all because some systems (e.g. SunOS 4.1.3)
don't have `mkfifo'.
scripts/{mgnuc,ml}.in:
Don't hard-code /usr/contrib/lib/nonshared; instead,
use the value of the environment variable
MERCURY_NONSHARED_LIB_DIR - either its value at run time, or if
not set the value it had when configure was run, or failing
that, $PREFIX/lib/nonshared.
scripts/*.in:
Replace all uses of
... "$@" ...
with
case $# in
0) ... ...
*) ... "$@" ...
esac
since on ULTRIX and OSF, "$@" does the wrong thing if $# is 0.
scripts/mgnuc.in:
For efficiency, use shell builtins rather than calling /bin/true:
use `:' rather than `true' and use `case' rather than `if'.
scripts/ml.in:
By default, strip the executable.
(This speeds up linking considerably on systems without
shared libraries, and most of the time debugging information
is not used, since gdb doesn't support Mercury yet anyway.)
Add -g / --no-strip option to suppress stripping.
Use `case' rather than `if', for efficiency.
scripts/ml.in:
Remove some old special-case stuff (if $host = kryten ...).
Change it so that it uses $CC as determined by configure
rather than hard-coding gcc.
Use a named pipe to invoke the demangler, so that we
return the exit status of the C compiler, not the demangler.
Add a new option --no-libs which suppresses the linking
in of the libraries; this is useful if you want to link
a shared library and have the output of the linker passed
through the demangler.
scripts/mmake.in:
Use a new environment variable MMAKE_DIR as the location to
look for both Mmake.vars and Mmake.rules; this is simpler than
use the MMAKE_VARS and MMAKE_RULES environment variables.
mgnuc.in:
Use @CC@ from configure rather than `gcc'.
(We still require gcc, though, since we pass a lot
of gcc-specific options.)
Remove the site-specific kludges for finding `gcc'.
NB: Zoltan, this means that you need to explicitly
add `-msupersparc' to the MGNUCFLAGS for benchmarking.
Also, on Irix 5 we need to pass `-mno-abicalls' to
turn off shared libraries for the grades which use
gcc non-local gotos.
mc.in:
Use @CC@ from configure, and pass it use the --cc option.
ml.in:
For Irix 5, we need to pass `-non_shared' for the grades which use
gcc non-local gotos, and we also need to export a LIBRARY_PATH
which points to the nonshared libraries.
{mc,ml,mgnuc,mmake}.in:
Use MERCURY_DEFAULT_GRADE, with a default value @DEFAULT_GRADE@
determined by configure, rather than hard-coding asm_fast.gc as
the default grade.
mmake.in:
Update the documentation.