Commit Graph

771 Commits

Author SHA1 Message Date
Julien Fischer
8919bc1fc1 Fix the Mmakefile in the scripts directory.
Estimated hours taken: 0.1
Branches: main

Fix the Mmakefile in the scripts directory.

scripts/Mmakefile:
	Remove a reference to the recently deleted mercury_cleanup_install
	script.

	`mtags' is now generated by configure.

scripts/.cvsignore:
	Conform to recent changes.
2008-02-26 15:15:04 +00:00
Zoltan Somogyi
a55a04097b Currently we prepare all grades for installation inside one directory, tmp_dir,
Estimated hours taken: 1
Branches: main

Currently we prepare all grades for installation inside one directory, tmp_dir,
so that once we are finished installing one grade, we have to delete it
to make room for the next. This diff prepares each grade in its own install
directory, so that we can *leave* all the install directories to be included
in a source distribution. (This diff does not do that last step.)

Mmakefile:
	Make the above change.

scripts/prepare_tmp_dir_fixed_part.in:
scripts/prepare_tmp_dir_grade_part:
	Delete these scripts, since there is no longer a "fixed part" of files
	in the shared tmp dir that is used for all grades.

scripts/prepare_install_dir.in:
	Replace them both with this script, which does both their jobs.

configure.log:
	Do substitutions in prepare_tmp_dir, not prepare_tmp_dir_fixed_part.

scripts/mercury_cleanup_install:
	This script has long been obsolete, so remove it.
2008-02-25 07:21:21 +00:00
Peter Wang
ef81b66625 Move the intermodule analysis framework into the `compiler' directory, in
Estimated hours taken: 2
Branches: main

Move the intermodule analysis framework into the `compiler' directory, in
preparation for making it specific to the Mercury compiler, rather than having
it generic in case some fictional being might want to use it with a .NET
compiler one day.  This will make it easier to use and modify.

compiler/analysis.file.m:
compiler/analysis.m:
	Copy these files from the `analysis' directory.

compiler/top_level.m:
	Include analysis.m as a new package.

compiler/Mercury.options:
	Add a bug workaround line from analysis/Mercury.options.

analysis/Mercury.options:
analysis/Mmakefile:
analysis/analysis.file.m:
analysis/analysis.m:
analysis/mer_analysis.m:
	Replace the contents of these files with comments that the analysis
	framework is now in the `compiler' directory.  We don't actually
	delete them so their histories remain easily accessible.

analysis/README:
	Mention that the code has been moved.

compiler/notes/compiler_design.html:
compiler/notes/overall_design.html:
	Update documentation.

Mmake.workspace:
Mmakefile:
configure.in:
compiler/.mgnuc_copts:
compiler/COMP_FLAGS.in:
compiler/Mmakefile:
deep_profiler/.mgnuc_copts:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/mercury_config.in:
scripts/prepare_tmp_dir_fixed_part.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/lmc.in:
tools/make_arena:
compiler/notes/coding_standards.html:
	Remove references to the `analysis' directory and `libmer_analysis'.
2008-02-20 03:10:00 +00:00
Julien Fischer
4212e2c7d6 In trailing grades, pass flags to the C compiler that force it to align
Estimated hours taken: 6
Branches: main

In trailing grades, pass flags to the C compiler that force it to align
functions on word boundaries.  For some architectures, and for some C compiler
optimisation settings, function addresses are not aligned and this breaks
function trailing when using tagged trail entries.

XXX this diff only fixes the problem for gcc, it's not clear what,
if anything, needs to be done for other C compilers.

configure.in:
	s/COMPILER/C_COMPILER_TYPE/.  The former is ambiguous as
	Mercury uses compilers for several languages.

	Instantiate the value of C_COMPILER_TYPE in files generated
	by the configure script.

	Add an XXX comment about how the type of the C compiler
	is determined.

	Clean up a few things.

compiler/globals.m:
	Define a type, c_compiler_type/0, that represents the type
	of C compiler we are using.  (This type replaces the old
	compiler_type/0 type from compile_target_code.m).

	Add a new field to the globals structure that stores the
	C compiler type.

	Add access and utility procedures for the new field.

	Delete some business with unique modes that used to be
	required when the I/O globals field was unique.

compiler/options.m:
	Simplify the implementation of `--c-compiler-type'.
	Most of it is now handled by the globals module.

scripts/Mercury.config.in:
	Define a new variable MERCURY_C_COMPILER_TYPE, whose value
	is set by the configuration script.

	Pass the C compiler type to the Mercury compiler.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	When in a trailing grade and using gcc as a C compiler align
	functions on word boundaries in order to avoid problems
	with function trailing.

	Delete the unused type compiler_type/0.

tests/trailing/Mercury.options:
	Remove a workaround for the function alignment problem.
2008-01-23 13:12:17 +00:00
Julien Fischer
0784244669 Make Mercury use shared libraries by default on Linux/x86.
Estimated hours taken: 1
Branches: main

Make Mercury use shared libraries by default on Linux/x86.

Document that Mercury no longer supports a.out format executables on Linux.
(It's unlikely that the current version of Mercury would work on any Linux system
that uses them anyway.)

configure.in:
	Make shared libraries the default on Linux/x86.

README.Linux:
	This file also covers the Linux/x86_64 port as well.

	Mention that a.out format executables are not supported on Linux.

	Delete most of the remainder of this file since it refers to things
	that are either out-of-date or covered in the user's guide anyway.


scripts/ml.in:
	Don't use static libraries on Linux/x86 by default.

	Update some comments.

NEWS:
	Announce this change.
2008-01-17 00:17:19 +00:00
Zoltan Somogyi
9e1c06af71 Fix a bug that prevented the compiler from bootstrapping in deep profiling
Estimated hours taken: 6
Branches: main

Fix a bug that prevented the compiler from bootstrapping in deep profiling
grades. The symptom was the violation of a sanity check in
mercury_deep_profiling.c, which lead to this message:

	Mercury runtime: UNWRITTEN nodes: Deep.data file corrupted

Mmake.workspace:
	Don't include the ssdb library's init file unconditionally in every
	_init.c file we generate; instead include the ssdb library's init file
	only in ssdb grades.

	The reason why this is needed is that the referenced but unwritten
	nodes were the proc layouts of three predicates in the browser
	directory. They were not written because the browser library's init
	file is (correctly) included in the compiler's _init.c file only if
	the browser library is linked into the compiler, i.e. only if the
	compiler is compiled in a debug grade. They were referenced by call
	site static structures from ssdb/ssdb.m, whose init file was
	(incorrectly) being included in the compiler's _init.c file even if
	the compiler wasn't being compiled in an ssdb grade.

scripts/parse_ml_options.sh-subr.in:
	Add the option needed by Mmake.workspace to add an init file only in an
	ssdb grade: --ssdb-init-file.

scripts/c2init.in:
	Act on the value of that option.

	Delete a reference to $TRACE_INIT_FILES, since it should always be
	empty. Document a similar problem with $EXTRA_INIT_FILES.

Mmakefile:
	Improve formatting.

compiler/layout_out.m:
	Avoid inconsistent indentation in the generated .c code.

tools/bootcheck:
	Add two options that helped track down the bug: --deep-all-write,
	which causes bootcheck to write out *every*deep profiling data file,
	and --deep-debug, which switches on the already existing deep profiling
	debug support.

runtime/mercury_deep_profiling.c:
	Put the two lines of the error message we generate for unwritten nodes
	if deep profiling's debug support is enabled in the logical order.
2007-12-23 23:57:20 +00:00
Ian MacLarty
da7e7ed873 Set the path to perl in mtags script using configure.
Estimated time taken: 0.1
Branches: main

Set the path to perl in mtags script using configure.

The current approach results in an error from /bin/sh on my system (ubuntu
7.10) when mtags is invoked from make, or with "/bin/sh -c 'mtags'":

    /bin/sh: Can't open mtags

configure.in:
    Generate mtags.

scripts/mtags:
    Delete.

scripts/mtags.in:
    Copied from mtags, except that the path to perl is now set using configure.
2007-12-18 22:35:36 +00:00
Zoltan Somogyi
c1f9d4c50e Fix a bug introduced with the last ssdb change to ml.in.
Estimated hours taken: 4
Branches: main

Fix a bug introduced with the last ssdb change to ml.in. The context of the bug
was the renaming of a bunch of sh variables from TRACE_xxx to TRACE_BASE_xxx
(for several values of xxx). The bug itself was that the defining occurrence
of one such variable (TRACE_LIBS_SYSTEM) was renamed, but a reference to it
(in the true arm of the switch of $trace_base) was not. The result was a
reference to an undefined variable, which the shell replaced with "".
Since $TRACE_LIBS_SYSTEM should have contained -ldl on some systems (including
my laptop), the upshot was that all attempts to link debuggable executables
failed, with the linker unable to find the definitions of the functions defined
in libdl.a.

scripts/ml.in:
	Fix that bug.

	Change to four-space indentation in order to avoid bad line breaks,
	though using tabs (for speed of interpretation) rather than spaces.

	Fix deviations from good sh programming style, including missing ;;s
	at the end of case arms.

configure.in:
	Rename TRACE_LIBS_SYSTEM to TRACE_BASE_LIBS_SYSTEM, since having the
	TRACE_BASE_LIBS_SYSTEM sh variable in ml.in get its value from a
	configure variable named TRACE_LIBS_SYSTEM is confusing (since ml.in
	also has a sh variable named TRACE_LIBS_SYSTEM).

scripts/ml.in:
scripts/Mercury.config.in:
scripts/Mercury.config.bootstrap.in:
	Conform to the change to configure.in.
2007-11-08 06:13:23 +00:00
Peter Wang
f6a72d45c3 Fix a comment that makes no sense because a preceding comment was
Estimated hours taken: 0
Branches: main

scripts/ml.in:
	Fix a comment that makes no sense because a preceding comment was
	deleted.
2007-11-01 06:11:32 +00:00
Peter Wang
4953e5e574 Update files as required for the addition of the new library `libmer_ssdb',
Estimated hours taken: 8
Branches: main

