Commit Graph

931 Commits

Author SHA1 Message Date
Julien Fischer
481f32eb75 Ingore generated batch files.
Branches: main, 11.07

scripts/.cvsignore:
	Ingore generated batch files.
2011-11-08 03:12:33 +00:00
Julien Fischer
03d0ca4712 Improve and update documentation of the MSVC port.
Branches: 11.07, main

Improve and update documentation of the MSVC port.

Add batch files for invoking mdb and mprof; avoid problem with mercury.bat.

README.MS-VisualC:
	Rewrite this file, it was very much out-of-date.
	The major changes are:

	+ we now describe how to set up a Cygwin or MSYS shell
  	  with MSVC available.

	+ the source distribution now works with MSVC.

	+ a list of the limitations of the MSVC port has been added.

	+ a description of how to set up the compiler so that it
	  works from the Windows command prompt has been added.

scripts/mercury/mercury.bat.in:
	Delete support for the MERCURY_COMPILER and MERCURY_CONFIG_DIR
	enviorment variables; the handling of them in this batch file
	doesn't appear to be portable across different versions of
	Windows and it's more important that this file work in the
	normal case.  (Keeping it simple is the way to ensure this.)

scripts/mdb.bat.in:
scripts/mprof.bat.in:
	Templates for invoking mdb and mprof on Windows.
	(I'm not sure how to reproduce all the functionality of the mdb
	script in a batch file, so the command line options provided by
	the mdb script aren't currently replicated here.)

configure.in:
scripts/Mmakefile:
	Add the new batch files.

scripts/Mercury.config.in:
	Use the Windows-style installation prefix on Cygwin systems.

browser/util.m:
	Use the conventional name for the I/O state.

	Use don't-care variables for the I/O state in foreign procs.
	This avoids suprious warnings from MSVC.
2011-11-08 03:11:42 +00:00
Paul Bone
bc92fb14b1 Fix three hwloc related build system problems, these were raised in code
reviews.

The configure script now supports the --without-hwloc option to disable the use
of hwloc, even if it is installed.

configure.in:
    Allow the use of libhwloc to be disabled with the --without-hwloc option.

Distribute the autoconf macros for pkg-config with Mercury.

This allows mercury to be compiled from CVS on hosts that don't have these
macros in their autoconf installation.

acinclude.m4:
m4/mercury.m4:
    Moved acinclude.m4 to m4/mercury.m4.  This file contains mercury-specific
    macros.

m4/pkg.m4:
    Copied pkg.m4 from the autoconf installation on taura.  This file contains
    pkg-config macros.

INSTALL_CVS:
Mmakefile:
tools/test_mercury:
    When calling aclocal pass the -I m4 option.

tools/bootcheck:
    Create a link to the m4 directory when setting up stage directories.

Fix static linking with mmc --make and hwloc.

compiler/compile_target_code.m:
    Conform to changes in scripts/ml.in (where static linking and hwloc is
    already handled correctly).

compiler/options.m:
    Create new options so that Mercury.config can tell mmc what options are
    needed for linking to hwloc.

scripts/Mercury.config:
    Pass hwloc linking options to the compiler.
2011-11-08 02:22:42 +00:00
Julien Fischer
4e0c95036c Use "msvc" rather than "cl" to identify MSVC.
Branches: 11.07, main

scripts/ml.in:
	Use "msvc" rather than "cl" to identify MSVC.  (The latter is
	to easy to mistake for clang.)

	When invoking the linker through MSVC, also invoke it with the
	-nologo option.
2011-10-26 05:50:19 +00:00
Paul Bone
6fa900072c Make sure hwloc works with static linking.
configure.in:
scripts/ml.in:
    Determine and use the static linking options for hwloc when ml is invoked
    with --static.

    More robust detection of when to use the hwloc linking options is now used.
2011-10-14 00:25:06 +00:00
Paul Bone
a071eaba53 Improve thread pinning:
+ Now pins threads intelligently on SMT systems by balancing threads among
      cores.
    + performs fewer migrations when pinning threads (If a thread's current
      CPU is a valid CPU for pinning, then it is not migrated).
    + Handle cases where the user requests more threads than available CPUs.
    + Handle cases where the process is restricted to a subset of CPUs by its
      environment.  (for instance, Linux cpuset(7))

This is largely made possible by the hwloc library
http://www.open-mpi.org/projects/hwloc/  However, hwloc is not required and the
runtime system will fall back to sched_setaffinity(), it will simply be less
intelligent WRT SMT.

runtime/mercury_context.h:
runtime/mercury_context.c:
    Do thread pinning either via hwloc or sched_setaffinity.  Previously only
    sched_setaffinity was used.

    Update thread-pinning algorithm, this:

    Include the general thread pinning code only if MR_HAVE_THREAD_PINNING is
    defined.

    Use a combination of sysconf and sched_getaffinity to detect the number of
    processors when hwloc isn't available.  This makes the runtime compatible
    with Linux cpuset(7) when hwloc isn't available.

configure.in:
Mmake.common.in:
    Detect presence of the hwloc library.

configure.in:
    Detect sched_getaffinity()

aclocal.m4:
acinclude.m4:
    Move aclocal.m4 to acinclude.m4, the aclocal program will build aclocal.m4
    and retrieve macros from the system and the contents of acinclude.m4.

Mmakefile:
    Create a make target for aclocal.m4.

runtime/Mmakefile:
    Link the runtime with libhwloc in low-level C parallel grades.

    Include CFLAGS for libhwloc.

scripts/ml.in:
    Link programs and libraries with libhwloc in low-level C parallel grades.

runtime/mercury_conf.h.in:
    Define MR_HAVE_HWLOC when it is available.

    Define MR_HAVE_SCHED_GETAFFINITY when it is available.

runtime/mercury_conf_param.h:
    Define MR_HAVE_THREAD_PINNING if either hwloc or [sched_setaffinity and
    sched_getaffinity] are available.

runtime/mercury_thread.c:
runtime/mercury_wrapper.c:
    Only call MR_pin_thread and MR_pin_primordial_thread if
    MR_HAVE_THREAD_PINNING is defined.

runtime/mercury_thread.h:
runtime/mercury_context.h:
    Move the declaration of MR_pin_primordial_thread to mercury_context.h from
    mercury_thead.h since it's definition is in mercury_context.c.

    Require MR_HAVE_THREAD_PINNING for the declaration of
    MR_pin_primordial_thread.

runtime/mercury_wrapper.c:
    Conform to changes in mercury_context.h

INSTALL_CVS:
tools/test_mercury
    Run aclocal at the right times while testing Mercury.
2011-10-13 02:42:21 +00:00
Julien Fischer
320b83ba33 Suppress the MSVC banner message, e.g. pass -nologo to cl, by default.
Branches: main, 11.07

Suppress the MSVC banner message, e.g. pass -nologo to cl, by default.

configure.in:
	Do the above for mmc --make.

scripts/mgnuc.in:
	Do the above for mmake.

	Fix a couple of typos.
2011-10-11 13:48:39 +00:00
Julien Fischer
9ef0e79bd6 Delete the long unused RM_C variable; the compiler hasn't
Branches: main, 11.07

scripts/Mmake.vars.in:
	Delete the long unused RM_C variable; the compiler hasn't
	generated references to it since 2001.
2011-10-11 12:53:22 +00:00
Julien Fischer
8801541dba Fix a problem with ll_debug grades and MSVC.
Branches: main, 11.07

Fix a problem with ll_debug grades and MSVC.

scripts/mgnuc.in:
	Avoid using -O0 wit MSVC: the corresponding option is
	-Od.
2011-10-04 04:49:59 +00:00
Julien Fischer
6a4c211a9d Don't use -o when creating executables with MSVC.
Branches: main, 11.07

Don't use -o when creating executables with MSVC.  (For some silly
reason its been deprecated and we have to use -Fe instead.)
Note that mmc --make already uses -Fe with MSVC, this change only
affects mmake.

