Commit Graph

818 Commits

Author SHA1 Message Date
Julien Fischer
776d5ce3ed More Visual C related stuff.
Branches: main, 11.07

More Visual C related stuff.

compiler/globals.m:
	Allow the C compiler type string for Visual C to have the form
	"msvc_<VERSION>" as well as "cl_<VERSION>".  Support for the
	latter form will eventually be dropped.

configure.in:
	Avoid pattern matching on the value of CC; it isn't a reliable
	way of telling what the C compiler is.

	Use the "-" form of options for MSVC in more places.

scripts/ml.in:
	Use the "-" form of options for MSVC.
2011-09-21 06:11:30 +00:00
Julien Fischer
ae33e13de7 Various fixes for MSVC.
Branches: main, 11.07

Various fixes for MSVC.

configure.in:
	Use -link instead of /link with MSVC since the latter
	form causes trouble for MSYS.

scripts/ml.in:
	As above, but for the -DEBUG option.

scripts/parse_ml_options.sh-subr.in:
	Don't strip executables on MinGW for the moment.
	(XXX We should re-enable this for the MinGW / GCC
	combination and probably also check what the current
	situation on Cygwin and Darwin is.)

library/store.m:
	Shut up a warning from MSVC about a local variable
	that is used without being initialised.
2011-09-09 19:29:44 +00:00
Julien Fischer
96c68d4157 Support using clang as a C compiler with Mercury -- currently only
Branches: main, 11.07

Support using clang as a C compiler with Mercury -- currently only
tested on Mac OS X.

Clean up the handling of C compilers in the configure script.

configure.in:
	Improve this script's ability to distinguish between different
	types of C compiler.  In particular, ensure that a clear
	distinction is maintained between clang and gcc.

	Fix an old XXX: don't rely on pattern matching on the value
	of $CC to determine the C compiler type.  This is particularly
	error prone now since one compiler is named "clang" and another
	"cl".

	Set optimization and warning flags for clang.
	(XXX this is currently very conservative; we need to go through
	them and work out what good defaults might be.)

	Don't link against libgcc if we are using clang.
	(XXX I don't think this is really necessary for gcc either in
	the great majority of cases.)

	Mark spots that still need updating with "XXX CLANG"; I will
	look into these separately.

aclocal.m4:
	Add a new macro that determines the C compiler type based
	on what builtin macros are defined -- unlike AC_PROG_CC
	this macro correctly distinguishes between gcc and clang.

	Add two new macros that determine version information for
	clang and for Visual C.

scripts/mgnuc.in:
scripts/ml.in:
	Handle clang

README.MacOS:
	Mention that clang can be used with Mercury on Mac OS X.
2011-08-25 14:16:53 +00:00
Julien Fischer
66bcbcf817 Improve support for building the Visual C port in MSYS.
Branches: main, 11.07

Improve support for building the Visual C port in MSYS.

configure.in:
scripts/mgnuc.in:
	Use the -OPT form for cl command line options
	instead of the /OPT form.  The latter confuses
	the MSYS shell.
2011-07-15 08:10:43 +00:00
Julien Fischer
34f8eecc4d Workaround problems with GCC 4.4 - 4.6 on i*86 Linux.
Branches: main, 11.07

Workaround problems with GCC 4.4 - 4.6 on i*86 Linux.

scripts/mgnuc.in:
	Compile some C files with -O0 on i*86 in order to avoid
	problems with GCC.
2011-07-04 07:45:11 +00:00
Julien Fischer
b3b4f26d84 Avoid a problem that was causing exception handlers to not work on MinGW /
Branches: main, 11.01

Avoid a problem that was causing exception handlers to not work on MinGW /
Windows XP in the hlc grades.

configure.in:
scripts/mgnuc.in:
	Avoid the use of gcc's -fomit-frame-pointer option on MinGW.
	It interferes with the correct operation of setjmp / longjmp.
	(It does *not* interfere with gcc's __builtin_{set,long}jmp, so
	maybe exceptions should be implemented using those where possible.)

library/backjump.m:
	Unrelated change: fix some broken debugging code.
2011-03-19 16:43:49 +00:00
Julien Fischer
96cfd19ece Remove stuff required for supporting Windows 98.
Branches: main, 11.01

scripts/mercury.bat.in:
	Remove stuff required for supporting Windows 98.  We now require
	the use of at least Windows XP.

	Don't export environment changes beyond this file.

	Delete some comments about Cygwin being required -- they don't
	belong here and the requirement for a Unix-like environment
	for building Mercury is covered elsewhere.
2011-02-16 04:43:05 +00:00
Julien Fischer
cb7ef8dfb7 Fix the man page installation directory.
Branches: main, 11.01

Fix the man page installation directory.

scripts/Mmake.vars.in:
	s/Man/man/
2010-12-20 16:29:08 +00:00
Julien Fischer
32463ba134 Attempt to preserve file attributes in the boehm_gc/libatomic_ops
Branches: main

scripts/prepare_install_dir.in:
	Attempt to preserve file attributes in the boehm_gc/libatomic_ops
	directories.  This can prevent autoconf needing to re-invoked.

	Use "cp -R" rather than "cp -r".  The latter is not as portable.