Update files as required for the addition of the new library `libmer_ssdb',
and make the changes to add a new grade component `ssdebug'.

Mmake.workspace:
Mmakefile:
	Add `mer_ssdb.init', `libmer_ssdb' and `ssdb' directory to the
	appropriate lists.

	Order "ssdb" occurrences according to its position in the list of
	which libraries can call functions in which other libraries.

configure.in:
	Check the bootstrap compiler supports the `--no-ssdb' option.

browser/MDB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
	Add `--no-ssdb' to break the cyclic dependencies between these
	libraries and `libmer_ssdb' that would be introduced if the
	source-to-source debugging transformation was applied these libraries.
	It also prevents the infinite recursion which would result from ssdb
	procedures calling transformed library procedures and vice versa.

analysis/.mgnuc_copts:
analysis/ANALYSIS_FLAGS.in:
analysis/Mmakefile:
profiler/.mgnuc_copts:
profiler/PROF_FLAGS.in:
slice/.mgnuc_copts:
slice/Mmakefile:
slice/SLICE_FLAGS.in:
	Search the `ssdb' directory for files.

compiler/Mmakefile:
	Remove the explicit `libmer_ssdb.a' from MLOBJS as it is redundant.

	Make the compiler binary depend on `libmer_ssdb'.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	Pass "-DMR_SS_DEBUG" when compiling a C file if `--ssdb' is enabled.

	Implicitly include `mer_ssdb.init' and `libmer_ssdb' in various lists
	when `--ssdb' is enabled.

runtime/mercury_conf_param.h:
	Document `MR_SS_DEBUG' preprocessor macro.

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:
	Add "ssdebug" grade component.

	Add "--ss-debug" option as an alias for "--ssdb" to be consistent with
	"--decl-debug".  Move the clauses to the right position.

scripts/c2init.in:
scripts/ml.in:
	Link in `libmer_ssdb' if `--ssdb' enabled.

tools/lmc.in:
tools/lml:
	Link in `libmer_ssdb' and add `mer_ssdb.init'.

tools/bootcheck:
	Delete `ssdb' directory if `--disable-debug-libs' option enabled.

tools/binary:
tools/linear:
	Link `ssdb' directory.

compiler/notes/overall_design.html:
	Mention `ssdb' directory.

doc/user_guide.texi:
	Add commented out documentation for the `--ss-debug' option and the
	`ssdebug' grade component.
2007-10-24 09:21:19 +00:00
Zoltan Somogyi
fb4b5c30a2 Allow the specification of RBMM debugging and profiling via grades.
Estimated hours taken: 2
Branches: main

Allow the specification of RBMM debugging and profiling via grades.

runtime/mercury_grade.h:
	Add rbmmd and rbmmp as grade components denoting RBMM with debugging
	and profiling respectively, while rbmmdp is RBMM with both.

compiler/options.m:
	Add --use-regions-debug and --use-regions-profiling as the Mercury
	compiler options specifying RBMM debugging and profiling.

compiler/handle_options.m:
compiler/compile_target_code.m:
runtime/mercury_conf_param.h:
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Handle the new grade components.

configure.in:
	Add the new option --enable-rbmm-grades, for use by Quan and me
	for now, that causes the installation of all four RBMM grades.
	Once RBMM is ready for use by non-implementors, we can change this
	to install only the rbmm grade, and not the rbmmd/rbmmp/rbmmdp grades.
2007-10-10 07:18:16 +00:00
Julien Fischer
8260131b7a Fix a typo.
Estimated hours taken: 0.1
Branches: main

Fix a typo.

scripts/prepare_tmp_dir_grade_part:
	s/sdb/ssdb/
2007-10-05 05:21:27 +00:00
Julien Fischer
6de3d7922c Fix a typo.
Estimated hours taken: 0.1
Branches: main

Fix a typo.

scripts/prepare_tmp_dir_grade_part:
	s/sddb/ssdb/
2007-10-05 04:03:57 +00:00
Julien Fischer
f13b7d677e Fix the `install_grades" target.
Estimated hours taken: 0.1
Branches: main

Fix the `install_grades" target.

scripts/prepare_tmp_dir_grade_part:
	Copy the ssdb directory to tmp_dir.
2007-10-04 07:31:23 +00:00
Peter Wang
f1956aa5ba Add $(MERCURY_MAIN_MODULES) to ALL_MC_BUILD_FILES only once if
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.vars.in:
	Add $(MERCURY_MAIN_MODULES) to ALL_MC_BUILD_FILES only once if
	EXT_FOR_EXE is undefined, to get rid of warnings from `make' about
	duplicate rules when running `mmake --use-mmc-make' in the test
	directories.

tests/hard_coded/Mmakefile:
	Remove a couple of duplicate targets.
2007-09-05 01:33:28 +00:00
Peter Wang
1cfbebfe8c Copy or link erlang_conf.hrl when making shadow copies of the library
Estimated hours taken: 0.1
Branches: main

scripts/prepare_tmp_dir_grade_part:
tools/bootcheck:
	Copy or link erlang_conf.hrl when making shadow copies of the library
	directory when bootchecking or building in different grades.
2007-08-15 04:01:08 +00:00
Ralph Becket
7fe94d8537 Fix mtags so that it handles declarations with existential type
Estimated hours taken: 0.25
Branches: main

scripts/mtags:
	Fix mtags so that it handles declarations with existential type
	qualifiers.
2007-08-05 23:20:06 +00:00
Julien Fischer
64b6c216dc Remove support for the reserve tag (.rt) grades.
Estimated hours taken: 1
Branches: main

Remove support for the reserve tag (.rt) grades.
These were only ever needed to support the implementation of Herbrand
variables in (older versions of) HAL.

NOTE: this change removes the .rt grade, the undocumented
reserve_tag pragma is unchanged.

runtime/mercury_grade.h:
	Do not handle the .rt component.  Rather than renumbering the
	grade parts here I have documented that grade part 8 (formerly .rt)
	is unused.

runtime/mercury_tags.h:
runtime/mercury_type_info.h:
runtime/mercury_conf_param.h:
	Conform to the above change.

compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
compiler/make_tags.m:
compiler/prog_type.m:
	Remove the `--reserve-tag' option and modify any code
	that relied upon it.  Such code is largely unchanged
	since it is still required for the implementation of the
	reserve_tag pragma.

doc/user_guide.texi:
	Delete documentation for `--reserve-tag'.

scripts/canonical_grade.sh-subr:
scripts/init_grade_otpions.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Remove support for the `.rt' grade component.

NEWS:
	Announce that .rt grades are no longer supported.

extras/trailed_update/var.m:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
	Update some documentation.

tests/debugger/Mmakefile:
tests/tabling/Mmakefile:
	Delete special handling for .rt grades.
2007-07-31 07:59:23 +00:00
Peter Wang
7fa0dff1b5 Add more documentation for the Erlang backend.
Estimated hours taken: 6
Branches: main

Add more documentation for the Erlang backend.

Make it possible to configure and install the Erlang backend without too
much manual tweaking.

NEWS:
	Mention the Erlang backend.

README.Erlang:
	Add installation and other notes for Erlang.

doc/reference_manual.texi:
doc/user_guide.texi:
	Add documentation for Erlang.

aclocal.m4:
configure.in:
	Check that the bootstrap compiler knows about the
	builtin_compound_{eq,lt} builtins, and understands
	--erlang-native-code.

	Make configure check for Erlang tools.

	Add configure --enable-erlang-grade option.  Erlang support
	is disabled by default.

scripts/Mercury.config.in:
	Add `--erlang-compiler <erl>' and `--erlang-interpreter <erlc>'
	options to be set by configure.

