Commit Graph

958 Commits

Author SHA1 Message Date
Julien Fischer
c10c96661a Drop support for Mercury on IRIX.
IRIX itself is more or less dead and the Mercury support for it has not been
tested for many years.

configure.ac:
compiler/notes/overall_design.m:
doc/user_guide.texi:
scripts/mgnuc.in:
	As above.

NEWS:
	Announce the above.
2014-06-16 13:44:12 +10:00
Julien Fischer
7fbfd779bf Re-enable executable stripping on Mac OS X.
configure.ac:
	Pass -x to strip when linking an executable against Mercury shared
	libraries on Mac OS X.

	Make the up-to-date check require {14.01.-beta,rotd}-2014-05-05
        or later.

scripts/Mercury.config.in:
	Set the default values of --strip-executable-{shared,static}-flags.
2014-05-19 14:52:30 +10:00
Julien Fischer
2d6e04826b Fix a build error on MinGW systems.
Some versions of the MinGW system headers rely on the types off_t and off64_t
being defined, but they will not be defined if -ansi is enabled.
(This seems to affect MinGW systems using GCC 4.8; I haven't checked other
GCC versions yet.)

configure.ac:
scripts/mgnuc.in:
	Do not compile with -ansi on MinGW systems.
2014-05-01 12:31:02 +10:00
Julien Fischer
e7d8bc7185 Fix up inlining macros for clang.
Currently we use the C89 definitions of MR_STATIC_INLINE and friends with
clang, which is less than ideal in a couple of ways, firstly we might not get
as much inlining as we would like and secondly, for clang, it causes large
numbers of warnings about unused functions to be generated.

Using GNU C style inlining does not work because we enable the -ansi option
when using clang and the (current) behaviour of the -ansi option with clang is
to enforce strict C89 conformance (i.e. disable any GNU C extensions.).

This change avoids all of the above by (1) adding C99 style definitions of
MR_STATIC_INLINE etc for clang and (2) not passing -ansi to clang (i.e. putting
clang into c99, or technically gnu99, mode).  We fall back on the C89 style
definitions if the user does something odd like setting -ansi or -std=c89
themselves.

runtime/mercury_std.h:
	Define MR_STATIC_INLINE and friends for clang in the case where clang
	is in C99 (or equivalent) mode.

configure.ac:
	Set CFLAGS_FOR_ANSI for clang to empty.  Add an explanation of why
	we do this.

scripts/mgnuc.in:
	Don't pass -ansi to clang.
2014-03-25 15:03:13 +11:00
Peter Wang
d49774734b Strip executable as a separate step on Mac OS X.
We had stopped passing the linker strip flag on Mac OS X because it had
become deprecated and useless there, but we can still strip the binary
with the `strip' tool.

This commit changes compile_target_code.m to do so, but NOT the
`ml' shell script.

compiler/options.m:
doc/user_guide.texi:
	Add option --strip-executable-command.

configure.ac:
scripts/Mercury.config.in:
	Set --strip-executable-command="strip" on Darwin platforms,
	or an empty string elsewhere.

compiler/compile_target_code.m:
	Invoke the --strip-executable-command separately after linking
	an executable if necessary.

scripts/ml.in:
	Fix a bug: use configured value of LD_STRIP_FLAG instead of
	assuming "-s".
2014-03-20 13:45:26 +11:00
Julien Fischer
9fedf3804e Fix a compilation problem with MSVC.
scripts/mgnuc.in:
	C_COMPILER_TYPE still uses the cl_* style names, so we still need
	to match against that rather than msvc_*.
2014-02-17 13:45:33 +11:00
Julien Fischer
18cbe2f9b6 Avoid C compiler warnings on OS X with Xcode 5.
In the mgnuc script, do not use the name of the C compiler to determine its
type since on OS X with Xcode 5 the executable "gcc" is actually clang.
Instead use the value of C_COMPILER_TYPE determined by the configure script to
set C compiler type, as elsewhere in the Mercury system.

Incorrectly identifying the C compiler type was resulting in lots of
compilation warnings because we were using the warning flags intended for GCC
with clang.  Further warnings were being generated because GCC-only
optimization flags would also be passed to clang.

scripts/mgnuc.in:
	As above.