2010-12-19 13:44:35 +00:00
Paul Bone
0ee263a3fe Modify the documentation that discusses how to override INSTALL_PATH
Mmke.vars.in:
    Modify the documentation that discusses how to override INSTALL_PATH
    to describe setting of $DESTDIR instead.

    Don't add a slash before INSTALL_PATH if DESTDIR is empty since this
    breaks installation on Windows.  (This change has already been made
    in Mmake.common.in)

    Set more FINAL_INSTALL_ variables to support the new code in
    Mmakefile and bindist.Makefile.in.

Mmake.common.in:
    Improve the prose in a comment.

Mmakefile:
    Update installation message.

    Tell the user that their install is in $(DESTDIR) if applicable.

    Use FINAL_INSTALL variables rather than INSTALL variables.
2010-12-17 00:28:08 +00:00
Paul Bone
fd1459eccc Compatibility with Debian packaging.
Packaging Mercury for Debian requires creating some patches to make sure that
Mercury can be built under the control of dpkg-buildpackage.  It's recommended
that these patches are pushed upstream (into Mercury) so that everyone can
benefit from them, not just Debian packagers.

Mmake.common.in:
scripts/Mmake.vars.in:
    Install Mercury at $DESTDIR/@prefix@, $DESTDIR helps someone setup Mercury
    to run from @prefix@ while putting it in $DESTDIR.  $DESTDIR/* can easily
    be tared up and then deployed on other systems.

Mmakefile:
Makefile:
    Pass the $DESTDIR variable to make sub-processes.

scripts/Mercury.config.in:
scripts/Mercury.config.bootstrap.in:
    Remove the hash-bang line from these scripts since they are not executable.

    This change improves conformance with Debian packaging standards.
2010-12-14 07:01:55 +00:00
Julien Fischer
99d591f126 Avoid warnings from the mgnuc script on MinGW, Cygwin and Solaris when
Branches: main, 10.04

Avoid warnings from the mgnuc script on MinGW, Cygwin and Solaris when
compiling the source distribution.  The warnings are from the "which" command,
which is used in the mgnuc script when checking for the presence of the
mfiltercc utility program.  (If the command named in the argument to which
cannot be found on the above systems it fails rather noisily rather than just
setting a non-zero exist status as on Linux and Mac OS X.)

The solution is to ensure that mfiltercc is built before anything that requires
it.

Mmakefile:
	Add a new top-level target util_no_rt that builds those programs in the
	util directory that do not depend on anything in the runtime directory.

scripts/mgnuc.in:
scripts/mgnuc_file_opt.sh-subr:
	Add a new option, --no-filter-cc, that tells mgnuc not to bother
	filtering the warning output of the C compiler.

util/Makefile:
	Compile mfiltercc with --no-filter-cc since for the source distribution
	it obviously won't exist until we do compile it.

util/mfiltercc.c:
	Add a note at the top of this file mentioning the requirement that it
	not depend on anything in the runtime directory.
2010-12-07 07:50:29 +00:00
Julien Fischer
978defbde8 Avoid another problem with expr on FreeBSD.
Branches: main, 10.04

Avoid another problem with expr on FreeBSD.

scripts/parse_ml_options.sh-subr.in:
	Avoid invoking expr with a first argument that has a leading
	minus sign.
2010-12-02 03:36:38 +00:00
Julien Fischer
3adcde57bf Apply a patch from Keri Harris that fixes a problem with mmake --use-mmc-make
Branches: main, 10.04

Apply a patch from Keri Harris that fixes a problem with mmake --use-mmc-make
when using GNU make 3.82.  The problem was that we were mixing normal and
implicit rules and GNU make no longer supports this (and officially never
did).

scripts/Mmake.rules:
	Don't mix normal and implicit rules.
2010-11-08 07:57:23 +00:00
Peter Wang
fd76da59ff Add support for the csharp' grade to mmc --make', and make it possible to
Branches: main

Add support for the `csharp' grade to `mmc --make', and make it possible to
install the `csharp' grade with `mmake install'.

Also some miscellaneous fixes.


configure.in:
        Require a recent enough bootstrap compiler that recognises C# as a
        language for `pragma foreign_type'.

Mmakefile:
        Use `mmc --make' to install the standard library in csharp grade.

aclocal.m4:
        Search for the Mono C# compiler `gmcs', which is required for generics
        at this time.  Prefer it over the DotGNU C# compiler, which I have not
        tested.

        Search for `mono'.  If found, it will be used in shell scripts to
        launch executables generated via the csharp backend.

        Remove "MS_" prefixes on the variables MS_CSC and MS_ILASM, which are
        not Microsoft-specific.  More importantly, it should be less likely to
        make the mistake of adding an extra underscore to CSCFLAGS and
        ILASMFLAGS.

README.DotNet:
        Conform to variable renamings.

compiler/compile_target_code.m:
        Add new linked target types `csharp_executable', `java_launcher' and
        `erlang_launcher', instead of overloading `executable'.

        Link with `mer_std.dll' and other libraries when generating C#
        executables.  There is no `mer_rt.dll'.

        Pass "/debug" to the C# compiler if `--target-debug' is set.

        Create a shell script to launch the executable if necessary.

        Delete an unused predicate `standard_library_directory_option'.

compiler/file_names.m:
        `.cs' and `.cs_date' are grade-dependent.

compiler/handle_options.m:
        Force `.exe' as the executable file extension in csharp grades.

        Make the `erlang' grade component imply the same options as MLDS
        grades.

compiler/make.m:
        Classify executable target types based on the compilation target.

compiler/make.module_target.m:
        Handle `mmc --grade csharp --make <target>.dll'.

compiler/make.program_target.m:
        Install library DLLs in csharp grades.

        Make clean targets remove files for csharp grades.

        Conform to changes.

compiler/make.util.m:
        Add a stub foreign type.

        Conform to changes.

compiler/module_cmds.m:
        Factor out code to generate the shell scripts which launch programs
        compiled in Java, Erlang and C# grades.

compiler/options.m:
        Add `cli_interpreter' option to remember the name of the program which
        should be used to run CLI (.NET) programs.

        Add C#-related options to the help message.

compiler/options_file.m:
        Remove "MS_" prefixes on MS_ILASM_FLAGS and MS_CSC_FLAGS, and remove
        the extra underscore before "FLAGS".  In all uses of the variables,
        they were spelt without the extra underscore.

doc/user_guide.texi:
        Document options and file types related to the C# grade.

library/Mmakefile:
        Pass `mercury_dotnet.cs' to the C# compiler when building the standard
        library.  Suppress some warnings.

        Allow stubs in this directory for csharp grade.

        Conform to variable renamings.

library/builtin.m:
        Uncomment foreign language pragmas for C#.

        Handle null values in C# implementation of `deep_copy'.

library/private_builtin.m:
library/string.m:
        Compare strings by ordinals in C#, instead of culture-specific rules.
        Although the latter is allowed according to the documentation, it is
        likely to slower, and cause confusion when porting between backends.

        Handle negative index in string.set_char.

library/rtti_implementation.m:
        Uncomment foreign language pragmas for C#.

        `System.Type.GetType' only searches the current executing assembly or
        in mscorlib for a type.  As we have to be able to find types in other
        assemblies (e.g. mer_std.dll or user DLLs), explicitly search through
        a list of assemblies.

library/thread.semaphore.m:
        Uncomment foreign language pragmas for C#.

        Fix missing class qualification.

library/array.m:
library/bitmap.m:
library/bool.m:
library/dir.m:
library/exception.m:
library/io.m:
library/mutvar.m:
library/par_builtin.m:
library/region_builtin.m:
library/store.m:
library/thread.m:
library/time.m:
library/univ.m:
library/version_array.m:
        Uncomment foreign language pragmas for C#.

mdbcomp/rtti_access.m:
        Add type and procedure stubs.

runtime/mercury_dotnet.cs.in:
        Override `Equals(object)' methods in `TypeCtorInfo_Struct' and
        `TypeInfo_Struct' classes.  This requires we override `GetHashCode' as
        well.

        Handle nulls arguments to `Equals' methods as is the expected behaviour.

        Override `ToString' in `TypeCtorInfo_Struct' to produce more useful
        output during debugging.

scripts/Mercury.config.in:
        Record the configured CLI_INTERPRETER and pass that to the compiler as
        a flag.

        Conform to variable renamings.

scripts/Mmake.vars.in:
        Pass value of CSCFLAGS from Mmake through to `mmc --make'.

        Conform to variable renamings.

scripts/Mercury.config.bootstrap.in:
scripts/Mmake.rules:
        Conform to variable renaming.

scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
        Canonicalise high-level code, high-level-data, C# target code to the
        `csharp' grade.

        Handle erlang grades like other grades.

scripts/prepare_install_dir.in:
        Copy `.cs' files from the runtime directory when preparing an install
        directory.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
trace/Mmakefile:
        Do as other non-C grades in this directory.

        Conform to variable renamings.

tests/hard_coded/foreign_enum_dummy.m:
tests/hard_coded/sub-modules/non_word_mutable.m:
tests/hard_coded/sub-modules/sm_exp_bug.m:
        Make these tests work in C#.

tests/mmc_make/Mmakefile:
        Update a regular expression to account for `mmc --make' writing
        "Making rebuild.exe" on platforms where the .exe suffix is not normally
        used.

tests/mmc_make/complex_test.exp2:
        Add alternative output (minor difference in floating point precision).

tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
tests/general/structure_reuse/Mmakefile:
tests/hard_coded/Mmakefile:
tests/hard_coded/sub-modules/Mmakefile:
tests/par_conj/Mmakefile:
tests/stm/Mmakefile:
        Disable some tests in the csharp grade.

tests/invalid/Mmakefile:
        Disable some tests in the csharp grade.

        Enable a test which should work in java grades.

tests/valid/Mmakefile:
        Do as other non-C grades in this directory.

        When testing the csharp grade in this directory, produce only the C#
        target files for now.

tests/run_one_test:
        Don't compress a failing test case executable when the executable is
        actually only a shell script.
2010-09-30 07:23:36 +00:00
Zoltan Somogyi
62dda38678 Make the mdb command "dump" give you a message confirming what it did.
Estimated hours taken: 2
Branches: main

Make the mdb command "dump" give you a message confirming what it did.

trace/mercur_trace_cmd_browsing.c:
	Make the mdb command "dump" give you a message confirming what it did,
	unless the user gives the new -q or --quiet option.

doc/user_guide.texi:
	Document the new option.

scripts/mdb_grep:
scripts/mdb_open:
	Specify -q to keep old behavior.

tests/debugger/browser_test.{inp,exp,exp3}:
	Update this test case to test the dump command both with and
	without -q.
2010-09-30 04:21:18 +00:00
Peter Wang
e7a70262a6 In mgnuc, use a temporary file to hold gcc error messages before filtering with
Branches: main, 10.04

In mgnuc, use a temporary file to hold gcc error messages before filtering with
mfiltercc, instead trying to do it directly in a pipeline.

The major problem is that the exit status of mgnuc would be that of the second
command in the pipeline (mfiltercc), and not the important command (gcc).
Fixing it without using temporary files requires horrible shell code.

scripts/mgnuc.in:
        As above.  Filtering is disabled if mktemp is not detected at configure
        time.

        Note: the deleted shell command was incorrect as fd 3 was not
        redirected back to standard output, hence if gcc wrote anything to its
        standard output (it doesn't) then it would have been lost.
2010-07-12 04:57:09 +00:00
Julien Fischer
1c6b6a1c1a Avoid portability problems in the mgnuc script.
Branches: main, 10.04

Avoid portability problems in the mgnuc script.

scripts/mgnuc.in:
	When filtering the output of gcc, ensure that fd 3 is actually
	open.  (It appears to work as written with full bash, but shells
	that are closer to just POSIX sh emit errors about bad file
	descriptors.)
2010-07-09 16:02:07 +00:00
Peter Wang
6ad6d12260 Filter out warning message from gcc 4.x which are emitted when compiling
Branches: main, 10.04

Filter out warning message from gcc 4.x which are emitted when compiling
low-level C code using assembler labels, at least until a better fix is
available.

util/Mmakefile:
util/mfiltercc.c:
        Add a new program, mfiltercc.

compiler/options.m:
        Add `--filtercc-command' option (undocumented).

compiler/compile_target_code.m:
        Filter compiler output with mfiltercc if using assembler labels.

scripts/mgnuc.in:
        Filter compiler output with mfiltercc if using assembler labels, but
        only if mfiltercc can be found on the $PATH.  The bootstrap compiler
        may not have mfiltercc.

.mercury-compiler.spec.in:
Makefile:
README.MinGW:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
scripts/mercury_config.in:
        Mention mfiltercc in various places.
2010-07-09 07:10:16 +00:00
Peter Wang
4673841768 Add an option to the `mercury_config' script to make it easier to relocate a
Branches: main, 10.04

Add an option to the `mercury_config' script to make it easier to relocate a
Mercury installation.

scripts/mercury_config.in:
        Add the option `--rebase', which acts as if the user passed the options
        `--input-prefix <dir> --output-prefix <dir>', except that <dir> is
        automatically guessed from the path to the `mercury_config' script.
        (--input-prefix is undocumented)

        If `mercury_config' is run without any arguments, and the input
        directory doesn't exist, suggest the `--rebase' option as the user
        probably moved the Mercury installation already.

        Don't copy `Mercury.config.bootstrap' to the output directory.

        Copy the regenerated `mdbrc' file to the output directory.

        Set execute permissions on scripts copied to the output bin directory.
2010-07-07 04:44:23 +00:00
Julien Fischer
7087e4fbce Compile C files at -O0 in debugging grades on Mac OS X, when using mmc --make.
Branches: main, 10.04

Compile C files at -O0 in debugging grades on Mac OS X, when using mmc --make.
This works around performance problems in gcc.

compiler/compile_target_code.m:
	As above.

scripts/mgnuc.in:
	Add from the spot that implements the workaround for the mgnuc script.
2010-05-19 06:17:42 +00:00
Julien Fischer
22e112c7f4 On Mac OS X force the debug grades to be compiled by GCC at -O0.
Using -O2 (the default), results in excessive compilation times.
(There is at least one open GCC bug, #26854, concerning excessive
compilation times on Darwin - it is likely we are also bumping
into this.)

(I will update mmc --make separately.)

scripts/mgnuc.in:
 	On Darwin compile debug grades at -O0 when using GCC.
 	This avoid excessive compilation times due to performance
 	bugs in GCC.
2010-05-17 08:21:07 +00:00
Peter Wang
75acc7b514 Lift some assumptions that the only Java and Erlang grades are `java' and
Branches: main, 10.04

Lift some assumptions that the only Java and Erlang grades are `java' and
`erlang'.

Finally use `--force-disable-ssdebug' instead of `--no-ssdb' to disable the
source-to-source debugging tranformation where required.  The latter is
incorrect as it changes the grade, which disrupts the install path with `mmc
--make'.

library/Mmakefile:
scripts/Mercury.config.in:
scripts/Mmake.vars.in:
        Remove the variable `INSTALL_JAVA_LIBRARY_DIR' as it assumes only one
        Java grade is possible.

        Don't use default `--java-classpath' options to add Mercury standard
        libraries to the Java class path, for the same reason.

compiler/module_cmds.m:
        Add a predicate to return the Mercury standard libraries needed for a
        Java program as they are no longer listed in Mercury.config.

        Add the Mercury standard libraries when creating the shell script to
        launch Java programs.

compiler/compile_target_code.m:
        Add the Mercury standard libraries when calling the Java compiler.

compiler/make.program_target.m:
        Don't hard code `java' and `erlang' grades when installing library
        grade files.

browser/MDB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
ssdb/SSDB_FLAGS.in:
        Use `--force-disable-ssdebug' to disable the transform.

compiler/module_imports.m:
        Don't implicitly import the `ssdb' module if `--force-disable-ssdebug'
        is enabled.

compiler/handle_options.m:
        Reset the `source_to_source_debug' option on encountering a `--grade'
        option.
2010-05-17 01:09:22 +00:00
Julien Fischer
4360e764cd Fix a problem that prevented the erlang grade from being installed with
Branches: main, 10.04

Fix a problem that prevented the erlang grade from being installed with
the source distribution when the grades to install are specified using
configure's --enable-libgrades option.

scripts/canonical_grade.sh-subr:
	Handle the case where the target is "erlang" when constructing
	the canonicalized grade string.  (The erlang target doesn't fit
	in with the other cases, it needs to be handled separately.)
2010-05-16 15:03:04 +00:00
Julien Fischer
ccf113711a Upgrade to version 7.2alpha4 (slightly modified) of the Boehm collector. The
primary motivation for this is resolve various problems with Mac OS 10.6, such
as the parallel grades not building (bug #121).  The upgrade should also pave
the way for supporting a 64-bit version of Mercury on Mac OS 10.6.
(Unfortunately, the reg grades still do not work - bug #120.)

Reduce the number of merge conflicts we get when upgrading the collector by
(1) removing some local changes to support DLLs that were merged into the
official version of the collector sometime ago, and (2) removing our local copy
of the Makefile, and creating it from the file  Makefile.direct.  (We were
making local changes to the former, and the GC developers are now only updating
the latter - both files were out of sync with each other.)

boehm_gc/Makefile:
	Create Makefile from Makefile.direct and have the submake target
	depend upon it.  (Despite what the GC documentation says about
	Makefile.direct, if you use the direct method it has to be called
	Makefile because the object files are set to depend upon it by
	that name, i.e. using make's -f option won't work.)

scripts/prepare_install_dir.in:
tools/bootcheck:
.README.in:
bindist/bindist.README:
	Conform to the above changes.

NOTE: the slight modification referred to above is the following, backported from
the current head of the collector.  It is required for Mac OS 10.6.

--- gc_priv.h   2010-02-24 02:12:59.000000000 +1100
+++ ../../../../../gc_7_2b/ws-upgrade2/boehm_gc/include/private/gc_priv.h       2010-02-24 14:54:42.000000000 +1100
@@ -511,10 +511,7 @@
    The structure has changed its definition in different Darwin versions.
    This now defaults to the (older) names without __, thus hopefully,
    not breaking any existing Makefile.direct builds.  */