analysis/ANALYSIS_FLAGS.in:
compiler/COMP_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
	Add `--erlang-include-directory <dir>/Mercury/hrls' options so that
	the compiler can find Erlang header files from other subdirectories.

compiler/Mercury.options:
library/Mercury.options:
	Work around bugs in the HiPE compiler when compiling two modules.

	Delete the workaround that was necessary while bootstrapping
	builtin_compound_{eq,lt}.

compiler/options.m:
	Add notes that two options to check that the compiler is recent enough
	won't be recognised because they begin "no-" prefixes, and we have
	to use "--no-no-" instead.

compiler/options_file.m:
	Support ERLANG_FLAGS, EXTRA_ERLANG_FLAGS variables in options files to
	be the same as passing --erlang-flags.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
trace/Mmakefile:
	Make the build system do the same things in the Erlang grade as for
	the IL and Java grades.

scripts/final_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Make these scripts know about the erlang grade so that parts of the
	build system won't abort on seeing it.
2007-07-20 01:22:06 +00:00
Jonathan Morgan
665ea0786c Removed support for Managed C++ as a foreign language for the IL backend.
Estimated hours taken: 3
Branches: main

Removed support for Managed C++ as a foreign language for the IL backend.
This is being removed for the following reasons:
* It is only supported by Microsoft, making it harder to use code
using it with other CIL platforms (e.g. Mono).
* It is not used in any of the standard library (only C# and IL are used).
* Removing it will simplify the dependencies and the build process.
* Microsoft have deprecated it in favour of C++/CLI.

NEWS:
	Mentioned the change.

aclocal.m4:
	Remove checks for the Microsoft.NET C++ compiler.

compiler/globals.m:
	Delete Managed C++ from the set of supported languages.

compiler/mlds_to_managed.m:
	Remove support for Managed C++ code generation.

compiler/*.m:
	Remove all references to Managed C++.

runtime/Mmakefile:
runtime/mercury_mcpp.h:
	Remove the Managed C++ part of the Mercury runtime.

runtime/mercury_il.il:
runtime/mercury_typeclass_info.h:
runtime/mercury_type_info.h:
	Remove all references to Managed C++, including instructions to keep
	certain parts in sync with Managed C++ part of the runtime.

doc/reference_manual.texi:
	Remove the Managed C++ sections in the Foreign Language Interface
	chapter.

doc/user_guide.texi:
	Remove the documentation of Managed C++ related flags.

library/Mmakefile:
	Remove Managed C++ flag settings.

library/io.m:
	Remove commented out Managed C++ code.

library/list.m:
	Change a comment referring to Managed C++ to refer to C# instead.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Remove all rules and variables for Managed C++ from mmake.

tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/redoip_clobber.m:
	Replace Managed C++ code with C# code in the relevant tests.
2007-07-14 02:33:27 +00:00
Ian MacLarty
77a9eca744 Ignore lines that start with `#' in sourced mdb scripts.
Estimated hours taken: 1
Branches: main

Ignore lines that start with `#' in sourced mdb scripts.
This is useful for documenting mdb scripts.

Create a local copy of the mdbrc file so that we can test new mdb scripts
in the test suite.

NEWS:
	Mention the changes.

configure.in:
	Create a copy of mdbrc.in in the tests directory and create an mdbrc
	from this file using different substitutions than those used for the
	mdbrc that will be installed.  This is necessary so that we can use
	the local mdbrc file when running the tests.  Previously if the mdbrc
	file was changed (for example a new alias was added), then we had to
	install it before testing.

doc/user_guide.texi:
	Document the new behaviour of the source command.

scripts/mdb_grep:
scripts/mdb_open:
scripts/mdb_track:
	Add comments to these mdb scripts.

scripts/mdbrc.in:
	Use a different substitution variable for the location of mdb_doc,
	since for the test version of mdbrc mdb_doc will be in a different
	location to the other scripts.

tests/Mmake.common:
	Get mdb to use the local mdbrc when invoked for the tests.

	Clean mdbrc and mdbrc.in.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/debugger/scripts.exp:
tests/debugger/scripts.inp:
tests/debugger/scripts.m:
	Add a test case for the three existing mdb scripts.

trace/mercury_trace_readline.c:
trace/mercury_trace_readline.h:
	Rename MR_trace_readline_expand_args to MR_trace_readline_from_script
	and get it to ignore comment lines.

trace/mercury_trace_internal.c:
	Adapt to changes in mercury_trace_readline.h.
2007-06-19 03:12:51 +00:00
Julien Fischer
96bed0fef7 Ignore autoconf generated files and files generated
Estimated hours taken: 0.1
Branches: main

*/.cvsignore:
	Ignore autoconf generated files and files generated
	by the tests.
2007-06-15 12:51:48 +00:00
Julien Fischer
ada4e26dd1 Don't check .cvsignore for a copyright message.
scripts/.nocopyright:
	Don't check .cvsignore for a copyright message.
2007-06-15 12:51:42 +00:00
Julien Fischer
98aae3a961 Add a new grade component for use with region-based memory management.
Estimated hours taken: 1
Branches: main

Add a new grade component for use with region-based memory management.

runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
doc/user_guide.texi:
	Add the grade component `.rbmm' for use with region-based memory
	management.
2007-06-12 06:39:20 +00:00
Ian MacLarty
fa31f399ad Add an mdb `track' command. This command invokes an mdb script to start up
Estimated hours taken: 0.5
Branches: main

Add an mdb `track' command.  This command invokes an mdb script to start up
the declarative debugger, invoke the declarative debugger's `track' command
and then exits the declarative debugger.

NEWS:
	Mention the new command.

doc/mdb_categories:
doc/user_guide.texi:
	Document the new command.

scripts/Mmakefile:
	Install the new script.

scripts/mdb_track:
	Add the new script.

scripts/mdbrc.in:
	Add an alias for the new script.
2007-05-29 08:18:26 +00:00
Julien Fischer
7b1e546a84 Synchronize this file with Mercury.config.in.
Estimated hours taken: 0.1
Branches: main

scripts/Mercury.config.bootstrap.in:
	Synchronize this file with Mercury.config.in.  There were several
	updates made to the latter that were not reflected here.
2007-03-21 21:03:31 +00:00
Peter Ross
94af772351 Copy files which are needed to build the boehm_gc using MSVC.
Estimated hours taken: 0.1
Branches: main

scripts/prepare_tmp_dir_grade_part:
	Copy files which are needed to build the boehm_gc using MSVC.
2007-03-19 01:28:04 +00:00
Peter Wang
c98e978b4b Make it easy for the user to select single-precision floats instead of the
Estimated hours taken: 5
Branches: main

Make it easy for the user to select single-precision floats instead of the
default double-precision floats.  This can be done by using the `.spf' grade
component, or the option `--single-prec-float'.  Code using unboxed floats is
incompatible with code using boxed doubles, so we should have a grade for this.

NEWS:
	Mention the changes.

compiler/options.m:
	Add the `--single-prec-float' option (also `--single-precision-float').

	Comment out the documentation for `--unboxed-float'.  It shouldn't be
	necessary for users to use it directly any more.

compiler/handle_options.m:
	Handle the `.spf' grade component.

	Make `--single-prec-float' imply `--unboxed-float'.

compiler/compile_target_code.m:
	Pass `-DMR_USE_SINGLE_PREC_FLOAT' to the C compiler when
	single-precision floats are enabled.

doc/reference_manual.texi:
doc/user_guide.texi:
	Document `.spf' and `--single-prec-float'.

runtime/mercury_conf_param.h:
	Document `MR_USE_SINGLE_PREC_FLOAT' differently now that it is
	documented in the mmc help and manual.

runtime/mercury_float.h:
	Undefine `MR_BOXED_FLOAT' if `MR_USE_SINGLE_PREC_FLOAT' is defined.