2014-02-03 12:32:18 +11:00
Julien Fischer
cb28daa00a Make Mercury compile with Visual Studio 2013 (MSVC 12.0).
Fix some problems that were preventing the system from compiling properly with
MSVC.

(1) Visual Studio 2013 no longer includes the files NtWin32.Mak and Win32.Mak
which are required for building the Boehm GC with MSVC.  (This appears to be an
issue with upstream Boehm as well.)  The workaround here is to reference the
copies of this files included with the Windows 7 SDK.  (This appears to be the
official Microsoft workaround for dealing with this problem for now.)

(2) Disable support for `--c-debug' when using MSVC.  Using this option causes
MSVC to emit .pdb (Program Data Base), that contain the symbol information for
an object files.  This causes a variety of problems:

   (i) parallel builds are contending for the vc*.pdb file shared by all the
   object files in a directory causing compilation to abort.  (Compiling with
   the -FS option is another solution to this -- it causes the compiler to
   serialize access to the .pdb file -- but at the cost of slowing down
   compilation.)

   (ii) .pdb files are not cleaned up by realclean; compilation will abort
   if a pdb file generated by a different version of MSVC is encountered.

   (iii) we don't install the .pdb files alongside the libraries anyway.
   This can be a source of linker warnings.  (And shutting up the Microsoft
   linker seems to be very difficult indeed ...)

   (iv) compiling with -Zi (apparently) inhibits some C compiler optimizations.

Compiling with the older -Z7 (MSVC 7 style debugging info) option is another
alternative.  Using that option causes MSVC to include symbol information in
the object files, instead of in a separate file.

For now (i.e. the 14.01 release), disabling `--c-debug' for MSVC is the
simplest way of addressing the above issues.

README.MS-VisualC:
	Describe the problem with NtWin32.Mak and Visual Studio 2013 and
	provide two possible workarounds.

	Mention that `--c-debug' is not currently supported with MSVC and how
	to re-enable it.

	Simplify some of the instructions for setting up the build environment.

configure.ac:
scripts/mgnuc.in:
	Disable `--c-debug' with MSVC.

scripts/prepare_install_dir.in:
	Copy all makefile fragments for nmake into the boehm_gc directory for
	the library grade installation.  (This is in case the user copies
	NtWin32.Mak etc into the boehm_gc directory as per the second of
	the workarounds in README.MS-VisualC.)

slice/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
	Clean up any .pdb files.  Note that one is generated for each
	executable (regardless of whether -Zi is given to cl or not).
 	In addition, if -Zi is given to cl, there will be file named
	vc<version>.pdb generated (where <version> is the version of MSVC being
	used.)
2014-01-28 16:06:20 +11:00
Julien Fischer
2117a37acf Workaround bug #307.
We encounter internal errors in GCC 4.8.2 on i686 Linux when compiling
runtime/mercury_ho_call.c in grades that use global registers when -fpic is
enabled.  Compile that module at -O0 in the above circumstances; doing so
avoids tickling the bug.

scripts/mgnuc.in:
	As above.
2014-01-10 15:56:26 +11:00
Julien Fischer
8d40c7f020 Allow the target architecture to be set in the environment.
scripts/Mercury.config.in:
scripts/Mercury.config.boostrap.in:
	Add the environment variable MERCURY_TARGET_ARCH, which allows
	the compiler's target architecture to be overridden in the
	environment.

compiler/options.m:
	Add the option --target-arch as a synonym (and eventually, replacement)
	for the --fullarch option.
2013-10-21 02:16:21 +11:00
Paul Bone
95a089b5b3 Add more patterns to .gitignore files
A number of patterns and filenames where missing from .gitignore files,
especially in the tests/ directory.

.gitignore:
boehm_gc/.gitignore:
boehm_gc/libatomic_ops/pkgconfig/.gitignore:
runtime/.gitignore:
scripts/.gitignore:
tests/.gitignore:
tests/analysis/table/.gitignore:
tests/analysis/trail/.gitignore:
tests/benchmarks/.gitignore:
tests/debugger/.gitignore:
tests/invalid/.gitignore:
tests/mmc_make/.gitignore:
tests/mmc_make/lib/.gitignore:
    Add new patterns to .gitignore files.

    Remove some patterns that are implicit because they're in a parent
    directory's file.