-#       if defined (HAS_PPC_THREAD_STATE___R0) \
-          || defined (HAS_PPC_THREAD_STATE64___R0) \
-          || defined (HAS_X86_THREAD_STATE32___EAX) \
-          || defined (HAS_X86_THREAD_STATE64___RAX)
+#       if __DARWIN_UNIX03
 #         define THREAD_FLD(x) __ ## x
 #       else
 #         define THREAD_FLD(x) x
@@ -2119,14 +2116,14 @@
        /* Linuxthreads itself uses SIGUSR1 and SIGUSR2.                 */
 #      define SIG_SUSPEND SIGPWR
 #    endif
-#   else  /* !GC_LINUX_THREADS */
+#   elif !defined(GC_OPENBSD_THREADS) && !defined(GC_DARWIN_THREADS)
 #     if defined(_SIGRTMIN)
 #       define SIG_SUSPEND _SIGRTMIN + 6
 #     else
 #       define SIG_SUSPEND SIGRTMIN + 6
 #     endif
 #   endif
-#  endif /* !SIG_SUSPEND */
+#  endif /* !SIG_SUSPEND */

 # endif
2010-02-24 07:04:43 +00:00
Paul Bone
df2349838f Introduce Ralph's History based Garbage Collector (HGC).
This change set creates a new value 'hgc' for the garbage collector grade
component.  This enables a new garbage collector included with the runtime
system.  Note that this garbage collector is experimental and this grade does
not work yet.