runtime/mercury_grade.h:
	Update the macros that define the MR_GRADE macro to include "_spf"
	if `MR_USE_SINGLE_PREC_FLOAT' is defined.

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Update these scripts to support the `.spf' grade component and
	`--single-prec-float' command-line option.
2007-03-02 02:56:42 +00:00
Julien Fischer
26de67a4c4 Remove support for non-grade specific .init files.
Estimated hours taken: 0.5
Branches: main

Remove support for non-grade specific .init files.

browser/Mmakefile:
runtime/Mmakefile:
scripts/Mmake.rules:
compiler/make.program_target.m:
	Don't install the .init files in the non-grade specific location.
2006-12-04 01:33:29 +00:00
Julien Fischer
65bfb46299 Support user libraries and grade specific .init files with mmake.
Estimated hours taken: 1
Branches: main

scripts/Mmake.vars.in:
	Support user libraries and grade specific .init files with mmake.
2006-11-30 14:28:29 +00:00
Julien Fischer
c3d813a47b When building with mmc --make use the grade specific versions of the
Estimated hours taken: 4
Branches: main

When building with mmc --make use the grade specific versions of the
.init files.

Support grade specific .init files with --use-grade-subdirs.

compiler/compile_target_code.m:
	Use the grade specific version of the .init files for the Mercury
	standard libraries, i.e. rt, stdlib, browser, trace.

	If --use-grade-subdirs is enabled them symlink/copy .init files
	into the user's directory.

compiler/options.m:
	Delay handling the init file directories until after the grade
	has been computed.

compiler/handle_options.m:
	Append the grade to each init file directory, so that we get
	the grade specific version of the .init files.

	Unrelated changes: replace an if-then-else with a switch.
			   minor formatting changes.

compiler/modules.m:
	.init files are now grade dependent.

scripts/c2init.in:
	Use the grade specific version of the .init files for the
	standard Mercury libraries.
2006-11-30 12:45:48 +00:00
Zoltan Somogyi
9ec86d6a6d The objective of this diff is to switch from a table of solver events built
Estimated hours taken: 32
Branches: main

The objective of this diff is to switch from a table of solver events built
into the compiler (and eventually the debugger) into a table of events
defined by a file provided by the user to the compiler, which the compiler
then records in the executable for use by the debugger.

The current design, for speed of implementation, uses temporary files parsed
by a bison-generated parser. Since the compiler needs to be able to invoke
the parser even if it is compiled in a non-debug grade, the parser is in
a new library, the eventspec library, that is always linked into the Mercury
compiler and is always linked into any Mercury program with debugging enabled
(but is of course linked only once into a Mercury compiler which has debugging
enabled).

Modify the debugger to give it the ability to print the attributes of
user-defined events (for now, only the non-synthesized attributes).
Implement a new debugger command, "user", which goes to the next user-defined
event.

configure.in:
	Require flex and and bison to be available.

doc/user_guide.texi:
	Document user defined events and the new debugger capabilities.

doc/mdb_categories:
	Include "user" in the list of forward movement commands.

	Fix some earlier omissions in that list.

runtime/mercury_stack_layout.h:
	Include an event number in the user-defined event structure.

	Include a string representing an event set specification in module
	layout structures.

runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.[ch]:
runtime/mercury_types.h
	Switch from solver events to user events in names.

runtime/mercury_trace_term.[ch]:
	Provide a representation of flat terms, for use in representing
	the calls that generate synthesized attributes.

	Ensure that exported field names have an MR_ prefix.

browser/cterm.m:
	Conform to the change to runtime/mercury_trace_term.h.

scripts/c2init.in:
scripts/ml.in:
	Include the eventspec library in programs compiled with debugging
	enabled.

compiler/Mmakefile:
	Include the eventspec library in the compiler.

compiler/options.m:
	Add a new option, --event-spec-file-name, that allows the user to
	specify the set of user-defined events the program may use.

compiler/handle_options.m:
	Set this optimization from an environment variable (which may be
	set by the mmc script) if the new option is not explicitly given.

compiler/prog_data.m:
	Define the data structures for the compiler's representation of the
	event set specification.

	Move some definitions around to group them more logically.

compiler/hlds_module.m:
	Include the event set specification as a new field in the module_info.

compiler/prog_event.m:
	Add the code for invoking the parser in the eventspec library,
	and for converting the simple term output by the parser to the
	compiler own representation, which contains more information
	(to wit, the types of the function attributes) and which has had
	a whole bunch of semantic checks done on it (e.g. whether synthesized
	attributes depend on themselves or on nonexistent attributes).

	Provide a function to generate a canonicalized version of the event
	specification file.

compiler/module_qual.m:
compiler/equiv_type.m:
	Process event spec specifications as well as items, to module qualify
	the names of the types of event arguments, and expanding out
	equivalence types.

	In equiv_type.m, rename some variables to make clear what kind of info
	they represent.

compiler/mercury_compile.m:
	Process the event set specification file if one has been selected:
	read it in, module qualify it, expand its equivalence types, and add
	to the module_info.

compiler/compile_target_code.m:
	Include the event_spec library when linking debuggable executables.

compiler/call_gen.m:
compiler/continuation_info.m:
compiler/trace_gen.m:
compiler/trace_params.m:
mdbcomp/prim_data.m:
mdbcomp/trace_counts.m:
runtime/mercury_goto.h:
	Generate user-defined events instead of solver events.

compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
	Include a canonicalized version of the event specification file
	in the module layout if the module has any user-defined events.

compiler/code_info.m:
compiler/llds_out.m:
compiler/modes.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/typecheck.m:
	Conform to the changes above.

compiler/passes_aux.m:
	Rename a predicate to avoid an ambiguity.

trace/Mmakefile:
	Add the definition and rules required to build the eventspec library.

trace/mercury_event_scanner.l:
trace/mercury_event_parser.y:
	A scanner and a parser for reading in event spec specifications.

trace/mercury_event_spec_missing.h:
	Provide the declarations that should be (but aren't) provided by
	flex and bison.

trace/mercury_event_spec.[ch]:
	The main module of the eventspec library. Provides functions to read
	in event set specifications from a file, and to write them out as a
	Mercury term in the form needed by the compiler.

trace/mercury_trace_tables.c:
	If the module layouts being registered include event set
	specifications, then check their consistency. Make the specification
	and the consistency indication available to other modules.

trace/mercury_trace_internal.c:
	During initialization, if the modules contain a consistent set of event
	set specifications, then read that specification into the debugger.
	(We don't yet make use of this information.)

	Add an extra mdb command, "user", which goes forward to the next
	user-defined event.

trace/mercury_trace.[ch]:
trace/mercury_trace_cmd_forward.[ch]:
	Implement the new mdb command.

trace/mercury_trace_vars.[ch]:
	For user-defined events, include the attributes' values among the
	values that can be printed or browsed.

trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_declarative.c:
	Minor changes.

scripts/scripts/prepare_tmp_dir_grade_part:
	Copy the .y and .l files to the tmp dir we use for installs.

tools/bootcheck:
	Copy the .y and .l files of the trace directory to stage 2.

tools/lmc.in:
	Include the eventspec library when linking debuggable executables.

tests/debugger/user_event.{m,inp,exp}:
tests/debugger/user_event_spec:
	New test case to test the new functionality.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
	Enable the new test case.

tests/debugger/completion.exp:
	Expect the new "user" mdb command in the completion output.
2006-11-24 03:48:30 +00:00
Julien Fischer
3ace02fd26 A side effect of the introduction of trace goals is that .init files are
Estimated hours taken: 10
Branches: main

A side effect of the introduction of trace goals is that .init files are
now grade dependent.  Consider a module that contains the following
trace goal:

	trace [ compile_time(grade(debug)),
		run_time(env("FOO"))
	] (
		...
	),

In a debug grade the .init file for a library containing that module will
include the following directive:

	ENVVAR FOO

In a non-debug grade it won't.  At the moment which version of the .init
file is actually installed depends upon which grade was the first to
be built.  This can result in linker errors if the wrong grade is used
with the wrong .init file.

There are two possible fixes.  (1) always output ENVVAR directives
regardless of whether the compile time conditions of the trace goals to
which they are attached are true or not.  (2) build grade specific .init
files and install them in grade specific locations.

The following diff implements the first stage of (2).  For each grade in
which a library is to be installed we create a grade specific .init file
and then install it in a grade specific location, e.g.
`$(INSTALL_PREFIX)/lib/mercury/modules/<grade>'.  (For bootstrapping
purposes .init files are currently still installed in the old location
as well.)

After this change has been installed on our machines I will add the
second part of this change which modifies the compiler to look for the
.init files in the new grade specific locations.  The final part of the
change will then remove support for installing .init files in the old
location.)

scripts/Mmake.vars.in:
	Add a variable that holds the name of a grade specific directory
	in which to install .init files.

scripts/Mmake.rules:
	Add a rule to install the .init files in a grade specific location.

