Commit Graph

77 Commits

Author SHA1 Message Date
Mark Brown
16fdab788b Overhaul of the Syntax chapter of the reference manual
There are three main aims for this change:

1. Don't rely so much on users having knowledge of Prolog (ideally we
wouldn't require it at all, but this change probably doesn't fully achieve
that). Present the information more linearly, i.e., without requiring
so many forward references.

2. Make important information less likely to be overlooked. As it stands,
we give a lot of semantics in the Syntax chapter where users wouldn't
expect to find it (they're more likely to just skim over such a chapter).

3. Remove some inconsistencies in our descriptions and use of terminology,
and try to remove ambiguities.

Changes to terminology
----------------------

These are aimed at being more consistent, as well as dividing things up
into concepts that we need to refer to later on.

- A term is now a core term or a special term. The latter are for list
syntax, etc. Avoid the use of "is parsed as", the significance of which
is not clear, and instead define an equivalence relation via a term
normalization procedure.

- Define "functor" and "principal functor". Don't use "functor" to talk
about terms: the functor is defined as the name/arity pair. Also give
some synonyms we use for functor.

- Core terms are divided into variables, constants, and functor terms.
Functor terms are names on their own or names with arguments
(i.e., "functor terms" are those terms that have meaningful functors).

- "Higher-order terms" are now called "apply terms", since they aren't
necessarily higher-order themselves, and because that is a semantic
concept anyway.

- Data-terms are now referred to as expressions.

- Refer to "field access" rather than "record syntax". It's not made clear
that these are referring to the same feature, so it's better to stick to
one term (at least until full definitions are given).

Changes to document structure
-----------------------------

The Syntax chapter as a whole has been split into two chapters,
Syntax and Clauses. The new structure is as follows:

Syntax

- Additional sections are added for comments and line number directives.

- The Tokens section is split into token types (so that, e.g., variables
can be looked up quickly).

- "Operators" covers everything about operator syntax, not just builtin
operators.

- "Terms" covers the material previously in that section. It adds a summary
in the form of grammar rules (but makes it clear all the information is
also in the prose), and a term normalization procedure that is _not_
written in pseudo-Mercury. The grammar is there for people who are likely
to skip the prose but less likely to skip a grammar, and the prose is there
because that's the best way to describe things.

- "Items" covers the material previously in "Items", "Declarations",
"Facts", and "Rules".

Clauses

- Added an overview of Mercury semantics.

- "Goals" covers the same material as before, but I have rearranged the
order of the goals so as to avoid forward references, and to put more
commonly used goals earlier.

- "Expressions" covers the material previously in "Data-terms" and its
subsections. The expressions are (mostly) collected into one table, but
field access expressions are kept separate as they require a bit more
explanation. I've used an anchor on this separate bit, however, so maybe
it should be in a section that follows Expressions (i.e., Expressions
should say "see next section for details" or whatever).

- "State variables", "Variable scoping", "Implicit quantifiaction", and
"Elimination of double negation" are kept largely as is.

- "Definite Clause Grammars" is added which collects all the information
relating to DCGs.

Other changes
-------------

- Names now include sequences of graphic chars and a single semicolon,
which is what our parser actually allows.

- Use hyphens in meta-variables rather than underscore, per the texinfo
guidelines.

- Explain that operators are a syntactic concept and you need to import
a module to get, e.g., arithmetic operations. Point out the user defined
operator in the prose rather than in a footnote. And fix the formatting
of that table!

- Try to use a more consistent writing style.
2022-09-12 23:37:26 +10:00
Julien Fischer
3362159147 Fix Mantis bug #558.
Mmakefile:
    Ensure that the mercury_{compile,profile} executables exist
    *before* attempting to build the manual pages.

doc/Mmakefile:
    Rebuild the mprof.1 manual page if the profiler options.m
    file changes.
2022-04-21 19:34:00 +10:00
Zoltan Somogyi
b8b845a568 Fix mmakefile rules for os,cs,css,javas.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.

However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.

browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    When creating stage 3, the bootcheck builds, in each directory,
    only the files that it wants to compare against their stage 2 versions.
    This means that it wants to build all the .c, .cs or .java files,
    which it does via the cs, css and javas mmake targets.

    The correct definitions of the rules of these targets depends on
    whether mmc --make is being used or not, so we need at least two
    sets of definitions: one for mmc --make, and for no mmc --make,
    and conditionally selecting the appropriate one. The latter definition
    has the problem that it refers to mmake variables that are intended
    to be defined in .dv files created by mmc --generate-dependencies,
    but until that has been run, those mmake variables are undefined.

    Until now, the only directories that had both the mmc --make
    and the no mmc --make definitions were the ones needed to build
    the compiler. Bootchecks in the csharp and java grades, which
    always use --make make, got errors when they tried to build
    the directories that bootcheck builds after the compiler:
    the slice, profiler, deep_prof and mfilterjavac directories.

    This diff ensures that all directories we build in bootcheck
    get all both versions of the os, cs, css, and javas targets.
    In fact, they get two subversions of the no mmc --make version:
    one for use in the presence of .dv files, and one for use in their
    absence. The latter just builds the .dv files and invokes mmake
    again. This avoids one source of warnings about undefined mmake
    variables.

    To avoid another source, make the rules for tags files and their
    proxies depends on *.m instead of mmake variables such as $(mcov.ms),
    since this makes sense even before making dependencies. The only price
    is that any untracked Mercury source files in the directory have to
    either be given some other suffix, or moved somewhere else.

    Where relevant, make the mtags invocation prefer the master versions
    of files that are copied from the mdbcomp directory to other directories,
    since this is the only writeable version.

    Make the os and cs rules consistently NOT build the _init.[co] files.
    The way we use those files in bootcheck, we never need them;
    when we need them, the right target to give is the executable anyway.

    In the slice directory, don't put mcov between mtc_union and mtc_diff.

    Eliminate unnecessary duplication, e.g. of sources in rules.

    Eliminate double negatives in conditionals.

    Fix formatting.

Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
    Add "ft=make" to vim modelines. This is redundant for the files whose
    names is Mmakefile, but it is needed for Mmake.common.
2020-04-11 20:10:38 +10:00
Peter Wang
10d29a489a Generate better man pages.
doc/make_manpage:
    Replace the old script with a new version written in awk.

    The new output should be an improvement in these ways:
      - works for tools that use spaces for indentation instead of tabs
      - uses macros for indenting proportional font text
        instead of monospace text with inconsistent leading spaces
      - option names are in bold
      - removes redundant blank lines

doc/Mmakefile:
    Adjust command line to call the new make_manpage script.

compiler/options.m:
    Minor formatting changes to --help text to keep complexity of
    make_manpage script low.

profiler/mercury_profile.m:
    Add "Name:" line to --help output for make_manpage to read.

scripts/mtags.in:
    Add "Name:" line to --help output for make_manpage to read.

    Delete initial blank line in help and usage text.

    Delete stray full stop.

scripts/mprof_merge_runs:
scripts/parse_ml_options.sh-subr.in:
    Simplify --help text for make_manpage.
2019-05-28 15:54:45 +10:00
Peter Wang
355fb9b693 Install stub mdb_doc if makeinfo/info are not available.
doc/mdb_doc_stub.txt:
    Add a stub file.

doc/Mmakefile
    Copy the stub file if mdb_doc cannot be generated.
2019-05-28 10:28:48 +10:00
Paul Bone
e0360210c8 Don't install .in files with info files
doc/Mmakefile:
    As above.
2017-03-28 16:40:21 +11:00
Zoltan Somogyi
93fea7de37 Address Julien's review comments about the new warnings.
compiler/options.m:
doc/user_guide.texi:
    Change the option --warn-no-stream-calls to --warn-implicit-stream-calls.

    Add a new option, --inhibit-style-warnings, that does what its name says.

    Fix the old option --inhibit-warnings, which was missing code to turn off
    a significant number of warning options.

    Document where new options may need changes. This may help avoid problems
    such as non-updates to --inhibit-warnings when new warning options are
    added.

NEWS:
    Change the announcement of --warn-no-stream-calls to refer to its new name.

    Announce --inhibit-style-warnings.

    Announce --warn-non-contiguous-decls and --warn-inconsistent-pred-order*
    as well, since the diff that added them did not do so.

compiler/simplify_goal_call.m:
compiler/simplify_info.m:
compiler/simplify_tasks.m:
    Change the compiler-internal names that used to refer to
    --warn-no-stream-calls to refer to its new name instead.

tests/warnings/Mercury.options:
    Specify the new name of --warn-no-stream-calls for the test of the
    option's functionality.

doc/Mmakefile:
    Make doc/mmc.1 depend on compiler/options.m, since if that changes,
    then the help message that mmc.1 is derived from may have changed as well.
2016-10-15 22:54:34 +11:00
Sebastian Godelet
e8eeb55d91 Quote documentation commands for Windows.
doc/Mmakefile:
    Quote TEXI2DVI, DVIPS, PDFTEX, MAKEINFO commands since they are resolved
    to absolute path names in configure.ac. This causes problems on Windows
    since MikTex is by default installed in %ProgramFiles%, which contains
    spaces on an English Windows version.
2016-10-14 15:36:07 +11:00
Julien Fischer
92c9a1fe4b Fix github issue #34: make uninstall leaves files behind.
Don't accidently strip the ".exe" extension from the deep profiler executables
on Windows when installing them.  (Deep profiling doesn't really work on
Windows, which is why this hasn't been noticed until now.)

compiler/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
     Add an uninstall target in these directories.

     Delete a stray reference to the IL backend.

deep_profiler/Mmakefile:
     Fix the issue mentioned above w.r.t the ".exe" extension.

     We install mdprof_cgi in (potentially) two locations, make
     sure we (attempt to) uninstall them both.

     Update the uninstall target to handle the other executables in
     this directory.

doc/Mmakefile:
     Make the uninstall target remove the manual pages.

Mmakefile:
     Invoke uninstall targets in directories where we previously didn't.
2016-01-28 22:06:13 +11:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Zoltan Somogyi
a9208b47a8 Specialize ALL calls to string.format and io.format.
Previously, we specialized calls to string.format and io.format only if
the format string specified no flags, widths, precisions or non-default
bases for any conversion. We now specialize calls to those predicates
regardless of the format string. To make this possible, we now have two
copies of the code to parse format strings.

library/string.parse_runtime.m:
    This new module, carved out out library/string.format.m, contains
    one of those copies. As the name suggests, this copy is used by
    the runtime system.

compiler/parse_string_format.m:
    This new module contains the other copy. As its location suggests,
    this copy is used by the compiler. The separate copy is necessary
    because the compiler's parsing needs are different from the runtime's.

    The main reason for the separation is that the compiler needs to be
    able to handle cases where widths and predicates are given by manifest
    constants, as well as when they are given by the values of variables
    at runtime (when the format string contains conversion specifiers
    such as "%*d"). Having the runtime handle this extra complexity
    would have inevitably increased the runtime's format string interpretation
    overhead, which is undesirable.

    The other reason is that compiler can afford to postprocess the result
    of the parsing in order to avoid having to concatenate two or more
    constant strings at runtime.

library/string.parse_util.m:
    Types and predicates that are common to the library and compiler copies
    of the format string parsing code.

compiler/format_call.m:
    We used to check whether format strings match the supplied list
    of values to be printed by invoking string.format on dummy inputs
    of the supplied types, and seeing whether you got an exception.
    We now call parse_string_format.m instead. Not only does this
    avoid shenanigans with exceptions (which the deep profiler cannot
    yet handle), but it also allows us to specialize all calls
    to string.format and io.format. We therefore do so.

    We used to specialize calls to io.format by creating a single string
    to be printed (using the machinery needed to specialize calls to
    string.format), and then printing that. This did unnecessary memory
    allocations to hold the intermediate strings. We now simply print
    each component one after the other, which avoids this overhead.

library/string.format.m:
    Add versions of the predicates that print chars, strings, ints and floats
    that are specialized to each possible situation about whether the caller
    specifies a width and/or a precision. This means that format_call.m
    doesn't have to generate code that allocates cells on the heap.

    Remove the code that was moved to new submodules of string.m.

compiler/simplify_proc.m:
    List the predicates in string.format.m that the compiler
    may generate calls to in the list of such predicates that we maintain
    to prevent dead_pred_elim from deleting them before format_call.m
    gets a chance to do its work.

compiler/module_imports.m:
    If the code of the module calls a predicate named "format" that
    may refer to string.format or io.format, then implicitly import
    the modules that contain the types and predicates that the code
    generated by format_call.m will refer to. Note that since this
    module_imports.m works on Mercury code that has not been module
    qualified yet, we have to use a conservative approximation.

    Reorganize the way we discover what library modules we have to
    implicitly import. Instead of a separate boolean for each piece
    of functionality that needs an implicit import, put them together
    into a structure. Due to Peter's work on argument packing some
    years back, this is now more efficient as well as more convenient
    that passing around a bunch of booleans. Also switch to passing
    around the structure as an accumulator, instead of having to do
    bool.ors all over the place.

    Since the code for computing the list of modules to be implicitly
    imported can sometimes add a library module to the list twice,
    sort that list and remove any duplicates.

    To make this possible, remove the version of the main predicate
    that appends the implicitly imported module names to a list of
    module names passed by our caller, since we don't want to sort
    THAT list of module names.

    Give the remaining version of that predicate that does this
    a name that better matches the names of related predicates.

compiler/modules.m:
    Conform to the change in module_imports.m. Mark some suspicious code
    with XXXs.

    Remove some redundant comments.

compiler/options.m:
doc/user_guide.texi:
    Add a new option that tells format_call.m what it should do
    when it finds more than one problem with a format string: whether
    it should print a message only for the first problem, or for all
    the problems. (The default is the latter.)

library/MODULES_DOC:
    A list of the all the Mercury source files in the library that
    should be included in the user guide.

library/MODULES_UNDOC:
    A list of the all the Mercury source files in the library that
    should NOT be included in the user guide.

library/library.m:
    Include the new publicly visible new submodule of string.m,
    (string.parse_util). And both string.parse_util and string.parse_runtime
    (which is NOT visible from outside string.m) to the list of modules
    in the Mercury standard library.

    Update the rules for where new library modules should be documented
    to account for non-publically-visible submodules, which we haven't had
    before. Document the need to include new modules in either MODULES_DOC
    or MODULES_UNDOC.

mdbcomp/builtin_modules.m:
    Provide convenient access for format_call.m to the names of the
    submodules of string.m that it needs access to.

library/Mmakefile:
    Add a new target, check_doc_undoc, which checks whether any source files
    are missing from MODULES_DOC or MODULES_UNDOC.

doc/Mmakefile:
    Read the list of modules to be documented from MODULES_DOC. This replaces
    old code that tried to list all the undocumented modules, but missed one:
    it referred to erlang_conf.m instead of erlang_builtin.m.

    When creating the library documentation, filter out any lines that
    contain the string NOTE_TO_IMPLEMENTORS. We now use this mechanism
    to include reminders to implementors in what would otherwise be a
    publically visible part of string.m.

tools/bootcheck:
    Copy MODULES_DOC and MODULES_UNDOC to the stage 2 and 3 library
    directories, since the check_doc_undoc target, which is invoked by
    "make all" in the library directory, needs them.

compiler/hlds_out_module.m:
    When dumping out the table of types, dump out discriminated union types
    in a style that follows our recommended coding style.
2014-11-25 12:46:08 +11:00
Zoltan Somogyi
50c1e04480 Carve two submodules out of string.m.
There are no algorithmic changes, though there are some name changes.

library/string.format.m:
    New submodule of string.m. Contains the parts of old string.m
    that implement string.format. About 1500 lines.

library/string.to_string.m:
    New submodule of string.m. Contains the parts of old string.m
    that implement string.string, string.string_ops and
    string.string_ops_noncanon. About 500 lines.

library/string.m:
    Replace the code that is now in the new submodules with includes
    of those submodules.

library/library.m:
    List the two new submodules. Fix some bitrot about where
    new library modules may need to be listed.

doc/Mmakefile:
    Do not document the two new submodules, since they are implementation
    details.
2014-11-10 14:31:51 +11:00
Zoltan Somogyi
7e1cdb70aa Fix a problem that truncated mdb_doc files.
util/info_to_doc.c:
    Fix a problem that caused the generation of truncated mdb_doc files,
    and from that truncated test/debugger/mdb_command_test.inp files.
    The problem was that this program expected the info program to quote
    the initial line of each mdb command like this:

        `cmdname options ...'

    but on some machines, including mine, it quotes them like this:

        'cmdname options ...'

    i.e. with the initial as well as the final quote being a forward quote.
    This program now accepts either.

util/Mmakefile:
    Fix white space.

doc/generate_mdb_doc:
    Fix inconsistent indentation. Protect shell variable references.

doc/Mmakefile:
    Generate an error message if a similar problem occurs again
    when creating mdb_doc.

    Fix indentation.

tools/bootcheck:
    Generate an error message if a similar problem occurs again
    when copying tests/debugger/mdb_command_test.inp.
2014-01-22 09:31:37 +11:00
Paul Bone
6751f00167 Refactor clean Mmake targets in doc/
doc/Mmakefile:
    Refactor the clean targets in the doc/ directory.  Now it is very clear
    that the 'realclean' and 'distclean' targets do the same thing, and
    'distclean' is only removes a few additional things than 'clean' does.

    This will reduce the chance of problems similar to the one affecting the
    table of contents' in the PDF documents.
2013-10-05 11:51:59 +10:00
Paul Bone
27f8a25f85 Fix problems with building PDF documentation
The PDF documents were sometimes generated without their tables of contents.
This could happen if for some reason there was no .toc file but the .dvi
file still existed.  The Mmakefile would not run texi2dvi which would
normally produce a toc file if the .dvi file already existed, this caused
pdftex to fail to include the table of contents in the generated PDF file.

This was common as distclean deleted the .toc file but did not delete the
.dvi file, so this commonly happened when generating documentation from a
source distribution tarball as we do for the webpage.

This change causes distclean to also delete the .dvi files.

doc/Mmakefile:
    As above

    Also make library.dvi depend upon library-menu.texi_pp
    and library-chapters.texi_pp
2013-10-05 11:45:58 +10:00
Julien Fischer
d14755a20a Delete out-of-date file references in doc directory.
doc/Mmakefile:
    Delete references to files that no longer exist.
2013-06-24 12:17:27 +10:00
Paul Bone
adee55a8dc More support for building the documentation for the website.
doc/Mmakefile:
    Exit and report an error if the VERSION is "DEV".

    Add clean targets

    Make several other changes so that 'mmake webpage.tar.gz" works after
    "mmake distclean".
2013-04-12 14:25:04 +10:00
Paul Bone
84dccffaf4 Build the documentation for the website in the main repository
Add support (actually there was some existing but unused support here
already) for building the documentation parts of the website within the doc/
directory of the main repository, rather than within the www repository
(which had to checkout the main repository).  This makes it easy to build
the documentation and upload it to the webserver, as the webserver has
limited resources.

doc/Mmakefile:
    As above.
2013-04-11 22:31:54 +10:00
Julien Fischer
d118a89c8c Don't include the now empty relation and svrelation modules
Branches: main

doc/Mmakefile:
	Don't include the now empty relation and svrelation modules
	in the libary documentation.
2012-07-04 14:23:36 +00:00
Julien Fischer
638d8bb35c Don't include the now empty graph and group modules in the
Branches: main

doc/Mmakefile:
	Don't include the now empty graph and group modules in the
	library documentation.
2012-07-04 11:09:03 +00:00
Zoltan Somogyi
a0bc277d60 Fix a performance problem in liveness. Liveness makes many calls to
Estimated hours taken: 12
Branches: main

Fix a performance problem in liveness. Liveness makes many calls to
divide_by_set, but the existing implementation of that predicate in
tree_bitset.m did not exploit the structure of its operands.
After this diff, it now does so, though not yet to the fullest extent
possible. However, even this is enough to reduce the time needed
to compile a variant of the zm_rcpsp_cpx.m stress test from 66 seconds
to 15, with liveness analysis no longer being the bottleneck.
On tools/speedtest, we get about a 0.4% speedup, which is just
above the noise threshold.

library/tree_bitset.m:
	Specialize the implementation of divide_by_set for many of
	the possible cases. Leave XXXs where further specialization
	is possible.

	Put some predicate definitions in a more logical order.

compiler/test_bitset.m:
	This module has long been used (initially by Simon Taylor, later
	by me) to test the correctness of the implementation of first
	sparse_bitset.m and later tree_bitset.m. However, since it
	slows down all set operations a lot (by doing them twice, once using
	a bitset module and once using set_ordlist, and then comparing
	the results), it is never enabled in production compilers,
	and since it is usually not imported by any ordinary compiler
	modules, it is rarely even compiled. It has thus tended to
	get bitrot; changes in the set modules it uses need corresponding
	changes in this module, but it has not been getting them.

	To fix this, move this module from the compiler directory to the
	library directory. By including the moved version in the library,
	it will always be compiled, and anyone who breaks it will have
	to fix the breakage before checking in their change.

	The cost is about 16 kilobytes in the Mercury library's .so file,
	which is well worth it.

library/test_bitset.m:
	The moved module. It had to be updated to compile and work
	with the current versions of tree_bitset.m and set_ordlist.m.

library/library.m:
	Include the moved module in the library.

doc/Mmakefile:
	Since the moved module is only for the implementors of the bitset
	modules, do not include it in the documentation.

	Sort the names of the modules that are not included in the
	documentation.

tests/hard_coded/test_tree_bitset.{m,exp}:
	Make this module, which tests the operation of tree_bitset.m,
	both more thorough and more controllable.

	Make it more thorough by testing it not just with some toy sets
	and some small random sets as inputs, but also with some inputs
	specifically designed to be stress tests. These are taken from
	the old tree_bitset_difference test case.

	Make it more thorough in another way by also testing the divide_by_set
	operation.

	Make it more controllable by making it easy to test just one operation
	(for me now, that was of course divide_by_set), without the distraction
	of outputs from tests of other operations.

tests/hard_coded/tree_bitset_tester.m:
	This module used to do the job of test_bitset.m for test_tree_bitset.m.
	This was needed while test_bitset.m was in the compiler directory,
	but it is not needed now, and keeping it presents a double maintenance
	problem. This diff therefore deletes it, and makes test_tree_bitset.m
	use test_bitset.m from the library.

tests/hard_coded/tree_bitset_difference.{m,exp}:
	Delete this test case. The stress test inputs it used to test the
	difference operation with are now in test_tree_bitset.m, which
	uses them to test not just the difference operation, but other
	operations as well.

tests/hard_coded/test_bitset.{m,exp}:
	Delete this test case, since it seems to be a duplicate of an early
	version of tree_bitset_tester.m. Despite its name, it was NOT a copy
	of the identically named module that used to be in the compiler
	directory.

tests/hard_coded/Mmakefile:
	Remove the now unneeded tree_bitset_difference and test_bitset
	test cases from the list of test cases.
2012-03-29 04:03:12 +00:00
Julien Fischer
b13989c75f Fix bug #173 in Mantis. The manual page for mmc in the source distribution
Branches: main, 11.07

Fix bug #173 in Mantis.  The manual page for mmc in the source distribution
contains an error message reporting that the Mercury.config file cannot be
found.

doc/Mmakefile:
	Tell mmc not to look for the standard library
	(which implies --no-mercury-configuration-directory)
	when building the manual pages.
2011-08-18 17:19:25 +00:00
Julien Fischer
8c82c3cce2 Delete predicates from the standard library that were deprecated in Mercury
version 0.13.  (All of the following are still supported in version 10.04.)

library/io.m:
	Delete predicates that were marked as obsolete in version 0.13.

	Delete the binary_stream/1 type class and it's instances.
	They are no longer needed (and were only ever required to supported
	predicates that were deprecated.)

library/bitmap.m:
library/version_bitmap.m:
	Delete the obsolete get/2 predicates.

library/store.m:
	Delete an empty interface section.

library/term_to_xml.m:
	Delete obsolete predicates.

library/bintree.m:
library/bintree_set.m:
	Delete the contents of these modules - I haven't deleted the files
	themselves in case we wish to re-use them.

library/library.m:
	Remove the bintree* modules from the stdlib.

doc/Mmakefile:
	Ignore the bintree*.m files when generating the library guide.

tests/valid/lazy_list.m:
	Don't import bintree_set (and a couple of other unused modules).
2010-07-30 13:16:48 +00:00
Paul Bone
69d7f49841 Fix bug #153.
Branches: main, 10.04

Fix bug #153.

An empty table of contents (TOC) would be generated in the PDF version of the
user's guide.  This is caused when the user_guide.pdf make rule is executed
before the user_guide.dvi_log rule.  pdftexi executes tex only once, therefore
it is not able to generate the TOC.  Executing the .dvi_log rule before the
.pdf rule solves this problem because texinfo (used to create the .dvi) runs
tex the correct number of times.

doc/Mmakefile:
    Make %.dvi_log a dependency of %.pdf so that pdftex can use the TOC
    generated by texinfo.

doc/texinfo.tex:
    Update the version of texinfo, the existing version was from 1999.  Some
    users reported having invalid TOCs when using older versions of texinfo.
2010-07-03 08:05:23 +00:00
Zoltan Somogyi
190764a083 Fix some usability problems in the deep profiler.
Estimated hours taken: 8
Branches: main

Fix some usability problems in the deep profiler.

deep_profiler/exclude.m:
	Provide a better, more explicit representation of the contour exclusion
	file. This representation allows the application of contour exclusion
	even if the contour exclusion file contains some unrecognized module
	names. This is useful, because some modules of the Mercury standard
	library, such as profiling_builtin and mer_std, are unrecognized.
	They are unrecognized because either they export no predicates,
	or because deep profiling is turned off for them.

deep_profiler/query.m:
	Make a provision for controlling the number of a procedure's callers
	displayed at a time.

deep_profiler/create_report.m:
	Take advantage of the new capabilities listed above.

deep_profiler/display_report.m:
	When listing a procedure's callers, print any warning messages
	generated at startup about recognized modules.

	When listing a procedure's callers, list the application of contour
	exclusion among the links only if contour exclusion is in fact
	applicable.

	When listing a procedure's callers, allow the user to control how
	many callers are shown at a time. Make the default bunch size 20,
	instead of previous hardwired (and too small) 5.

	Fix some counterintuitive behavior. When clicking on one of the fields
	in the header of a table, in all but one of the displayed reports, this
	sorts the data being displayed on the selected column. The exception
	was top_procs, in which it changed the criterion on which the top_procs
	were selected, and thus changed the procedures being displayed as well.
	This diff eliminates the exception. The links in the header cells now
	do the expected thing, obeying the law of least astonishment. The
	criterion for selected what procs are top can still be changed using
	the already existing (and previously mostly redundant) links below
	the table.

deep_profiler/startup.m:
	Look for contour exclusion files not in Deep.data.contour, but in
	Deep.contour, since this is more consistent with what we do for other
	auxiliary files, like Data.procrep.

	Make the reading of the exclusion file and the program representation
	file part of the normal startup process, instead of setting their
	fields to dummies and filling them in with real values later.

	If there is a program representation file, make sure that the names
	of the modules in it are not unrecognized by contour exclusion.

	Fix a minor old bug: don't count the time spent reading Deep.contour
	as part of the propagation pass.

	Print meaningful messages (to the log file in /var/tmp) about
	any problems in reading Deep.contour files.

deep_profiler/apply_exclusion.m:
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
deep_profiler/profile.m:
deep_profiler/report.m:
	Conform to the changes above.

doc/user_guide.texi:
	Document contour exclusion, and to make this possible, expand
	considerably the documentation of the deep profiler as a whole.

doc/Mmakefile:
	Ensure that invocations of latex cannot hang waiting for user input.
2009-10-02 04:38:22 +00:00
Julien Fischer
5fd597822b Add G12's backjump module to the standard library.
Estimated hours taken: 1.5
Branches: main

Add G12's backjump module to the standard library.
This will not be inlcuded in the library documentation or announced until
more of the XXXs have been dealt with.

I've included a diff between the G12 version of the backjump
module and this one below.

library/backump.m:
	A module (from G12) that provides support for backjumping.
	There are a number of minor modifications from the G12 version in
	order to make this compile in .par and .profdeep grades but it is
	otherwise unchanged.

library/library.m:
	Include the new module.

doc/Mmakefile:
	Do not include the backjump module in the library reference guide
	for now.

tests/hard_coded/Mmakefile:
tests/hard_coded/backjump_test.{m,exp}:
	Test backjumping (from the G12 nogood example.)
2008-03-09 09:39:25 +00:00
Peter Wang
45a52d3346 Ignore exit status of texi2dvi' for systems with texi2dvi' but not
Estimated hours taken: 0
Branches: main

doc/Mmakefile:
	Ignore exit status of `texi2dvi' for systems with `texi2dvi' but not
	TeX.
2007-12-18 04:28:53 +00:00
Leon Ilario Mika
8ee87e0ec2 New module for handling STM transactions.
Estimated hours taken: 18
Branches: main

library/stm_builtin.m:
	New module for handling STM transactions.

library/library.m:
	Add stm_builtin to the list of standard library modules.

library/exception.m:
	Added try_stm, which is like try_io but with STM state.

doc/Mmakefile:
	Don't list stm_builtin in the documentation.
2007-08-22 06:40:58 +00:00
Julien Fischer
389ddb37d3 Update Mmakefile in doc directory.
Esimated hours taken: 0
Branches: main

Update Mmakefile in doc directory.

doc/Mmakefile:
	Don't include erlang_conf.m in the library reference manual.

	Clean up any *.dvi_log files created.
2007-08-03 06:36:58 +00:00
Julien Fischer
1fce1dfc8b Work around one of the problems that is preventing the documentation
being installed on the webpage.  (Most of the others are gone since
we moved the webserver from ceres to earth.)

doc/Mmakefile:
	Disable building the ps version of the documentation while
	problems building it are resolved.  This has been stopping
	the documentation being installed on the website in other
	formats.
2007-07-03 08:43:06 +00:00
Julien Fischer
10bbd5ed4b Add a new builtin module that defines a type and some predicates that
Estimated hours taken: 0.5
Branches: main

Add a new builtin module that defines a type and some predicates that
will be introduced by RBMM transformation.  These are all just
placeholders at the moment.

library/region_builtin.m:
	Add a new builtin module that contains types and predicates
	that will be used by RBMM.

library/library.m:
	Import the new module.

	Unrelated change: delete the commented out clause of
	mercury_std_library_module/1 for the unsafe module.
	(The unsafe module was deleted from the standard library
	after trace goals were introduced.)

doc/Mmakefile:
	Don't include region_builtin.m in the library reference manual.
2007-06-12 03:22:25 +00:00
Julien Fischer
8cfc1e2cc4 Exclude the Erlang RTTI implementation from the library
Estimated hours taken: 0.1
Branches: main

doc/Mmakefile:
	Exclude the Erlang RTTI implementation from the library
	reference manual.
2007-06-01 14:23:43 +00:00
Julien Fischer
09c2dbc643 Delete references to unafe.m so that has been removed.
doc/Makefile:
	Delete references to unafe.m so that has been removed.
2007-03-27 02:31:59 +00:00
Julien Fischer
9a9d56918a Cleanups for the rtree module.
Estimated hours taken: 2
Branches: main

Cleanups for the rtree module.
There are no changes to any algorithms.

library/rtree.m:
	Add a reference to the paper by Guttman that is the basis of this
	implementation.

	Conform more closely to our coding standards.

doc/Mmakefile:
	Include the rtree documentation in the library reference guide.
2006-10-23 05:37:22 +00:00
Zoltan Somogyi
4931cb9473 Fix an annoyance: if TEXI2DVI is autoconfigured to a command that
Estimated hours taken: 1
Branches: main

doc/Mmakefile:
	Fix an annoyance: if TEXI2DVI is autoconfigured to a command that
	generates PDFs instead of dvi files, then every make in the doc
	directory remakes a bunch of files, even if they are already up
	to date, because make thinks the dvi files are missing. This diff
	makes the Mmakefile care only about whether TEXI2DVI was run, not
	whether it generates .dvi files.
2006-10-16 06:42:21 +00:00
Julien Fischer
84f159fb9e Don't include the par_builtin module in the library reference guide.
Estimated hours taken: 0
Branches: main

doc/Mmakefile:
	Don't include the par_builtin module in the library reference guide.
2006-06-28 08:10:54 +00:00
Julien Fischer
07a4202df3 Add Greg's R-Tree implementation (+ cleanups by me) to the standard library.
Estimated hours taken: unknown by gjd (+ about 5 by me)
Branches: main (and maybe release)

Add Greg's R-Tree implementation (+ cleanups by me) to the standard library.
There are a couple more things that need to be done, primarily cleanups and
documentation of the insertion and deletion algorithms, so until that's done
this won't be added to the library reference manual.

library/rtree.m:
	New file.  This module provides an R-tree ADT, plus a typeclass
	for defining regions for use with that ADT.

library/library.m:
	Include the new module in the list of library modules.

doc/Mmakefile:
	For the time being don't include the rtree module in the library
	documentation.

tests/hard_coded/Mmakefile:
tests/hard_coded/rtree_test.m:
tests/hard_coded/rtree_test.exp:
	Test case for the new module.
2006-04-05 07:07:46 +00:00
Julien Fischer
3bc5f096d7 Factor out the mutvars used to implement the all-solutions predicates
Estimated hours taken: 1.5
Branches: main

Factor out the mutvars used to implement the all-solutions predicates
into their own module.  For the Java backend they are also used to implement
stores.

library/solutions.m:
	Delete the definition of the mutvar type and supporting predicates
	from this module.

library/mutvar.m:
	New module.  This module provides the mutvar type that currently
	lives in solutions.m (and formerly lived in std_util.m).

library/store.m:
	Fix the definition of generic_mutvars for the Java backend.  This
	has been broken since the change that moved the all-solutions
	predicate to solutions.m.

	Replace ':' as a module qualifier.

library/library.m:
	Add the new module.

compiler/ml_util.m:
	mutvars are handled specially in the IL backend.

doc/Mmakefile:
	Don't include the mutvar module in the library reference manual.
2006-03-29 01:35:19 +00:00
Ian MacLarty
ce245623ae Build pdf versions of the documentation and install them to the web site.
Estimated hours taken: 0.5
Branches: main and 0.12

Build pdf versions of the documentation and install them to the web site.

Mmake.common.in:
configure.in:
	Set PDFTEX to the location of the pdftex program.

doc/Mmakefile:
	Make and install the pdf documentation.

scripts/Mmake.vars.in:
	Set the install directory for pdf version of the documentation.
2005-08-16 15:51:30 +00:00
Zoltan Somogyi
95b64f73a1 Move changes in the library on the mode-constraints branch onto the trunk.
Estimated hours taken: unknown (but probably several weeks by dmo)
Branches: main

Move changes in the library on the mode-constraints branch onto the trunk.

library/eqvclass.m:
	Add some utility functions and predicates.

library/map.m:
	Add some utility functions and predicates, and some type
	specialization directives.

library/tree234.m:
	Add some utility functions and predicates.

library/robdd.m:
	Add this module, which provides a Mercury interface to the C code in
	robdd/bryant.c. In some places, robustness has been sacrificed for
	speed, and the module is not (yet) as well documented as it could be;
	therefore it is not (yet) included in the documentation.

library/pprint.m:
	Print robdds nicely, since this is essential to debugging code handling
	robdds. (This is why adding robdd.m in some other directory, e.g. the
	compiler, wouldn't really work.)

library/term.m:
	Add a function that returns the highest numbered vars created from
	a var_supply.

library/varset.m:
	Add a function that returns the highest numbered vars created from
	a varset.

library/unsafe.m:
	Add this module here, since it may be needed to debug code in the
	library (e.g. in robdd.m.).

library/library.m:
	Add a reference to the robdd module, and a commented out reference
	to the unsafe module. If a developer needs to use unsafe.m anywhere
	in the Mercury implementation, they can uncomment this reference
	in the relevant workspace.

	Make the list of modules easier to maintain (especially in the case
	of CVS conflicts) by listing one module per line.

	Fix formatting of some foreign_procs.

NEWS:
	Mention the new predicates and functions.

Mmake.workspace:
	Add a new make variable that specifies the location of the robdd
	subdirectory.

Mmakefile:
	Add rules for handling the robdd subdirectory.

configure.in:
	Check whether the compiler can handle local foreign_decls, since
	robdd.m now needs this.

tools/bootcheck:
	Add the robdd subdirectory to the stage 2 & 3 directories.

deep_profiler/unsafe.m:
	Remove this module from this directory.

doc/Mmakefile:
	Do not include the robdd and unsafe modules in the documentation.
	The robdd module because (in its present state) it is not stable
	enough, the unsafe module because it is not enabled in installed
	versions of the library.

robdd/Makefile:
	Update the set of default compilation flags. The main code in this
	directory, bryant.c, is #included in library/robdd.m, and the only
	other programs in this directory are test programs.

robdd/Mmakefile:
	New file. Includes a mechanism to compile bryant.c in the robdd
	subdirectory, since this can give cleaner error messages than
	compiling library/robdd.m.

robdd/bryant.[ch]:
	Huge cleanup of these files. Add MR_ROBDD_ prefixes to global symbols,
	make the formatting conform to our standards, and fix irregularities
	in the uses of the macros that control the use of optional facilities.

robdd/bryantPrint.[ch]:
robdd/table.[ch]:
robdd/test_abexit.c:
robdd/test_abunify.c:
robdd/test_abglb.c:
robdd/test_iff.c:
robdd/test_rename.c:
robdd/test_restrict.c:
robdd/test_rglb.c:
robdd/test_upclose.c:
robdd/test_var.c:
robdd/test_vars.c:
robdd/timing.[ch]:
robdd/var.h:
	Conform to the changes in bryant.h. Note that since the code in these
	files won't end up in Mercury program code, they don't need to be
	namespace clean.

runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
	#define GC_I_HIDE_POINTERS before each #include of gc.h (bryant.c
	hides pointers). This impact of this #define is so small that it is
	not measurable.

runtime/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	Add HIDE_POINTER and REVEAL_POINTER, since defining GC_I_HIDE_POINTERS
	makes these macros from gc.h visible.

runtime/mercury_reg_workarounds.[ch]:
	Add the MR_memset function.

tests/debugger/declarative/if_then_else.{inp,exp}:
tests/debugger/declarative/ite_2.{inp,exp,exp2}:
	Avoid a name conflict with the predicate ite in robdd.m.
2004-12-15 06:58:00 +00:00
Fergus Henderson
9af284f298 Add some missing dependencies which are needed now that we generate
Estimated hours taken: 0.5
Branches: main

doc/Mmakefile:
	Add some missing dependencies which are needed now that we generate
	the HTML files using makeinfo.
2004-01-21 05:05:34 +00:00
Zoltan Somogyi
f007b45df8 Implement the infrastructure for term size profiling.
Estimated hours taken: 400
Branches: main

Implement the infrastructure for term size profiling. This means adding two
new grade components, tsw and tsc, and implementing them in the LLDS code
generator. In grades including tsw (term size words), each term is augmented
with an extra word giving the number of heap words it contains; in grades
including tsc (term size cells), each term is augmented with an extra word
giving the number of heap cells it contains. The extra word is at the start,
at offset -1, to leave almost all of the machinery for accessing the heap
unchanged.

For now, the only way to access term sizes is with a new mdb command,
"term_size <varspec>". Later, we will use term sizes in conjunction with
deep profiling to do experimental complexity analysis, but that requires
a lot more research. This diff is a necessary first step.

The implementation of term size profiling consists of three main parts:

- a source-to-source transform that computes the size of each heap cell
  when it is constructed (and increments it in the rare cases when a free
  argument of an existing heap cell is bound),

- a relatively small change to the code generator that reserves the extra
  slot in new heap cells, and

- extensions to the facilities for creating cells from C code to record
  the extra information we now need.

The diff overhauls polymorphism.m to make the source-to-source transform
possible. This overhaul includes separating type_ctor_infos and type_infos
as strictly as possible from each other, converting type_ctor_infos into
type_infos only as necessary. It also includes separating type_ctor_infos,
type_infos, base_typeclass_infos and typeclass_infos (as well as voids,
for clarity) from plain user-defined type constructors in type categorizations.
This change needs this separation because values of those four types do not
have size slots, but they ought to be treated specially in other situations
as well (e.g. by tabling).

The diff adds a new mdb command, term_size. It also replaces the proc_body
mdb command with new ways of using the existing print and browse commands
("print proc_body" and "browse proc_body") in order to make looking at
procedure bodies more controllable. This was useful in debugging the effect
of term size profiling on some test case outputs. It is not strictly tied
to term size profiling, but turns out to be difficult to disentangle.

compiler/size_prof.m:
	A new module implementing the source-to-source transform.

compiler/notes/compiler_design.html:
	Mention the new module.

compiler/transform_hlds.m:
	Include size_prof as a submodule of transform_hlds.

compiler/mercury_compile.m:
	If term size profiling is enabled, invoke its source-to-source
	transform.

compiler/hlds_goal.m:
	Extend construction unifications with an optional slot for recording
	the size of the term if the size is a constant, or the identity of the
	variable holding the size, if the size is not constant. This is
	needed by the source-to-source transform.

compiler/quantification.m:
	Treat the variable reference that may be in this slot as a nonlocal
	variable of construction unifications, since the code generator needs
	this.

compiler/compile_target_code.m:
	Handle the new grade components.

compiler/options.m:
	Implement the options that control term size profiling.

doc/user_guide.texi:
	Document the options and grade components that control term size
	profiling, and the term_size mdb command. The documentation is
	commented out for now.

	Modify the wording of the 'u' HLDS dump flag to include other details
	of unifications (e.g. term size info) rather than just unification
	categories.

	Document the new alternatives of the print and browse commands. Since
	they are for developers only, the documentation is commented out.

compiler/handle_options.m:
	Handle the implications of term size profiling grades.

	Add a -D flag value to print HLDS components relevant to HLDS
	transformations.

compiler/modules.m:
	Import the new builtin library module that implements the operations
	needed by term size profiling automatically in term size profiling
	grades.

	Switch the predicate involved to use state var syntax.

compiler/prog_util.m:
	Add predicates and functions that return the sym_names of the modules
	needed by term size profiling.

compiler/code_info.m:
compiler/unify_gen.m:
compiler/var_locn.m:
 	Reserve an extra slot in heap cells and fill them in in unifications
	marked by size_prof.

compiler/builtin_ops.m:
	Add term_size_prof_builtin.term_size_plus as a builtin, with the same
	implementation as int.+.

compiler/make_hlds.m:
	Disable warnings about clauses for builtins while the change to
	builtin_ops is bootstrapped.

compiler/polymorphism.m:
	Export predicates that generate goals to create type_infos and
	type_ctor_infos to add_to_construct.m. Rewrite their documentation
	to make it more detailed.

	Make orders of arguments amenable to the use of state variable syntax.

	Consolidate knowledge of which type categories have builtin unify and
	compare predicates in one place.

	Add code to leave the types of type_ctor_infos alone: instead of
	changing their types to type_info when used as arguments of other
	type_infos, create a new variable of type type_info instead, and
	use an unsafe_cast. This would make the HLDS closer to being type
	correct, but this new code is currently commented out, for two
	reasons. First, common.m is currently not smart enough to figure out
	that if X and Y are equal, then similar unsafe_casts of X and Y
	are also equal, and this causes the compiler do not detect some
	duplicate calls it used to detect. Second, the code generators
	are also not smart enough to know that if Z is an unsafe_cast of X,
	then X and Z do not need separate stack slots, but can use the same
	slot.

compiler/type_util.m:
	Add utility predicates for returning the types of type_infos and
	type_ctor_infos, for use by new code in polymorphism.m.

	Move some utility predicates here from other modules, since they
	are now used by more than one module.

	Rename the type `builtin_type' as `type_category', to better reflect
	what it does. Extend it to put the type_info, type_ctor_info,
	typeclass_info, base_typeclass_info and void types into categories
	of their own: treating these types as if they were a user-defined
	type (which is how they used to be classified) is not always correct.
	Rename the functor polymorphic_type to variable_type, since types
	such as list(T) are polymorphic, but they fall into the user-defined
	category. Rename user_type as user_ctor_type, since list(int) is not
	wholly user-defined but falls into this category. Rename pred_type
	as higher_order_type, since it also encompasses functions.

	Replace code that used to check for a few of the alternatives
	of this type with code that does a full switch on the type,
	to ensure that they are updated if the type definition ever
	changes again.

compiler/pseudo_type_info.m:
	Delete a predicate whose updated implementation is now in type_util.m.

compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
	Still treat type_infos, type_ctor_infos, typeclass_infos and
	base_typeclass_infos as user-defined types, but prepare for when
	they won't be.

compiler/hlds_pred.m:
	Require interface typeinfo liveness when term size profiling is
	enabled.

	Add term_size_profiling_builtin.increase_size as a
	no_type_info_builtin.

compiler/hlds_out.m:
	Print the size annotations on unifications if HLDS dump flags call
	for unification details. (The flag test is in the caller of the
	modified predicate.)

compiler/llds.m:
	Extend incr_hp instructions and data_addr_consts with optional fields
	that allow the code generator to refer to N words past the start of
	a static or dynamic cell. Term size profiling uses this with N=1.

compiler/llds_out.m:
	When allocating memory on the heap, use the macro variants that
	specify an optional offset, and specify the offset when required.

compiler/bytecode_gen.m:
compiler/dense_switch.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/goal_form.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/inst_match.m:
compiler/intermod.m:
compiler/jumpopt.m:
compiler/lambda.m:
compiler/livemap.m:
compiler/ll_pseudo_type_info.m:
compiler/lookup_switch.m:
compiler/magic_util.m:
compiler/middle_rec.m:
compiler/ml_code_util.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/modecheck_unify.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_conj_gen.m:
compiler/post_typecheck.m:
compiler/reassign.m:
compiler/rl.m:
compiler/rl_key.m:
compiler/special_pred.m:
compiler/stack_layout.m:
compiler/static_term.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unused_args.m:
compiler/use_local_vars.m:
	Minor updates to conform to the changes above.

library/term_size_prof_builtin.m:
	New module containing helper predicates for term size profiling.
	size_prof.m generates call to these predicates.

library/library.m:
	Include the new module in the library.

doc/Mmakefile:
	Do not include the term_size_prof_builtin module in the library
	documentation.

library/array.m:
library/benchmarking.m:
library/construct.m:
library/deconstruct.m:
library/io.m:
library/sparse_bitset.m:
library/store.m:
library/string.m:
	Replace all uses of MR_incr_hp with MR_offset_incr_hp, to ensure
	that we haven't overlooked any places where offsets may need to be
	specified.

	Fix formatting of foreign_procs.

	Use new macros defined by the runtime system when constructing
	terms (which all happen to be lists) in C code. These new macros
	specify the types of the cell arguments, allowing the implementation
	to figure out the size of the new cell based on the sizes of its
	fields.

library/private_builtin.m:
	Define some constant type_info structures for use by these macros.
	They cannot be defined in the runtime, since they refer to types
	defined in the library (list.list and std_util.univ).

util/mkinit.c:
	Make the addresses of these type_info structures available to the
	runtime.

runtime/mercury_init.h:
	Declare these type_info structures, for use in mkinit-generated
	*_init.c files.

runtime/mercury_wrapper.[ch]:
	Declare and define the variables that hold these addresses, for use
	in the new macros for constructing typed lists.

	Since term size profiling can refer to a memory cell by a pointer
	that is offset by one word, register the extra offsets with the Boehm
	collector if is being used.

	Document the incompatibility of MR_HIGHTAGS and the Boehm collector.

runtime/mercury_tags.h:
	Define new macros for constructing typed lists.

	Provide macros for preserving the old interface presented by this file
	to the extent possible. Uses of the old MR_list_cons macro will
	continue to work in grades without term size profiling. In term
	size profiling grades, their use will get a C compiler error.

	Fix a bug caused by a missing backslash.

runtime/mercury_heap.h:
	Change the basic macros for allocating new heap cells to take
	an optional offset argument. If this is nonzero, the macros
	increment the returned address by the given number of words.
	Term size profiling specifies offset=1, reserving the extra
	word at the start (which is ignored by all components of the
	system except term size profiling) for holding the size of the term.

	Provide macros for preserving the old interface presented by this file
	to the extent possible. Since the old MR_create[123] and MR_list_cons
	macros did not specify type information, they had to be changed
	to take additional arguments. This affects only hand-written C code.

	Call new diagnostic macros that can help debug heap allocations.

	Document why the macros in this files must expand to expressions
	instead of statements, evn though the latter would be preferable
	(e.g. by allowing them to declare and use local variables without
	depending on gcc extensions).

runtime/mercury_debug.[ch]:
	Add diagnostic macros to debug heap allocations, and the functions
	behind them if MR_DEBUG_HEAP_ALLOC is defined.

	Update the debugging routines for hand-allocated cells to print the
	values of the term size slot as well as the other slots in the relevant
	grades.

runtime/mercury_string.h:
	Provide some needed variants of the macro for copying strings.

runtime/mercury_deconstruct_macros.h:
runtime/mercury_type_info.c:
	Supply type information when constructing terms.

runtime/mercury_deep_copy_body.h:
	Preserve the term size slot when copying terms.

runtime/mercury_deep_copy_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_ml_expand_body.h:
	Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
	that allocate cells also allocate space for the term size slot if
	necessary.

	Reduce code duplication by using a now standard macro for copying
	strings.

runtime/mercury_grade.h:
	Handle the two new grade components.

runtime/mercury_conf_param.h:
	Document the C macros used to control the two new grade components,
	as well as MR_DEBUG_HEAP_ALLOC.

	Detect incompatibilities between high level code and profiling.

runtime/mercury_term_size.[ch]:
	A new module to house a function to find and return term sizes
	stored in heap cells.

runtime/mercury_proc_id.h:
runtime/mercury_univ.h:
	New header files. mercury_proc_id.h contains the (unchanged)
	definition of MR_Proc_Id, while mercury_univ.h contains the
	definitions of the macros for manipulating univs that used to be
	in mercury_type_info.h, updated to use the new macros for allocating
	memory.

	In the absence of these header files, the following circularity
	would ensue:

	mercury_deep_profiling.h includes mercury_stack_layout.h
		- needs definition of MR_Proc_Id
	mercury_stack_layout.h needs mercury_type_info.h
		- needs definition of MR_PseudoTypeInfo
	mercury_type_info.h needs mercury_heap.h
		- needs heap allocation macros for MR_new_univ_on_hp
	mercury_heap.h includes mercury_deep_profiling.h
		- needs MR_current_call_site_dynamic for recording allocations

	Breaking the circular dependency in two places, not just one, is to
	minimize similar problems in the future.

runtime/mercury_stack_layout.h:
	Delete the definition of MR_Proc_Id, which is now in mercury_proc_id.h.

runtime/mercury_type_info.h:
	Delete the macros for manipulating univs, which are now in
	mercury_univ.h.

runtime/Mmakefile:
	Mention the new files.

runtime/mercury_imp.h:
runtime/mercury.h:
runtime/mercury_construct.c:
runtime/mercury_deep_profiling.h:
	Include the new files at appropriate points.

runtime/mercury.c:
	Change the names of the functions that create heap cells for
	hand-written code, since the interface to hand-written code has
	changed to include type information.

runtime/mercury_tabling.h:
	Delete some unused macros.

runtime/mercury_trace_base.c:
runtime/mercury_type_info.c:
	Use the new macros supplying type information when constructing lists.

scripts/canonical_grade_options.sh-subr:
	Fix an undefined sh variable bug that could cause error messages
	to come out without identifying the program they were from.

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade_options.sh-subr:
scripts/mgnuc.in:
	Handle the new grade components and the options controlling them.

trace/mercury_trace_internal.c:
	Implement the mdb command "term_size <varspec>", which is like
	"print <varspec>", but prints the size of a term instead of its value.
	In non-term-size-profiling grades, it prints an error message.

	Replace the "proc_body" command with optional arguments to the "print"
	and "browse" commands.

doc/user_guide.tex:
	Add documentation of the term_size mdb command. Since the command is
	for implementors only, and works only in grades that are not yet ready
	for public consumption, the documentation is commented out.

	Add documentation of the new arguments of the print and browse mdb
	commands. Since they are for implementors only, the documentation
	is commented out.

trace/mercury_trace_vars.[ch]:
	Add the functions needed to implement the term_size command, and
	factor out the code common to the "size" and "print"/"browse" commands.

	Decide whether to print the name of a variable before invoking the
	supplied print or browse predicate on it based on a flag design for
	this purpose, instead of overloading the meaning of the output FILE *
	variable. This arrangement is much clearer.

trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
	Supply type information when constructing terms.

browser/program_representation.m:
	Since the new library module term_size_prof_builtin never generates
	any events, mark it as such, so that the declarative debugger doesn't
	expect it to generate any.

	Do the same for the deep profiling builtin module.

tests/debugger/term_size_words.{m,inp,exp}:
tests/debugger/term_size_cells.{m,inp,exp}:
	Two new test cases, each testing one of the new grades.

tests/debugger/Mmakefile:
	Enable the two new test cases in their grades.

	Disable the tests sensitive to stack frame sizes in term size profiling
	grades.

tests/debugger/completion.exp:
	Add the new "term_size" mdb command to the list of command completions,
	and delete "proc_body".

tests/debugger/declarative/dependency.{inp,exp}:
	Use "print proc_body" instead of "proc_body".

tests/hard_coded/nondet_c.m:
tests/hard_coded/pragma_inline.m:
	Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
	that allocate cells also allocate space for the term size slot if
	necessary.

tests/valid/Mmakefile:
	Disable the IL tests in term size profiling grades, since the term size
	profiling primitives haven't been (and probably won't be) implemented
	for the MLDS backends, and handle_options causes a compiler abort
	for grades that combine term size profiling and any one of IL, Java
	and high level C.
2003-10-20 07:29:59 +00:00
Fergus Henderson
2023bb2d67 Use makeinfo --html' rather than perl texi2html' for creating
Estimated hours taken: 3
Branches: main

doc/Mmakefile:
	Use `makeinfo --html' rather than `perl texi2html' for creating
	the HTML version of the documentation.  Since makeinfo outputs
	the HTML to different file names than texi2html, this also required
	various other changes to handle the different file names.

doc/faq.texi:
doc/library.texi:
doc/reference_manual.texi:
doc/transition_guide.texi:
doc/user_guide.texi:
	Change @ifinfo to @ifnottex.
	Uncomment the @dircategory commands, which were previously commented
	out because they weren't supported by (our old version of) texi2html.
	Update copyright dates.
2003-07-23 03:38:45 +00:00
Simon Taylor
7597ca1e80 Allow reconfiguration of existing installations, for example
Estimated hours taken: 20
Branches: main

Allow reconfiguration of existing installations, for example
to use a different C compiler. The reconfiguration works
by making a new copy of the scripts and mercury_conf.h,
and storing them in a partial installation directory tree
which uses the libraries and executables from the existing
installation.

Use this method to configure binary distributions, rather
than using a cut down version of the configuration script,
to avoid code duplication and to handle the case where the
C compiler in use on the installation machine is different
than that used to build the binary distribution.

This is more robust than the previous method of using a different
C compiler, which was to set the MERCURY_C_COMPILER variable and
hope the different C compilers were compatible enough.

Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
	Modify the `install' targets to store files needed to create
	a new configuration in $INSTALL_LIBDIR/reconf.

runtime/Mmakefile:
	Install mercury_conf.h in $INSTALL_LIBDIR/conf, rather than
	$INSTALL_LIBDIR/inc, so that it can be overridden by a
	different configuration.

scripts/mercury_config.in:
	Create a new configuration, by creating part of a Mercury
	source tree from the files stored in $INSTALL_LIBDIR/reconf,
	running configure, then copying the files into a partial
	installation tree.

scripts/Mmake.vars.in:
	Define ENABLE_DEEP_PROFILER, for use by bindist/bindist.Makefile.

	Define variables INSTALL_CONF_DIR (contains the files describing
	the configuration) and INSTALL_RECONF_DIR (contains files needed
	to reconfigure an installation).

configure.in:
	Add an option `--enable-reconfigure', for use by
	mercury_config.in.

	Don't look for runtime/mercury_wrapper.c when checking
	for the sources -- it isn't present when reconfiguring.
	Look for scripts/mmc.in instead.

	Look for the runtime headers in the installation hierarchy
	rather than the `runtime/' and `trace/' directories when
	reconfiguring.

	Output the help message for the `configure' script to
	`configure.help'.  This is included in the help message
	for `mercury_config'.

	Add new configuration variables CONFIG_PREFIX and CONFIG_LIBDIR,
	which are like PREFIX and LIBDIR except that they point
	to the configuration files, not the library files.
	In the normal case PREFIX and CONFIG_PREFIX will be the same.

bindist/bindist.INSTALL.in:
bindist/bindist.Makefile.in:
	Use mercury_config to configure binary distributions.

bindist/Mmakefile:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
	Remove bindist.configure.in and bindist.build_vars.in.

compiler/options.m:
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
doc/user_guide.texi:
	Add an option `--mercury-config-dir', and an environment
	variable MERCURY_CONFIG_DIR, which tell the compiler and
	scripts where to find the configuration files for the
	installation.
	MERCURY_CONFIG_DIR is not documented because it should
	only be used by the scripts.

compiler/compile_target_code.m:
	Pass `--mercury-config-dir' to the scripts.

compiler/handle_options.m:
	Add `--c-include-directory $MERCURY_CONFIG_DIR/conf'.

library/getopt.m:
	Handle `maybe_string_special' options.

doc/user_guide.texi:
	Update the "Using a different C compiler" chapter.

NEWS:
	Document the changes.
2003-01-24 07:17:13 +00:00
Fergus Henderson
db910f3024 Refactor to improve maintainability: put the lists of files
Branches: main
Estimated hours taken: 0.5

doc/Mmakefile:
	Refactor to improve maintainability: put the lists of files
	at a single place at the start of the Mmakefile, rather than
	duplicating in the dependencies in each rule.

	Also, add new targets `formatted_manpages' (*.man)
	and `help' (*.help), for debugging make_manpages.
2003-01-22 06:28:29 +00:00
Simon Taylor
d68cfc5be6 Remove the generated *.cps files.
Estimated hours taken: 0.1
Branches: main, release

doc/Mmakefile:
	Remove the generated *.cps files.
2002-11-29 07:05:43 +00:00
Simon Taylor
72f34f5b3d Fix link problems on murlibobo caused by my recent changes
Estimated hours taken: 2
Branches: main

Fix link problems on murlibobo caused by my recent changes
to the way libmer_std.so and libmer_browser.so are built.
The problem was due to shared libraries being renamed
after they were built without telling the linker.

library/mer_std.m:
browser/mer_browser.m:
	Empty modules used to generate the libraries with
	the correct names.

library/Mmakefile:
browser/Mmakefile:
	Build and install libmer_std.* and libmer_browser.*
	rather than liblibrary.* and libmdb.*.

Mmake.workspace:
Mmake.common.in:
	Make sure SO_LOCATIONS_DIR is in ml's environment
	when building the libraries.

	Fix the order of the `-l' options.

compiler/Mmakefile:
	Make sure `main.o' comes before the library `.a' files
	on the ml command line.

doc/Mmakefile:
	Add mer_std.m to the list of files for which documentation
	should not be generated.

trace/Mmakefile:
	Add the grade-specific library directory to the rpath
	for libmer_trace.so.
2002-05-13 08:09:43 +00:00
Simon Taylor
2c2629b22b Make the `.texi_pp' files depend on the VERSION file.
Estimated hours taken: 0.25
Branches: main, release

doc/Mmakefile:
	Make the `.texi_pp' files depend on the VERSION file.
	This ensures that the dates in the ROTD documentation
	on the web site are updated nightly.
2002-01-09 04:15:06 +00:00
Simon Taylor
174ce84fd5 Remove the automatically generated mercury.info and mercury.html
Estimated hours taken: 0.1
Branches: main, release

doc/Mmakefile:
	Remove the automatically generated mercury.info and mercury.html
	files in the `realclean' target.
2001-10-06 09:00:37 +00:00
Simon Taylor
a082239edb Put version identifiers in the documentation.
Estimated hours taken: 1.5
Branches: main, release

Put version identifiers in the documentation.

doc/Mmakefile:
	Preprocess the `.texi' files to produce `.texi_pp' files.
	The `.texi_pp' files contain the contents of the `.texi'
	files with the string <VERSION> replaced by the value
	of $(VERSION), which is taken from the file VERSION
	in the top-level `mercury' directory.

	The rules to automatically generate the `.texi' files
	for the library reference manual now generate `.texi_pp' files.
	This makes it clearer that they are not to be edited.

	Fix a bug which was causing the library documentation on the
	web page to be out of date -- library_1.html needs to depend
	on library-chapters.texi_pp.

doc/faq.texi:
doc/library.texi:
doc/reference_manual.texi:
doc/transition_guide.texi:
doc/user_guide.texi:
	Add version information.

	Put a proper heading at the top of mercury_ref.info.

doc/mercury.html.in:
doc/mercury.info.in:
doc/mercury.html:
doc/mercury.info:
	Add `.in' files which are preprocessed as for the `.texi' files.
	Remove the old unpreprocessed versions.

doc/texi2html:
	Allow `.texi_pp' as a suffix for the texinfo files to process.

w3/information/Makefile
	Create the VERSION file, and include it in the generated
	Mmake.common.
2001-10-03 11:37:56 +00:00