This change set represents work done by both myself and Ralph Becket.

runtime/mercury_hgc.c:
runtime/mercury_hgc.h:
    Include the new garbage collector.

runtime/mercury_expanding_array.h:
    This new header file provides a template for a type safe expanding array,
    it is used by HGC.

runtime/Mmakefile:
    Include the new modules in the runtime directory mercury_hgc.[ch] and
    mercury_expanding_array.h.

    Sort the lists of source files and header files.

compiler/globals.m:
    Include 'hgc' in the options for which garbage collector to use.

compiler/handle_options.m:
    Handle the new 'hgc' value for the garbage collector type.

compiler/options.m:
    Print out information about the new 'hgc' option in the --help text of the
    compiler.

compiler/compile_target_code.m:
    Pass the -DMR_HGC option to the C compiler for hgc grades.

compiler/add_pragma.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c.m:
compiler/peephole.m:
    Conform to changes in globals.m.

library/benchmarking.m:
    Fix a use of MR_CONSERVATIVE_GC that should have been MR_BOEHM_GC.

robdd/bryant.h:
    Include the mercury_hgc.h header file when MR_HGC is defined.

runtime/mercury_init.h:
runtime/mercury_heap.h:
    Include mercury_hgc.h when MR_HGC is defined.

runtime/mercury_memory_zones.c:
    Use mercury_hgc_add_roots_range when appropriate.