browser/Mmakefile:
mdbcomp/Mmakefile:
runtime/Mmakefile:
	Change the dependencies on the library installation targets so
	that installing a library causes the .init files to be built and
	installed.
	(Currently this dependency is on the install target, which means
	that the install_init rule is only invoked once, rather than
	every time a grade is built.)

	Install the .init files for these libraries in grade specific
	locations.  (For bootstrapping purposes they are currently also
	installed in the old location.)

runtime/Mmakefile:
	Remove the code that deletes runtime.init if it exists.
	(Anyone who has a Mercury installation old enough for this to
	be a problem is going to encounter more serious problems than
	the runtime being initialized twice.)

	Unrelated change: remove some duplicate entries from the list
	of header files.

compiler/make.program_target.m:
	Have mmc --make install the .init files in a grade specific location.
	(They are also still installed in the old location.)

NOTE: the `XXX trace goal fix.' comments are placeholders for
things that need to be changed during the latter stages of this change.
2006-11-23 04:08:55 +00:00
Julien Fischer
63d219d82d Fix a bug in mmc --make's handling of ranlib.
Estimated hours taken: 1.5
Branches: main, release

Fix a bug in mmc --make's handling of ranlib.

configure.in:
 	Set the value of RANLIBFLAGS.
 	On most systems it will be empty; on Mac OS X it needs to be set
 	to "-c".

 	Check that the installed compiler supports the `--ranlib-flags'
 	option.

compiler/make.program_target.m:
 	Fix the problem with the quoting in the command line used to
 	invoke ranlib on Mac OS X by using the recently introduced
 	`--ranlib-flags' option.

 	Remove the workaround for this bug.

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
 	Set the default value of the `--ranlib-flags' option.

scripts/Mmake.vars.in:
scripts/Mmake.rules:
 	Have mmake conform to the new way of handling flags for
 	ranlib.
2006-11-15 08:12:56 +00:00
Zoltan Somogyi
ecf1ee3117 Add a mechanism for growing the stacks on demand by adding new segments
Estimated hours taken: 20
Branches: main

Add a mechanism for growing the stacks on demand by adding new segments
to them. You can ask for the new mechanism via a new grade component, stseg
(short for "stack segments").

The mechanism works by adding a test to each increment of a stack pointer (sp
or maxfr). If the test indicates that we are about to run out of stack, we
allocate a new stack segment, allocate a placeholder frame on the new segment,
and then allocate the frame we wanted in the first place on top of the
placeholder. We also override succip to make it point code that will (1)
release the new segment when the newly created stack frame returns, and then
(2) go to the place indicated by the original, overridden succip.

For leaf procedures on the det stack, we optimize away the check of the stack
pointer. We can do this because we reserve some space on each stack for the
use of such stack frames.

My intention is that doc/user_guide.texi and NEWS will be updated once we have
used the feature ourselves for a while and it seems to be stable.

runtime/mercury_grade.h:
	Add the new grade component.

runtime/mercury_conf_param.h:
	Document the new grade component, and the option used to debug stack
	segments.

runtime/mercury_context.[ch]:
	Add new fields to contexts to hold the list of previous segments of the
	det and nondet stacks.

runtime/mercury_memory_zones.[ch]:
	Include a threshold in all zones, for use in stack segments.
	Set it when a zone is allocated.

	Restore the previous #ifdef'd out function MR_unget_zone, for use
	when freeing stack segments execution has fallen out of.

runtime/mercury_debug.[ch]:
	When printing the offsets of pointers into the det and nondet stacks,
	print the number of the segment the pointer points into (unless it is
	the first, in which case we suppress this in the interest of brevity
	and simplicity).

	Make all the functions in this module take a FILE * as an input
	argument; don't print to stdout by default.

runtime/mercury_stacks.[ch]:
	Modify the macros that allocate stack frames to invoke the code for
	adding new stack segments when we are about to run out of stack.

	Standardize on "nondet" over "nond" as the abbreviation referring to
	the nondet stack.

	Conform to the changes in mercury_debug.c.

runtime/mercury_stack_trace.c:
	When traversing the stack, step over the placeholder stack frames
	at the bottoms of stack segments.

	Conform to the changes in mercury_debug.c.

runtime/mercury_wrapper.[ch]:
	Make the default stack size small in grades that support stack
	segments.

	Standardize on "nondet" over "nond" as the abbreviation referring to
	the nondet stack.

	Conform to the changes in mercury_debug.c.

runtime/mercury_memory.c:
	Standardize on "nondet" over "nond" as the abbreviation referring to
	the nondet stack.

runtime/mercury_engine.[ch]:
runtime/mercury_overflow.h:
	Standardize on "nondet" over "nond" as the abbreviation referring to
	the nondet stack.

	Convert these files to four-space indentation.

runtime/mercury_minimal_model.c:
trace/mercury_trace.c:
trace/mercury_trace_util.c:
	Conform to the changes in mercury_debug.c.

compiler/options.m:
	Add the new grade option for stack segments.

compiler/compile_target_code.m:
compiler/handle_options.m:
	Add the new grade component, and handle its exclusions with other grade
	components and optimizations.

compiler/llds.m:
	Extend the incr_sp instruction to record whether the stack frame
	is for a leaf procedure.

compiler/llds_out.m:
	Output the extended incr_sp instruction.

compiler/proc_gen.m:
	Fill in the extra slot in incr_sp instructions.

compiler/goal_util.m:
	Provide a predicate for testing whether a procedure body is a leaf.

compiler/delay_slot.m:
compiler/dupelim.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/frameopt.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/peephole.m:
compiler/reassign.m:
compiler/use_local_vars.m:
	Conform to the change in llds.m.

scripts/canonicate_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/mgnuc.in:
	Handle the new grade component.

	Convert parse_grade_options.sh-subr to four-space indentation.

Mmake.workspace:
	Fix an old bug that prevented bootcheck from working in the new grade:
	when computing the gc grade, use the workspace's version of ml (which
	in this case understands the new grade components), rather than the
	installed ml (which does not).

	(This was a devil to track down, because neither make --debug nor
	strace on make revealed how the installed ml was being invoked,
	and there was no explicit invocation in the Makefile either; the error
	message appeared to come out of thin air just before the completion
	of the stage 2 library. It turned out the invocation happened
	implicitly, as a result of expanding a make variable.)
2006-11-01 02:31:19 +00:00
Peter Ross
2b1aa936fa Enable the new grade specifiers, ll_debug and gcd.
Estimated hours taken: 4
Branches: main

Enable the new grade specifiers, ll_debug and gcd.
ll_debug means compile with -O0 and -g.
gcd means compile the boehm_gc with #defines that
allow memory leaks to be debugged.

boehm_gc/Makefile:
	Use findstring to see which grade specifiers are available.
	Only add BOEHM_CFLAGS_FOR_THREADS if par in GRADE.
	Only define NO_DEBUGGING if we are not in gcd.

compiler/compile_target_code.m:
compiler/globals.m:
compiler/handle_options.m:
	Handle the gc_boehm_debug.

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:
	Handle the new grade specifiers.

scripts/mgnuc.in:
	Set the #defines implied by the new grade specifiers.

scripts/ml.in:
	Calculate the name of the boehm_gc library.
2006-10-02 09:06:51 +00:00
Peter Wang
712027f307 This patch changes the parallel execution mechanism in the low level backend.
Estimated hours taken: 100
Branches: main

This patch changes the parallel execution mechanism in the low level backend.
The main idea is that, even in programs with only moderate parallelism, we
won't have enough processors to exploit it all.  We should try to reduce the
cost in the common case, i.e. when a parallel conjunction gets executed
sequentially.  This patch does two things along those lines:

(1) Instead of unconditionally executing all parallel conjuncts (but the last)
in separate Mercury contexts, we allow a context to continue execution of the
next conjunct of a parallel conjunction if it has just finished executing the
previous conjunct.  This saves on allocating unnecessary contexts, which can
be a big reduction in memory usage.

We also try to execute conjuncts left-to-right so as to minimise the
need to suspend contexts when there are dependencies between conjuncts.

(2) Conjuncts that *are* executed in parallel still need separate contexts.
We used to pass variable bindings to those conjuncts by flushing input
variable values to stack slots and copying the procedure's stack frame to the
new context.  When the conjunct finished, we would copy new variable bindings
back to stack slots in the original context.