configure.in:
scripts/Mmake.vars.in:
	Define a new variable, EXEFILE_OPT, whose variable gives the option
	used to name executables.

compiler/write_deps_file.m:
	Use the above variable instead of hardcoding the option to be
	"-o".
2011-10-04 02:37:57 +00:00
Julien Fischer
d032aaafcc Fix another problem with --with-mscvrt.
Branches: main, 11.07

Fix another problem with --with-mscvrt.

scripts/ml.in:
	The single-threaded version of the Microsoft C library is
	no longer available.   Only the multi-threaded one is used by
	Visual Studio 2005 onwards.

scripts/parse_ml_options.sh-subr.in:
	Update a comment regarding gcc's -s option on Mac OS X.
2011-10-03 16:09:13 +00:00
Julien Fischer
d00a6f4f46 Allow --with-msvcrt to work on MinGW.
Branches: main, 11.07

scripts/mgnuc.in:
	Allow --with-msvcrt to work on MinGW.
2011-10-03 13:40:17 +00:00
Julien Fischer
bd867e5b58 Only force -O0 for old versions of clang; more recent versions do not encounter
Branches: main, 11.07

Only force -O0 for old versions of clang; more recent versions do not encounter
problems when compiling Mercury generated C code.

configure.in:
scripts/mgnuc.in:
	As above.

README.clang:
	Conform to the above change.
2011-10-03 05:07:21 +00:00
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