tests/analysis/.gitignore:
    After removing superfluous patterns this file was empty.  I've deleted
    it.
2013-10-02 20:54:06 +10:00
Julien Fischer
ab20c86f15 Enable library grade detection by default.
Use -R instead of -r with cp by default.

Fix some documentation errors.

compiler/options.m:
	Enable library grade detection by default.

	Document the --no-detect-libgrades option.

	Make the default install command dir option, -R,
	rather than -r.  The former is more portable.

scripts/Mercury.config.in:
	Do not hardcode the set of library grades at configuration time.

compiler/mercury_compile.m:
	Do not clear the library grade set before adding any detected
	grades since doing so also prevents additional grades being
	specified via the LIBGRADES variable.

doc/user_guide.texi:
	Document --no-detect-libgrades.

	Replace some uses of `:' as a module qualifier.

	Fix a typo: s/outut/output/.
2013-09-07 03:13:40 +10:00
Peter Wang
12c36496c1 Fix test for mfiltercc on Solaris.
On Solaris, the 'which' utility does not return a non-zero exit status
to indicate that the program (in this case, "mfiltercc") was not found,
so we ended up treating its error message output as a path.

scripts/mgnuc.in:
	Don't use 'which'.  Simply try to run any copy of mfiltercc on
	the PATH, with empty input.
2013-05-28 12:43:23 +10:00
Julien Fischer
3d2b8d72a2 Clean up a file created by the bootcheck script.
scripts/Mmakefile:
     During a realclean delete the file test_mdbrc if
     it is present.
2013-03-26 14:24:44 +11:00
Peter Wang
ad4b79e6ee Add a `pregen' grade component.
Add a `pregen' grade component and associated option `--pregenerated-dist',
intended for use in the pre-generated C files in the source distribution
ONLY.

Traditionally, by forcing the use of 2 tag bits and boxed floats, we
could provide one set of pre-generated C files, nominally targeting
32-bit platforms but also working on 64-bit platforms.
This became insufficient after I made two data representation changes.
The same constructor may have different layouts of its arguments
for --bits-per-word=32 and --bits-per-word=64:

  - double-precision `float' arguments can be stored across two
    words on 32-bit, whereas only one word is required on 64-bit;

  - consecutive enum arguments can be packed into a single word
    but the number of arguments that can be packed differs.

As a result, data structures created in a user module could be
misinterpreted when passed to a pre-generated standard library module,
and vice versa.  (The enum case probably does not occur in practice.)

The solution adopted here is to allow configure to detect normal 64-bit
settings (3 tag bits, unboxed floats) irrespective of whether a usable
Mercury installation already exists.  When present, the `pregen' grade
component causes the compiler and scripts to override the configuration
and enforce settings for portable C source files.  The source
distribution should supply C source files from a `pregen' grade.

During installation, if required, the pre-generated C source files are
used to build and install a Mercury compiler _in a .pregen grade_.
Then it is used to install the libraries _in non-.pregen grades_,
so that configured settings have their usual effect.

Another benefit is that a user on a 64-bit system will get the "optimal"
installation using 3 tag bits and unboxed floats without additional
effort.

A small disadvantage is that a minimal installation of Mercury takes
slightly longer, as the default library grade no longer comes from the
pre-generated C source files.

compiler/options.m:
	Add `--pregenerated-dist' option (same as `pregen' grade component).

	Add `--arg-pack-bits <n>' internal option.
	`--allow-argument-packing' is obsolete.

	Add `--allow-double-word-fields' internal option.

compiler/handle_options.m:
	Add `pregen' grade component.  `pregen' implies boxed floats and
	`spf' (single-prec float) implies unboxed floats, so we consider
	them incompatible.  There should be no need to use both at once.

	In `pregen' grades, override settings to create portable C
	source files.

	Handle the internal `--arg-pack-bits <n>' option.

compiler/make_hlds_passes.m:
	Pack only as many consecutive arguments as will fit into the
	number of bits specified by `--arg-pack-bits', rather than into
	the number of word bits.  `pregen' implies --arg-pack-bits=32

	Use `--allow-double-word-fields' to decide whether to store
	floats across two words.  `pregen' disables it.

compiler/compile_target_code.m:
	Define MR_PREGENERATED_DIST when compiling C files in a `pregen'
	grade.