What happens now is that we don't do any copying back and forth.  We introduce
a new abstract machine register `parent_sp' which points to the location of
the stack pointer at the time that a parallel conjunction began.  In parallel
conjuncts we refer to all stack slots via the `parent_sp' pointer, since we
could be running on a different context altogether and `sp' would be pointing
into a new detstack.  Since parallel conjuncts now share the procedure's stack
frame, we have to allocate stack slots such that all parallel conjuncts in a
procedure that could be executing simultaneously have distinct sets of stack
slots.  We currently use the simplest possible strategy, i.e. don't allow
variables in parallel conjuncts to reuse stack slots.

Note: in effect parent_sp is a frame pointer which is only set for and used by
the code of parallel conjuncts.  We don't call it a frame pointer as it can be
confused with "frame variables" which have to do with the nondet stack.


compiler/code_info.m:
	Add functionality to keep track of how deep inside of nested parallel
	conjunctions the code generator is.

	Add functionality to acquire and release "persistent" temporary stack
	slots.  Unlike normal temporary stack slots, these don't get implicitly
	released when the code generator's location-dependent state is reset.

	Conform to additions of `parent_sp' and parent stack variables.

compiler/exprn_aux.m:
	Generalise the `substitute_lval_in_*' predicates by
	`transform_lval_in_*' predicates.  Instead of performing a fixed
	substitution, these take a higher order predicate which performs some
	operation on each lval.  Redefine the substitution predicates in terms
	of the transformation predicates.

	Conform to changes in `fork', `join_and_terminate' and
	`join_and_continue' instructions.

	Conform to additions of `parent_sp' and parent stack variables.

	Remove `substitute_rval_in_args' and `substitute_rval_in_arg' which
	were unused.

compiler/live_vars.m:
	Introduce a new type `parallel_stackvars' which is threaded through
	`build_live_sets_in_goal'.  We accumulate the sets of variables which
	are assigned stack slots in each parallel conjunct.  At the end of
	processing a parallel conjunction, use this information to force
	variables which are assigned stack slots to have distinct slots.

compiler/llds.m:
	Change the semantics of the `fork' instruction.  It now takes a single
	argument: the label of the next conjunct after the current one.  The
	instruction now "sparks" the next conjunct to be run, either in a
	different context (possibly in parallel, on another Mercury engine) or
	is queued to be executed in the current context after the current
	conjunct is finished.

	Change the semantics of the `join_and_continue' instruction.  This
	instruction now serves to end all parallel conjuncts, not just the
	last one in a parallel conjunction.

	Remove the `join_and_terminate' instruction (no longer used).

	Add the new abstract machine register `parent_sp'.

	Introduce "parent stack slots", which are similar to normal stack
	slots but relative to the `parent_sp' register.

compiler/par_conj_gen.m:
	Change the code generated for parallel conjunctions.  That is:

	- use the new `fork' instruction at the beginning of a parallel
	  conjunct;

	- use the `join_and_continue' instruction at the end of all parallel
	  conjuncts;

	- keep track of how deep the code generator currently is in parallel
	  conjunctions;

	- set and restore the `parent_sp' register when entering a non-nested
	  parallel conjunction;

	- after generating the code of a parallel conjunct, replace all
	  references to stack slots by parent stack slots;

	- remove code to copy back output variables when a parallel conjunct
	  finishes.

	Update some comments.

runtime/mercury_context.c:
runtime/mercury_context.h:
	Add the type `MR_Spark'.  Sparks are allocated on the heap and contain
	enough information to begin execution of a single parallel conjunct.

	Add globals `MR_spark_queue_head' and `MR_spark_queue_tail'.  These
	are pointers to the start and end of a global queue of sparks.  Idle
	engines can pick up work from this queue in the same way that they can
	pick up work from the global context queue (the "run queue").

	Add new fields to the MR_Context structure.  `MR_ctxt_parent_sp' is a
	saved copy of the `parent_sp' register for when the context is
	suspended.  `MR_ctxt_spark_stack' is a stack of sparks that we decided
	not to put on the global spark queue.

	Update `MR_load_context' and `MR_save_context' to save and restore
	`MR_ctxt_parent_sp'.

	Add the counters `MR_num_idle_engines' and
	`MR_num_outstanding_contexts_and_sparks'.  These are used to decide,
	when a `fork' instruction is reached, whether a spark should be put on
	the global spark queue (with potential for parallelism but also more
	overhead) or on the calling context's spark stack (no parallelism and
	less overhead).

	Rename `MR_init_context' to `MR_init_context_maybe_generator'.  When
	initialising contexts, don't reset redzones of already allocated
	stacks.  It seems to be unnecessary (and the reset implementation is
	buggy anyway, though it's fine on Linux).

	Rename `MR_schedule' to `MR_schedule_context'.  Add new functions
	`MR_schedule_spark_globally' and `MR_schedule_spark_locally'.

	In `MR_do_runnext', add code for idle engines to get work from the
	global spark queue.  Resuming contexts are prioritised over sparks.

	Rename `MR_fork_new_context' to `MR_fork_new_child'.  Change the
	definitions of `MR_fork_new_child' and `MR_join_and_continue' as per
	the new behaviour of the `fork' and `join_and_continue' instructions.
	Delete `MR_join_and_terminate'.

	Add a new field `MR_st_orig_context' to the MR_SyncTerm structure to
	record which context originated the parallel conjunction instance
	represented by a MR_SyncTerm instance, and update `MR_init_sync_term'.
	This is needed by the new behaviour of `MR_join_and_continue'.

	Update some comments.

runtime/mercury_engine.h:
runtime/mercury_regs.c:
runtime/mercury_regs.h:
runtime/mercury_stacks.h:
	Add the abstract machine register `parent_sp' and code to copy it to
	and from the fake_reg array.

	Add a macro `MR_parent_sv' to access stack slots via `parent_sp'.

	Add `MR_eng_parent_sp' to the MercuryEngine structure.

runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
	Add Mercury runtime option `--max-contexts-per-thread' which is saved
	in the global variable `MR_max_contexts_per_thread'.  The number
	`MR_max_outstanding_contexts' is derived from this.  It sets a soft
	limit on the number of sparks we put in the global spark queue,
	relative to the number of threads we are running.  We don't want to
	put too many sparks on the global queue if there are plenty of ready
	contexts or sparks already on the global queues, as they are likely to
	result in new contexts being allocated.

	When initially creating worker engines, wait until all the worker
	engines have acknowledged that they are idle before continuing.  This
	is mainly so programs (especially benchmarks and test cases) with only
	a few fork instructions near the beginning of the program don't
	execute the forks before any worker engines are ready, resulting in no
	parallelism.

runtime/mercury_engine.c:
runtime/mercury_thread.c:
	Don't allocate a context at the time a Mercury engine is created.  An
	engine only needs a new context when it is about to pick up a spark.

configure.in:
compiler/options.m:
scripts/Mercury.config.in:
	Update to reflect the extra field in MR_SyncTerm.

	Add the option `--sync-term-size' and actually make use the result of
	the sync term size calculated during configuration.

compiler/code_util.m:
compiler/continuation_info.m:
compiler/dupelim.m:
compiler/dupproc.m:
compiler/global_data.m:
compiler/hlds_llds.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/llds_out.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/reassign.m:
compiler/stack_layout.m:
compiler/use_local_vars.m:
compiler/var_locn.m:
	Conform to changes in `fork', `join_and_terminate' and
	`join_and_continue' instructions.

	Conform to additions of `parent_sp' and parent stack variables.

	XXX not sure about the changes in stack_layout.m

library/par_builtin.m:
	Conform to changes in the runtime system.
2006-09-26 03:53:23 +00:00
Zoltan Somogyi
b82b599ec3 Implement coverage testing. The output format is a bit crude, but people
Estimated hours taken: 60
Branches: main

Implement coverage testing. The output format is a bit crude, but people
have been asking for this capability.

The main problem tackled in this diff is that coverage testing requires
gathering information from a lot of program executions, and the execution count
files for all these executions require a huge amount of disk space. We now
therefore put a limit on the number of files we keep; when this limit is
exceeded, the program execution that reaches the limit will automatically
summarize all these files back into a single file before it exits.

This diff also tackles the same problem along a different axis by changing
the format of execution count files to make them smaller. One way is to factor
out and represent just once some information that is common to many procedures:
the file name and the module name. Another is to abbreviate some keywords,
e.g. "fproc" instead of "proc function". The third is not to write out the
defining module's name unless it differs from the declaring module's name,
which it almost never does. (The two differ only when the compiler is invoked
with intermodule optimization, and creates a specialized version of a predicate
in a module other than its home module.)

Since we are changing the trace count file format anyway, make another change
useful for coverage testing: record the entire provenance of the trace counts
in the file, including the name of the program and what files went into unions
and diffs of trace count files.

When doing coverage testing of the compiler, the compiler *must* be in a debug
grade. However, the tools for summarizing trace files, invoked from the
compiler executable when the compiler is being coverage tested, *cannot* be
in debug grade, because debug grade disables tail recursion, and without tail
recursion the summarization program runs out of stack space. This diff
therefore arranges for the slice directory to not be affected by the parameters
applying to the rest of the workspace (including the top level Mmake.params).

Mmakefile:
	Don't apply the top level mmake's parameters to recursive mmakes in
	the slice directory.

	Factor out some common code.

configure.in:
	Require that the installed compiler contain the renamed standard
	library function names installed by my diff on Sep 20, since the
	slice directory needs them, and cannot get them from the workspace.

mdbcomp/trace_counts.m:
	Update the parsing code to parse the new format for trace count files,
	and update the code for writing out trace counts to generate the new
	format.

	Replace the proc_label_and_filename type with the proc_label_in_context
	type, which makes it easier to keep track of the current module as well
	as the current file (this is required by the new, more compact format
	for trace count files).

	When considering the union of multiple trace counts files, keep track
	of whether they contained all counts or just the nonzero counts. This
	requires keeping track of this info for single files as well.

	Provide ways to represent and to compute differences between trace
	count files, to support the new program in slice/mtc_diff.m.

mdbcomp/slice_and_dice.m:
	Reformat to conform to our Mercury style guide.

	Conform to the change to trace_counts.m.

compiler/tupling.m:
	Conform to the change to mdbcomp.

runtime/mercury_wrapper.c:
	Implement the new option values used to implement coverage testing.
	These allow control of the limit on the number of execution count
	files, and collecting execution counts only from a specified
	executable.

	Add MR_ prefixes.

runtime/mercury_trace_base.[ch]:
	Provide the mechanism for summarizing execution counts when we reach
	the limit on the number of execution counts files.

	Update the code that writes out trace counts files to generate
	the new format for trace counts files. Make this code take the boolean
	that says whether to include labels with zero counts in the output
	as an explicit parameter, not as a global variable.

	Break up an excessively large function.

scripts/mtc:
	Add the options needed to control the process of automatic
	summarization of trace counts files.

slice/.mgnuc_copts:
slice/.mgnuc_opts:
slice/SLICE_FLAGS.in:
	Make these files empty, since we don't want to refer to the rest of the
	workspace. (We could delete them as well, but CVS doesn't handle
	resurrection of deleted files very well, and we don't want to burn any
	bridges.)

slice/Mmakefile:
	Add the new executables, and make the code in this directory
	independent of the other directories in the workspace.

	Since we need the code of the modules in the mdbcomp directory
	but don't want to link to the object files in that directory (since
	the grades may differ), make copies of those modules in this directory.

