Use mmap for Boehm GC in threaded grades on Linux.

The glibc implementation of malloc (commonly used on Linux) can use sbrk
to acquire more memory, and so does Boehm GC in its default configuration
on Linux.  When both allocators are invoked simultaneously from different
threads then memory corruption may result.

configure.ac:
	Add --enable-gc-mmap option.

	Make --enable-gc-munmap imply --enable-gc-mmap.

	Detect mmap and set MR_HAVE_MMAP.

	Detect sbrk and set MR_HAVE_SBRK.

	On Linux (and potentially other platforms), build Boehm GC for
	threaded grades with -DUSE_MMAP if mmap was found.

Mmake.common.in:
	Add ENABLE_BOEHM_USE_MMAP.

runtime/mercury_conf.h.in:
	Add MR_HAVE_MMAP, although it is not used anywhere yet.

	Add MR_HAVE_SBRK.  It is only for used by the test program.

tests/hard_coded/Mmakefile:
tests/hard_coded/thread_sbrk.exp:
tests/hard_coded/thread_sbrk.exp2:
tests/hard_coded/thread_sbrk.m:
	Add test program.

NEWS:
	Announce changes.

(cherry picked from commit d63a294e1fa4b1a91b6c7acd9fe8ba45d9cffb6d)
Enable the asm_fast* (and reg*) grades on x86_64 OS X machines.

configure.ac:
	Do not set the LLDS base grade to 'none' if we are on 64-bit OS X and
	we are using GCC 4.3 onwards.  (Older versions of GCC are either
	broken or do not work on this platform anyway.)

README.MacOS:
	Mention that the asm_fast* and reg* grades do work on x86_64
	systems.
NEWS:
	Announce that the asm_fast* and reg* grades are now supported
	on x86_64 OS X machines.
Fix white space.
Add char.det_digit_to_int/1 to the library.

library/char.m:
	As above.

NEWS:
	Announce the addition.
Add pred versions of list.filter_map_corresponding.

library/list.m:
    Add versions of the 2 and 3 argument versions of filter_map_corresponding
    that take a semidet pred, not a semidet func, since semidet preds are
    cleaner than semidet funcs.
Fix some comments in array.m.
Add an XXX comment to compiler/table_gen.m.
Expect hard_coded/write_float_special to fail.

Should be undone when the printing of nans and infs is standardized
in code we control, and this test gets the same output on all platforms.
Fix some comments in array.m.
Merge branch 'version-14_01-branch'
Delete duplicate news items.

NEWS:
	Delete items for changes that were backported to 14.01.1.
Fix formatting in configure usage message.

configure.ac:
	Add some missing commas.
Speed up merging instmaps slightly.

compiler/instmap.m:
    Construct yes(Type) only once instead of many times.
Mark varset.merge_subst as obsolete.

library/varset.m:
    Mark merge_subst and merge_subst_without_names with `pragma obsolete'.
    The comments on them have been requesting people to use merge_renaming
    and merge_renaming_without_names instead for about seven years, which
    I think is enough warning :-)

    Avoid using the obsolete predicates in varset.m itself.

library/term.m:
    To make it possible to avoid using the obsolete predicates in varset.m
    itself, add predicates that apply renamings, not substitutions, to a
    term or a list of terms. Provide a renaming type to make this more
    convenient.

    Note that when term.apply_renaming actually does a renaming, the context
    on the new term will be the original context, while term.apply_substitution
    would have replaced this with the context on the replacement term.
    I expect that in the vast majority of cases, the context does not matter.
    In cases where it does, I expect that which context is better depends
    on the situation; both choices have points in favor and against.

compiler/inst_graph.m:
compiler/prog_mode.m:
compiler/recompilation.version.m:
    Use merge_renaming instead of merge_subst, and thus avoid shenanigans
    with converting general terms back to variables.

compiler/rbmm.region_resurrection_renaming.m:
    Add an "rbmm_" prefix to some types, to avoid the type "renaming"
    being defined both by this module and (now) by library/term.m.

compiler/rbmm*.m:
    Conform to the type name changes in rbmm.region_resurrection_renaming.m..
Fix C compiler warnings for robdd.m.

When compiling the library directory, we used to get C compiler warnings
about assigning ints to pointers, because on many machines an int is 32 bits,
while pointers are 64. The problem was in robdd/bryant.c, which is bodily

robdd/robdd_conf.h.in:
    New autoconfigured file that specifies what integer type to use
    in robdd nodes (it is now given the typedef name MR_ROBDD_int),
    and how many bits it has.

configure.ac:
    Build robdd_conf.h from robdd_conf.h.in after gathering the info it needs.

robdd/bryant.[ch]:
    Replace almost all uses of ints with MR_ROBDD_ints. The only exceptions
    are the places where int is used as a bool, and where it is used
    as a comparison result (where we need distinguish only between -1, 0, 1).

    In places where MR_ROBDD_ints are printed out, print them with %ld
    after casting them to long.

    Replace the only use of unsigned long, in bitmasks, with MR_ROBDD_uint,
    the unsigned version of MR_ROBDD_int. As far as I can tell, it always
    should have been the same size as the signed ints (and on most 32 bit
    architectures, it was, although by accident).

    Note that bryant.c does NOT compile if e.g. MR_ROBDD_STATISTICS
    is defined. However, that is not the fault of this diff; even the
    version before this diff (from 2004!) had that problem.

    Fix some obvious formatting issues.

    Delete some functions that were declared but never called. (In fact,
    one wasn't even defined :-()

library/Mmakefile:
    Rebuild robdd.o if any of ../robdd/{bryant.[ch],robdd_conf.h} is modified.
Use a better algorithm for unwinding version_arrays.

The old version_array rewind code used linear stack space in order to
perform it's updates in the right order (newest to oldest) by following the
structure's next pointers (which are a oldest to newest list).  I previously
introduced week prev pointers so that walking over this structure newest to
oldest could be done with constant stack space.  However that is less
efficient than the method suggested by Peter Wang.

Peter suggested using a bitmap and traversing oldest-to-newest, marking
each update in the bitmap and checking the bitmap before making any update.
Thus preserving older values over newer ones (which is good, this code
_rewinds_ updates).  This patch implements Peter's suggestion and removes
the prev pointers from the structure for C and Java backends.

Thanks to Peter Wang for giving me a hand with C#.

library/version_array.m:
    As above.

runtime/mercury_bitmap.h:
    Add some macros for initialising bitmaps and testing, setting and clearing
    their bits.

library/bitmap.m:
java/runtime/MercuryBitmap.java:
    Move the Java MercuryBitmap class into the runtime library.  This makes
    it easier for other standard library modules to use this Java class.

library/bitmap.m:
runtime/mercury_dotnet.cs.in:
    Move C# MercuryBitmap class into runtime/mercury_dotnet.cs

library/bitmap.m:
    Add extra methods to the C# MercuryBitmap class.

tests/hard_coded/version_array_test.exp:
tests/hard_coded/version_array_test.m:
    Ensure that the test verifies that rolling back updates to a version
    array rolls back changes in the correct order: If two updates modify the
    same cell, then the older one should be visible in the result.

    Use longer arrays so that the bitmap used in the rollback code is more
    than one byte in length.