runtime/mercury_wrapper.c:
    Include initialisation code for HGC.

util/mkinit.c:
    Include a call to mercury_hgc_set_stack_bot in init files in the HGC grade.

runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr
scripts/init_grade_options.sh-subr
scripts/mgnuc.in
scripts/ml.in
scripts/parse_grade_options.sh-subr
    Add the new hgc value for the garbage collector grade component.
2010-02-11 04:36:11 +00:00
Paul Bone
83a6f14708 Create a threadscope grade component.
Threadscope grades are enabled by using the grade component 'threadscope'.
They are supported only with low-lavel C parallel grades.  Support for
threadscope in high level C grades is intended in the future but does not work
now.

runtime/mercury_conf_param.h:
    Create the MR_THREADSCOPE macro that is defined if the grade is a
    threadscope grade.

    Define MR_PROFILE_FOR_PARALLEL_EXECUTION if MR_THREADSCOPE is defined.

    Emit an error if MR_LL_PARALLEL_CONJ is defined before it is implied by
    MR_THREADSAFE and ! MR_HIGHLEVEL_CODE

runtime/mercury_grade.h
    Update the grade symbol for the threadscope grade component.

runtime/mercury_atomic_ops.c:
runtime/mercury_atomic_ops.h:
runtime/mercury_context.c:
runtime/mercury_context.h:
runtime/mercury_engine.c:
runtime/mercury_engine.h:
runtime/mercury_thread.c:
runtime/mercury_threadscope.c:
runtime/mercury_threadscope.h:
runtime/mercury_wrapper.c:
    Now that MR_PROFILE_FOR_IMPLICIT_PARALLELISM is implied by MR_THREADSAFE we
    don't need to test for MR_THREADSAFE when we test for
    MR_PROFILE_FOR_IMPLICIT_PARALLELISM.  The same is true for
    MR_LL_PARALLEL_CONJ which is implied by MR_THREADSAFE &&
    !MR_HIGHLEVEL_CODE.

    Replace some occurances of MR_PROFILE_FOR_IMPLICIT_PARALLELISM with
    MR_THREADSCOPE where the conditionally compiled code is used to support
    threadscope profiling.