compiler/c_util.m:
	Write PREGENERATED_DIST={yes,no} into the grade info header at
	the top of C files.  This is checked by configure.

runtime/mercury_conf_param.h:
	Make MR_PREGENERATED_DIST force the same settings as the
	`--pregenerated-dist' option.

runtime/mercury_grade.h:
	Add "_pregen" to the MR_GRADE macro so that `pregen' and
	non-`pregen' object files are not accidentally mixed.

configure.ac:
	As above, do NOT force 2 tag bits and unboxed floats when there
	is no usable Mercury compiler installed.

	BOOTSTRAP_GRADE is now a grade containing `.pregen'.

	Make a minimal installation install $BEST_GRADE_FOR_COMPILER as
	the default grade, not the grade that the compiler happens to be
	built in, which might be a `pregen' grade.

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Support `pregen' grade component and `--pregenerated-dist'
	in shell scripts.

tools/test_mercury:
	Add a note.
2013-03-18 15:44:16 +11:00
Julien Fischer
fa33b08005 Delete residual support for the GCC backend.
scripts/Mmake.vars.in:
scripts/final_grade_option.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mmake.in:
scripts/parse_grade_options.sh-subr:
	As above.
2013-02-20 16:09:09 +11:00
Julien Fischer
f6bdd99a80 Delete the MLDS->GCC (assembler) backend.
As discussed in the recent Mercury meeting, remove support for the GCC backend.
It was very much out of date and supporting it proprerly would means having to
track changes to GCC's internals.  Furthermore, its presence complicates
building the compiler.

The main thing this change does not address is the fact that we invoke
the compiler through C code, e.g. main.c in the top-level of the source
tree.  This was required by the GCC backend and can now be removed, but
I will do that as a separate change.

configure.ac:
Mmake.common.in:
scripts/Mmake.rules:
compiler/Mercury.options:
compiler/Mmakefile:

compiler/gcc.m:
compiler/maybe_mlds_to_gcc.pp:
compiler/mlds_to_gcc.m:
    Delete the files containing the GCC backend.

compiler/options.m:
compiler/handle_options.m:
    Delete support for `--target asm' and `--pic'.
    (The latter was only used by the GCC backend.)

compiler/*.m:
doc/user_guide.texi:
compiler/notes/comiler_design.html:
compiler/notes/work_in_progress.m:
    Conform to the above change.

README.gcc-backend.m:
    Delete this file.
2013-01-16 15:31:10 +11:00
Julien Fischer
7c12f72702 Rename configure.in to configure.ac.
configure.in:
    Rename this to configure.ac which is what current versions
    of autotools expect and also doesn't cause warnings to be
    emitted by aclocal.

Mmakefile:
scripts/ml.in:
    Conform to the above change.
2013-01-03 13:12:22 +11:00
Julien Fischer
c952f53d96 Delete more dead files resurrected by cvs2git.
scripts/mc.sh:
scripts/mcn.sh:
scripts/mcs.sh:
scripts/mercury_update_interface.sh:
scripts/mgnuc.sh:
scripts/mint.sh:
scripts/mnc.sh:
scripts/mnl.sh:
scripts/mnp.sh:
scripts/mod2init.in:
scripts/mod2init.sh:
scripts/msc.sh:
scripts/msl.sh:
scripts/msp.sh:
scripts/sicstus_conv.sh:
     As above.
2013-01-03 13:12:22 +11:00
Julien Fischer
1eda59e3da Convert .cvsignore files into .gitignore files.
Delete the empty lazy_evaluation directory from extras.

*/.cvsignore:
     Make this into .gitignore files.
     (Update them where necessary.)

extra/lazy_evalution:
    Delete this directory; its former contents were moved
    elsewhere some time ago.
2013-01-03 13:12:22 +11:00
Peter Ross
e73b87e77e Sign the all the assemblies in the csharp grade.
Estimated hours taken: 2
Branches: main, 12.08

Sign the all the assemblies in the csharp grade.

mercury.snk:
	The strong name key used for signing.