slice/mcov.m:
	Add this module, the code for the Mercury coverage test tool.

slice/mtc_diff.m:
	Add this module, the code for computing the diff between two trace
	counts files. The intended use is to compare two trace counts files
	dumped at different stages of execution. (Since foreign_procs can be
	used to invoke the C functions in the runtime that write out the trace
	counts files in the middle of a program's execution, not just the end.)

slice/mdice.m:
slice/mslice.m:
slice/mtc_union.m:
	Convert to four space indentation.

tools/bootcheck:
	Since the slice directory's grade is independent of the grade of the
	other directories, don't copy it to the stage2 and stage3 by default.
	If it is copied, then still compile it (and otherwise handle it)
	separate from the other directories.

	Add an option for gathering coverage test data during bootchecking.
2006-09-22 03:50:48 +00:00
Ian MacLarty
21c2d2c338 Fix a problem with the automatically generated trace counts file name.
Estimated hours taken: 1
Branches: main, 0.13

Fix a problem with the automatically generated trace counts file name.
The filename contained the name of the invoked program with "/" replaced by
":".  Using ":" is a problem on Windows because it is not allowed in windows
filenames.  Instead we now use "_".

Allow the user to specify their own trace counts file name with an extra option
to mtc.

runtime/mercury_trace_base.c:
	When dumping trace counts, first check if the user gave a filename to
	be used and if they did use that, otherwise generate a filename, but
	use "_" instead of ":".

runtime/mercury_trace_base.h:
	Add MR_trace_counts_file for recording a user defined trace counts
	file name.

runtime/mercury_wrapper.c:
	Process the --tc-output-file MERCURY_OPTIONS option that allows the
	user to give their own trace counts file name.

scripts/mtc:
	Add an -o option to allow the user to give their own file name.
	Also add a --help option.

tests/debugger/declarative/Mmakefile:
	Make the dice test use the --tc-output-file option.
2006-09-14 00:15:48 +00:00
Julien Fischer
1b8dd4920d Fix a typo: s/tmpdir/tmp_dir/
Estimated hours taken: 0.1
Branches: main

scripts/prepare_tmp_dir_grade_part:
	Fix a typo: s/tmpdir/tmp_dir/

	Remove libatomic_ops*.a when copying the boehm_gc directory.
2006-08-22 14:42:58 +00:00
Julien Fischer
ee16781473 Back out my recent change since it breaks mmc --make on Solaris.
Estimated hours taken: 0.5
Branches: main, release

scripts/Mercury.config.in:
	Back out my recent change since it breaks mmc --make on Solaris.

configure.in:
	Don't try to statically link the configure test on Solaris 2.9.
2006-08-18 06:50:38 +00:00
Peter Wang
f1cbb3dec6 Copy libatomic_ops-related files into tmp_dir when installing grades.
Estimated hours taken: 0.5
Branches: main

scripts/prepare_tmp_dir_grade_part:
	Copy libatomic_ops-related files into tmp_dir when installing grades.

compiler/notes/upgrade_boehm_gc.html:
	Add more tips.
2006-08-16 04:54:56 +00:00
Peter Wang
c6a14c35b0 Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
Estimated hours taken: 5
Branches: main

Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
collector.  The main reason is that thread-local allocation is not
supported on Solaris in version 6.x of the collector.

boehm_gc/*:
	Merge in changes from the vendor branch.

.README.in:
	Update Boehm GC version number and copyright notice.

Mmake.common.in:
configure.in:
runtime/RESERVED_MACRO_NAMES:
scripts/mgnuc.in:
	Don't define `THREAD_LOCAL_ALLOC' nor `GC_REDIRECT_TO_LOCAL' as
	thread-local allocation is automatically enabled in gc 7.0.

	Consistently use `GC_WIN32_THREADS' and `GC_LINUX_THREADS' as the
	non-prefixed versions of those symbols are deprecated.

	Don't define `NO_SIGNALS' as it is no longer necessary.

	Add librt to the list of thread libraries on Solaris.  This is
	needed for the POSIX semaphore functions now used on Solaris.

runtime/mercury_prof_mem.c:
runtime/mercury_prof_mem.h:
	Update comments mentioning `NO_SIGNALS'.

compiler/compile_target_code.m:
	Make `--inline-alloc' do nothing as inline allocation is currently
	broken in gc 7.0.

runtime/mercury.h:
runtime/mercury_heap.h:
	Include `gc_inline.h' instead of `gc_inl.h' as the latter no longer
	exists.

extras/concurrency/semaphore.m:
library/par_builtin.m:
robdd/bryant.c:
	Replace instances of `GC_PTR' by `void *' as the former no longer
	exists.

runtime/mercury_wrapper.c:
	Remove references to `GC_quiet' which no longer exists.

	Replace uses of `GC_quiet' for the MPS collector by a new variable
	`MR_mps_quiet'.

tools/bootcheck:
	Copy libatomic_ops-related files and directories when copying
	boehm_gc.
2006-08-15 04:19:40 +00:00
Julien Fischer
ac5d2bbf00 Fix a bug reported by Greg Duck. On x86 systems mmc --make was not building
Estimated hours taken: 6
Branches: main, release

Fix a bug reported by Greg Duck.  On x86 systems mmc --make was not building
static executables by default, but was linking in shared versions of some
libraries.  This won't work correctly on x86 machines because of our use of the
register ebx as a global register in non-pic code.  The following patch
causes mmc --make to invoke the linker with the same default settings as mmake.

scripts/Mercury.config.in:
	The default values for the `--linkage' and `--mercury-linkage'
	options on x86 should be `static' not `shared'.
2006-08-10 07:43:40 +00:00
Julien Fischer
8244972e19 Add support for shared libraries on x86-64 Linux.
Estimated hours taken: 4.5
Branches: main, release

Add support for shared libraries on x86-64 Linux.

configure.in:
	Enable for support for shared libraries on x86-64 Linux ELF
	systems.

runtime/machdeps/x86_64_regs.h:
	Add an explanation of a problem with our use of r15 as a global
	register and PIC with the medium and large code models.  (We
	don't encounter this problem because we currently use the small
	code model.)

	Fix the comments attached to the register variable declarations.
	We do not have three different versions of succip.

runtime/mercury_goto.h:
	Add x86_64 specific hacks.

scripts/mgnuc.in:
	Conform to the above changes.
2006-08-02 06:48:56 +00:00
Ian MacLarty
b04f572e84 Replace "save_to_file" with "dump", since that mdb command has been
Estimated hours taken: 0.1
Branches: main

scripts/mdb_grep:
scripts/mdb_open:
	Replace "save_to_file" with "dump", since that mdb command has been
	renamed.
2006-07-25 08:42:47 +00:00
Ian MacLarty
2ece43e394 Add a new mdb command, 'shell', that allows users to execute shell commands
Estimated hours taken: 5
Branches: main

Add a new mdb command, 'shell', that allows users to execute shell commands
from within the debugger.

Allow the user to give up to nine additional arguments to the 'source' command.
Occurrences of the strings "$1" through "$9" in the sourced file are replaced
by the corresponding additional arguments, allowing for parameterised scripts.

Use the two new features mentioned above to add two more mdb commands: one
to open a term, goal or exception in an external editor another command
to perform a grep on a term, goal or exception (useful for seeing if a value
occurs in a big map, for example).

NEWS
	Mention the new commands.

doc/mdb_categories:
doc/user_guide.texi:
	Document the new commands.

scripts/Mmakefile:
scripts/mdb_open:
scripts/mdb_vim:
	Add scripts for the new commands.

scripts/mdbrc.in:
	Add aliases for the new shell, emacs, grep and vim commands.

tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
	Adjust for new commands.

tests/debugger/save.exp:
tests/debugger/save.exp2:
	Adjust for new commands.  Replace system dependent strings
	with ZZZ instead of XXX.

tests/debugger/Mmakefile:
tests/debugger/shell.exp:
tests/debugger/shell.inp:
tests/debugger/shell.m:
tests/debugger/shell_test_script:
	Test the shell and source commands.

trace/mercury_trace_cmd_misc.c:
	Check if there are extra arguments to the source mdb command
	and pass them to MR_trace_source if there are.

trace/mercury_trace_cmd_misc.h:
	Add shell command handling function prototype.

trace/mercury_trace_declarative.c:
	Call MR_trace_call_system_display_error_on_failure instead
	of system when displaying benchmarking statistics for the
	declarative debugger.

trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	Implement the shell command and extend the source command
	to handle the optional extra arguments.

trace/mercury_trace_readline.c:
trace/mercury_trace_readline.h:
	Add a new function to read a line and replace all the
	occurrences of "$[1-9]" with the corresponding value from an array.

	Delete comments in the .c file that are duplicated in the .h file.

trace/mercury_trace_util.c:
trace/mercury_trace_util.h:
	Implement MR_trace_call_system_display_error_on_failure that
	executes a system call and displays an error message if the system
	call terminates abnormally.
2006-06-13 09:49:04 +00:00
Julien Fischer
faa18a15bd Fix the bug with initialisers/finalisers in libraries not being called ( and
Estimated hours taken: 7
Branches: main, release

Fix the bug with initialisers/finalisers in libraries not being called ( and
as consequence also fixes the bug with mutables not being given their correct
initial value).  The problem was that the directives necessary to call them
were not being included in the libraries' .init file.

The fix is to add a new mode of operation to mkinit that given a list of
.c files that make up some Mercury library, constructs the .init file for
that library.  In particular, it now constructs the .init file so that
it contains any REQUIRED_{INIT,FINAL} directives needed by the library.
The new mode of operation is invoked when mkinit is given the `-k' option.

Modify the build systems (i.e. mmake and mmc --make) to conform to the
above change.

compiler/modules.m:
	Change the rule mmake uses to build .init files so that it calls
	mkinit -k on all the .c files generated for the library.

scripts/Mmake.vars.in:
	Add a new mmake variable MKLIBINIT.  This is the program used to
	create .init files.  (It will nearly always be mkinit.)

compiler/compile_target_code.m:
	Change how .init files are built.  We now have to call mkinit -k to
	scan all of the .c files to write out the correct set of INIT,
	REQUIRED_INIT and REQUIRED_FINAL directives.  The code here is
	that used by mmc --make for creating the .init files.

compiler/make.program_target.m:
	Build the .init file after building the .c files, since building
	it before will no longer work.
2006-05-21 06:22:59 +00:00
Zoltan Somogyi
dd44e0ef62 Replace the "set" command of mdb with a bunch of commands: the `format',
Estimated hours taken: 16
Branches: main, release

Replace the "set" command of mdb with a bunch of commands: the `format',
`format_param', `list_context_lines', `list_path', `xml_browser_cmd',
`xml_tmp_filename', `fail_trace_counts', `pass_trace_counts' and
`max_io_actions' commands. Each of these set just one parameter
or one of set of closely related parameters.

Move all these commands, and some existing commands that set parameters
that were elsewhere, to the "parameter" command category.

Extend some of these commands so that if given no arguments, they report
the current values of the parameters they would otherwise set.

Replace the "set" commands of the mdb browser and of the declarative debugger
with a bunch of commands: "format", "depth", "size", "width", "lines",
"actions" and "params" (the last prints the current value of the parameters).

For each category of mdb commands, create files mercury_trace_cmd_<cat>.[ch],
and move the functions dealing with that category of commands there from
mercury_trace_internal.c. Give each of these new files a logical structure
that was sometimes missing from the relevant parts of mercury_trace_internal.c.

NEWS:
	Mention these changes.

doc/mdb_categories:
	Document these changes.

doc/user_guide.texi:
	Document these changes.

	Fix an old documentation bug: you couldn't set listing paramaters
	from a declarative debugger command.

	Fix an old documentation bug: the description of the goal_path step
	for scopes was obsolete.

	Fix some obsolete references to : as module qualifier.

browser/parse.m:
	Update the browser command set along the lines at the top.

browser/declarative_user.m:
	Update the declarative debugger command set along the lines at the top.

	Move the declaration for the type representing declarative debugger
	commands to near the top of the file.

browser/browser_info.m:
	Provide some access predicates.

	Update the predicate that generates mdb commands to save the persistent
	state of the debugger to generate the new forms of parameter commands.

	Move types and predicates for dealing with browser parameters from
	browse.m to here, so that declarative_user.m can use them too.

browser/browse.m:
	Delete the code moved to browser_info.m, and conform to the other
	changes in the other modules.

browser/listing.m:
	Provide a predicate to return the type of listing paths.

scripts/mdbrc.in:
	Update the commands that set the XML parameters.

scripts/Mmakefile:
	Get mmake to rebuild mdbrc from mdbrc.in when mdbrc.in changes.

trace/mercury_trace_internal.c:
trace/mercury_trace_cmds.h:
trace/mercury_trace_cmd_*.[ch]:
	Implement the changes described at the top.

	Fix an old bug: the commands that update the search path for the "list"
	command don't make the search path term permanent, which is needed in
	non-conservative-gc grades.

trace/mercury_trace_spy.c:
	Fix some obsolete references to : as module qualifier.

trace/mercury_trace_browse.[ch]:
	Delete the functionality now moved to mercury_trace_cmd_parameter.c.

tests/debugger/mdb_command_test.inp:
	Update the set of commands being tested.

tests/debugger/save.{inp,exp}:
	Update the parameter commands in this test case.
2006-04-04 07:37:31 +00:00
Julien Fischer
9d8ca0ad37 Remove residual parts of the Aditi backend that weren't deleted the other day.
Estimated hours taken: 1.5
Branches: main

Remove residual parts of the Aditi backend that weren't deleted the other day.

configure.in:
Mmake.common.in:
	Remove support for enabling the Aditi backend.

runtime/mercury_aditi.h:
	Remove this file.

runtime/Mmakefile:
runtime/mercury.h:
runtime/mercury_imp.h:
runtime/mercury_ho_call.[ch]:
runtime/mercury_wrapper.[ch]:
	Delete support for Aditi in the runtime.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/parse_ml_options.sh-subr.in:
	Remove mmake support for building .rlo files, etc.

util/mkinit.c:
	Remove Aditi specific code.

compiler/bytecode_data.m:
compiler/closure_analysis.m:
compiler/code_model.m:
compiler/compile_target_code.m:
compiler/det_analysis.m:
compiler/handle_options.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/mlds_to_gcc.m:
compiler/modecheck_call.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/options.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/term_errors.m:
compiler/unify_proc.m:
mdbcomp/prim_data.m:
	Remove residual support for Aditi.

library/ops.m:
	Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the
	ops table.

doc/reference_manual.texi:
doc/user_guide.texi:
	Delete the sections on the Aditi interface.

extras/aditi/*:
	Delete this.
2006-02-24 07:11:21 +00:00