scripts/init_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/mgnuc.in:
compiler/handle_options.m:
compiler/options.m:
compiler/compile_target_code.m:
configure.in:
    Add support for the new grade component.

    Pass -DMR_THREADSCOPE to the C compiler when using a threadscope grade.

    Add assertions to ensure that the 'threadscope' grade component is used
    only with the 'par' grade component.

doc/user_guide.texi:
    Added commented-out documentation for the threadscope greate component.

    Adjusted documentation of the --profile-parallel-execution runtime option
    to describe the correct prerequisite compile time options.

    Added my name to the authors list.

runtime/mercury_context.c:
    Corrected grammar and prose in comments in the MR_do_join_and_continue code.
2010-01-10 04:53:40 +00:00
Ian MacLarty
23d6d4a392 Get the java.ssdebug grade installing and compiling hello world.
Estimated hours taken: 2
Branches: main

Get the java.ssdebug grade installing and compiling hello world.
Note that currently the jars for the java.ssdebug grade are installed in the
same location as the non-ssdebug jars.  That's not a problem for now,
because the standard library currently has the ssdebug transformations
turned off when it's compiled in the ssdebug grade, so the java.ssdebug
jars are the same as the java jars.  Changing it so that the java.ssdebug
jars are installed in a different location requires getting mmc to
adjust the classpath depending on the grade, which doesn't seem worth
it at this stage.

Also note that the interface files for the ssdb, browser and mdbcomp
libraries need to be installed in the ssdebug grade otherwise mmc
complains that it cannot find files like ssdb.m when compiling
a program.  These interface files are currently only installed
when there is an ssdebug grade.

browser/MDB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
ssdb/SSDB_FLAGS.in:
    Generate .module_dep files (needed to compile ssdebug transformed
    programs).

browser/Mmakefile:
    Build and install mer_browser.jar.
    Install the interface files when in an ssdebug grade.

browser/browse.m:
    Avoid a determinism warning.

browser/cterm.m:
browser/declarative_execution.m:
browser/listing.m:
    Get this code compiling in java grades.
    The "if (1 == 1)" before throwing an exception is to avoid
    "unreachable code" errors from the Java compiler.

library/Mmakefile:
    Mention that the ssdebug jars are installed in the
    same spot as the non-ssdebug jars.

mdbcomp/Mmakefile:
    Build and install mer_mdbcomp.jar.
    Install the interface files when in an ssdebug grade.

mdbcomp/rtti_access.m:
    Get this code compiling in Java grades.

scripts/Mercury.config.in:
    Add the ssdb, mdbcomp and browser jars to the classpath.
    If they are not installed they will just be ignored.

ssdb/Mmakefile:
    Build and install mer_ssdb.jar.
    Install the interface files when in an ssdebug grade.

ssdb/ssdb.m:
    Get this code compiling in java grades.
    Flush the output buffers after displaying the prompt so that
    it's always displayed.
2009-09-14 05:58:23 +00:00
Peter Wang
921b68b595 mtags would enter an infinite loop upon seeing a type synonym on a line
Branches: main

mtags would enter an infinite loop upon seeing a type synonym on a line
terminated with a CR/LF sequence.

scripts/mtags.in:
        Replace occurrences of "[ \t]*$" with "\s*$" to allow CR as
        trailing whitespace.
2009-09-02 06:34:09 +00:00
Zoltan Somogyi
4346f276cb Fix typo.
Estimated hours taken: 0.1
Branches: main

scripts/Mmakefile:
	Fix typo.