analysis/ANALYSIS_FLAGS.in:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
	Pass the signing key to the c# compiler.

scripts/prepare_install_dir.in:
	Copy mercury.snk to the install dir.
2012-11-22 20:35:29 +00:00
Peter Ross
8fc6db856c Upgrade to version 7.2 of the boehm gc.
Estimated hours taken: 4
Branches: main

Upgrade to version 7.2 of the boehm gc.

This upgrade was done as 7.2 alpha 4 doesn't compile cleanly under Solaris 10.
2012-07-18 09:02:34 +00:00
Julien Fischer
1afc2b037e Fix further problems with building the csharp grade on Cygwin using the
Branches: main, 11.07

Fix further problems with building the csharp grade on Cygwin using the
Microsoft compiler.  There were two main problems:

(1) Mercury.config.bootstrap had not been updated so the environment
and csharp compiler types for the stage 1 compiler were incorrect.

(2) The '/' in Microsoft style /OPTIONS was sometimes being treated
as a path separator for the purposes of path conversion.

scripts/Mercury.config.bootstrap.in:
 	Bring this file back into sync with Mercury.config.

compiler/compile_target_code.m:
 	Use - style options with the csharp compiler rather than / style
 	ones.
 	(In addition to causing the above problem, the use of / also tends
 	to cause trouble with POSIX style shells in general - we already avoid
 	the use of / style options with MSVC for the same reason.)

 	Break some overlong lines.

compiler/handle_options.m:
 	Break an overlong line.
2012-02-10 03:59:15 +00:00
Julien Fischer
668aaf1bf0 Set the host and target environment types at configuration time.
Branches: main, 11.07

Set the host and target environment types at configuration time.  By default,
they were both set to "posix" but that is no longer compatible with building
the csharp grade using the Microsoft compiler.

configure.in:
	Set the environment type to "cygwin" on Cygwin, to "msys" on MinGW
	and to "posix" otherwise.  (For Mercury installations that work with
	the Windows command interpreter, it will need to be manually set to
	"windows".)

scripts/Mercury.config.in:
	Set the environment type.  (We set the target and host separately
	so that is easier for installers to automatically modify this file.)

README.MS-VisualC:
	Conform to the above change.
2012-01-24 05:59:12 +00:00
Peter Ross
c3d13006aa The Microsoft C# compiler only accepts paths in the Windows format, so
Estimated hours taken: 4
Branches: main, 11.07

The Microsoft C# compiler only accepts paths in the Windows format, so
add code to format file names depending on which host environment we are
compiling and which C# compiler we are using.

compiler/compile_target_code.m:
	Convert to file names to use windows paths when required.

compiler/globals.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/options.m:
doc/user_guide.texi:
m4/mercury.m4:
scripts/Mercury.config.in:
	Add code to determine the C# compiler type and pass it to the compiler.

library/Mmakefile:
	We no longer need to detect if we are using csc as the compiler
	will fix the posix path as part of mmc --make.
2012-01-15 23:38:21 +00:00
Julien Fischer
0e095a1aab Don't make the choice of whether MR_THREAD_SAFE is defined in parallel grades
Branches: main

Don't make the choice of whether MR_THREAD_SAFE is defined in parallel grades
in the configure script.  There's no reason to do so and handling it
differently from the other grade component macros is just confusing.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	If we are in a parallel grade then define MR_THREAD_SAFE.

configure.in:
	Don't include -DMR_THREAD_SAFE in the value of CFLAGS_FOR_THREADS.
2012-01-15 17:33:35 +00:00
Ian MacLarty
9519687447 Add a new GC grade for the .ll_debug Mercury grade.
Branches: main, 11.07

Add a new GC grade for the .ll_debug Mercury grade.

Previously the .ll_debug grade used the usual "gc" GC grade.  This was a
problem, because it meant that installing a .ll_debug grade would overwrite the
libgc library with the unoptimised .ll_debug version, resulting in a severe
performance loss for applications even if they weren't built in the .ll_debug
grade.

compiler/compile_target_code.m:
   Link against the ll_debug GC library if low-level debugging
   is enabled.

scripts/ml.in:
   Use the new ll_debug GC grade for the .ll_debug Mercury
   grades.
2011-12-07 09:17:41 +00:00
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