2009-09-01 23:54:38 +00:00
Zoltan Somogyi
f3bf8ab3aa The tags file for the compiler directory is 14.8 megabytes in size,
Estimated hours taken: 0.5
Branches: main

The tags file for the compiler directory is 14.8 megabytes in size,
which is a problem for e.g. laptops with limited disk capacity. Much of this
size is accounted for by entries that do not seem useful. This diff allows
the contents of the tags file to be controlled better. With the new defaults,
compiler/tags is now a bit less than half its previous size (7.1 Mb), with no
significant loss of amenity.

scripts/mtags.in:
	Add options to mtags to control which module qualified tags it
	generates entries for. These options control this in two dimenions.

	The first dimension is whether mtags will generate tags using "__"
	as well as "." as the module qualifier. If the user specifies the
	new option --underscore-qualified-names, mtags does; by default,
	it doesn't.

	Given a fully qualified name, the second dimension controls
	which versions of it mtags generates entries for. The old behavior
	was to generate entries for the fully qualified name, for the
	unqualified name, and for all the partially qualified versions in
	between in which the missing qualifiers were a prefix of the fully
	qualified name.

	This behavior can still be obtained by specifying the new option
	--all-module-qualified-names.

	The new option --no-module-qualified-names" makes mtags not generate
	entries for any fully or partially module qualified names, generating
	entries only for the unqualified names. (With this, and no "__"
	qualified names, compiler/tags is only 4.5 Mb in size.)

	The default is to always generate entries for unqualified names, but
	generate entries for partially or fully qualified names only if they
	are 30 characters or less in length. This means that we generate
	entries for

		map.search

	but not for

		abstract_mode_constraints.allproc_annotated_constraints

	The rationales for this are that

	- short names are more likely to be ambiguous, and thus require
	  disambiguating module qualifiers at call sites or other reference
	  sites, and

	- references to long names are unlikely to be module qualified simply
	  because the qualified name is likely to lead to excessively long
	  lines.

scripts/Mmakefile:
	Fix an old annoyance: do not sprinkle garbage into the output
	when rebuilding mtags.
2009-09-01 23:45:21 +00:00
Peter Wang
ff5715c766 Pass a flag to the Java compiler to increase the maximum heap size of the
Branches: main

Pass a flag to the Java compiler to increase the maximum heap size of the
JVM.  The default size (at least with Sun Java) is too small to build the
Mercury standard library on 32-bit JVMs.  We choose a heap size of 256 MB
currently.  (There doesn't seem to be an option to just switch off the
maximum.)

As the flag may not work with non-Sun compilers, we have to check during
configuration whether it's accepted by the detected Java compiler.

aclocal.m4:
        Add a function to check if the Java compiler accepts the option
        `-J-Xmx<n>'.

        Bump Java SDK requirement to 1.5 (this was raised previously without
        updating the check).

        Update some comments.

configure.in:
        Add the configure option `--enable-javac-flags-for-heap-size',
        enabled by default.

        Check if the Java compiler accepts the maximum heap size option.

        Substitute the option in scripts.

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.vars.in:
        Add @JAVAC_FLAGS_FOR_HEAP_SIZE@ to default javac flags.
2009-08-18 05:10:40 +00:00
Peter Wang
71f2fe0c7c Make mtags skip comment and blank lines in type declarations before the
Branches: main

Make mtags skip comment and blank lines in type declarations before the
first constructor, e.g.

        :- type foo
            % Blah.

            --->    ctor.

scripts/mtags.in:
        As above.
2009-07-22 02:07:14 +00:00
Peter Wang
018614f3c6 Speed up mmake --use-mmc-make clean' and realclean' in the test
Branches: main

scripts/Mmake.rules:
        Speed up `mmake --use-mmc-make clean' and `realclean' in the test
        directories by calling `mmc --make' once for all the clean targets
        instead of individually.

tests/hard_coded/Mmakefile:
        Disable trans_intermod_user_equality test case when using mmc --make
        as it requires --transitive-intermodule-optimisation.
2009-06-17 07:25:41 +00:00
Zoltan Somogyi
478cf3d8d4 Remove the implication from .debug to .tr.
Estimated hours taken: 1
Branches: main

compiler/handle_options.m:
scripts/final_grade_options.sh-subr.m:
	Remove the implication from .debug to .tr. This implication is no
	longer appropriate, since we now have both .tr and .trseg versions
	of trailing, and .trseg is the more useful one. However, since .tr
	is still used, replacing the implication with one from .debug to
	.trseg is not appropriate either.

	Removing the implication yields an executable size reduction of 6.8%,
	and speedup of 10%.
2009-06-04 07:48:21 +00:00
Peter Wang
41bf5ef5f1 Avoid problems with overlong command lines when making mer_std.jar.
Branches: main

library/Mmakefile:
	Avoid problems with overlong command lines when making mer_std.jar.

	Call `jar i' to add indices for jar files.

scripts/prepare_install_dir.in:
	Make a copy of the java/runtime directory for the java grade.
2009-06-01 10:29:01 +00:00
Peter Wang
f2c2ced6ef Fix a case where mtags got into an infinite loop on a ugly type
Branches: main

Fix a case where mtags got into an infinite loop on a ugly type
definition, where the file was in CR/LF format.

    :- type stupid --->
                    % moron
                    idiot(useless)
                    % imbecile
                ;   retard(string, string)
                .

scripts/mtags.in:
        As above.

	Add an option `--debug' to help narrow down the problematic file in
	future.
2009-03-13 05:34:29 +00:00
Peter Ross
1232e26abf mtags wasn't handling the following
:- typeclass case(T) where [
	% comment
    func f(T) = int
].

scripts/mtags.in:
	Process the comment and blank lines as the first thing
	in the loop handling the typeclass and instance bodies.
2008-11-19 00:18:53 +00:00
Peter Ross
a0dac19621 Fix a bug that inside typeclass or instance declarations, mtags
was incorrectly detecting the body was detected on all lines
which ended with a full stop followed by optional whitespace.

This meant that comment lines such as
	% This is a comment.
were terminating the processing of the body, rather
than being ignored.

Note the following will still cause mtags to finish
processing the body prematurely.

  /*
   * This is a comment.
  */

scripts/mtags.in:
	When processing instance and typeclass declarations
	skip blank lines and comments.
2008-11-18 06:32:40 +00:00
Julien Fischer
7a02c852d3 Remember what grades the libraries were installed in.
scripts/mercury_config.in:
	Remember what grades the libraries were installed in.  Pass this
	information to configure when re-configuring.
2008-11-04 04:08:12 +00:00
Julien Fischer
56ef0245c3 Make re-configuring things a little more robust.
scripts/mercury_config.in:
	Remember the original default grade that an installation was configured with
	and use this as the "default" default grade when re-configuring.  The reason
	for doing this is that the default grade as chosen be configure when
	re-configuring may not be among those installed.  Users can still chose to
	override the "default" default by setting MERCURY_DEFAULT_GRADE.
2008-11-04 02:34:13 +00:00
Julien Fischer
84042976f5 Fix another problme with re-configuring an installation.
scripts/mercury_config.in:
	Create a dummy version of ssdb/SSDB_FLAGS.in when
	re-configuring.
2008-11-03 12:55:47 +00:00
Julien Fischer
19b73c2917 Create a dummy version of erlang_conf.hrl.in when
scripts/mercury_config.in:
	Create a dummy version of erlang_conf.hrl.in when
	re-configuring.
2008-11-03 12:34:34 +00:00
Peter Ross
ac3ae88eca Automatically determine if we should pass --restricted-command-line
Estimated hours taken: 0.5
Branches: main

Automatically determine if we should pass --restricted-command-line
to mmc.

configure.in:
	If we are using the MSVC compiler or MinGW compiler then
	we should use --restricted-command-line when building.

scripts/Mercury.config.in:
	Pass --restricted-command-line.
2008-10-08 03:26:02 +00:00
Julien Fischer
9c98a60bd5 Add a mechanism for dynamically growing the trail by adding new segments to it
Estimated hours taken: 20
Branches: main

Add a mechanism for dynamically growing the trail by adding new segments to it
in a similar fashion to what we do for the stacks with stack segments.  The
mechanism is enabled by the trseg (trail segments) grade component.  Unlike
stack segments the trail segment mechanism also works with the high-level C
backend.

The mechanism works by adding a test to MR_trail_{value,function} that checks
if we are about to run out of a trail and allocates a new trail segment if
that test succeeds.

Extend mdb's trail_details command to print the current number of trail
segments in trseg grades.

Fix a bug where the MR_trail_ptr was not being reset correctly after
a trail reset.

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
	trail segments.

runtime/mercury_memory_zones.h:
	Shift the definition MR_MemoryZones to this file in order break
	a cyclic dependency between header files.

runtime/mercury_context.h:
	Add a new field to the context structure to hold a list previous
	trail segments.

	Delete the definition of the type MR_MemoryZones from here.

runtime/mercury_trail.[ch]:
	When adding a new trail entry in trseg grades first check whether we
	need to extend the trail and do so if necessary.

	Export the definitions of MR_TRAIL_{BASE,ZONE}.

	Add a macro, MR_PREV_TRAIL_ZONES, for accessing the list of trail zones
	in a grade independent manner.

	Fix a typo in a comment.

	Add functions for creating and destroying trail segments.

	Handle trail segments in the code that handles untrailing and
	resets.  This also fixes a bug with trail reset where MR_trail_ptr
	was not being reset along with the rest of the trail state.

compiler/options.m:
compiler/handle_options.m:
compiler/compile_target_code.m:
scripts/canonical_grade.sh-subr:
scripts/init_grade_option.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Handle the new grade component.

trace/mercury_trace_cmd_developer.c:
	Make the trail_details command print out the number of trail segments
	in trseg grades.

tests/trailing/Mmakefile:
tests/trailing/tr_reset_bug.{m,exp}:
	Regression test for the bug with trail resets.
2008-09-05 11:19:34 +00:00
Peter Wang
720d7355d7 Add `--boehm-gc-free-space-divisor <n>' option for MERCURY_OPTIONS.
Branches: main

Add `--boehm-gc-free-space-divisor <n>' option for MERCURY_OPTIONS.
This sets the value of a tunable parameter in Boehm GC to trade off heap
size for collection time.

runtime/mercury_wrapper.c:
	Add the option.

doc/user_guide.texi:
	Add documentation.

scripts/mdprof.in:
	Add some sample code to enable the option when calling the deep
	profiler CGI program.
2008-07-15 07:44:20 +00:00
Julien Fischer
f46d544a51 Conform to the deletion of mercury_cleanup_install.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Conform to the deletion of mercury_cleanup_install.
2008-02-26 15:21:17 +00:00
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