diff: change default RM_C setting

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 30 03:02:15 AEDT 1998


We discussed doing this earlier, for performance reasons,
but it turns out that it is needed for correctness reasons,
not just for performance reasons.

--------------------

Estimated hours taken: 0.75

Change the default setting of RM_C so that by default Mmake
no longer removes intermediate C files.  The reason for this
fix is two-fold: to fix performance problems on Windows
and elsewhere, and to avoid some race conditions that
occur with parallel makes caused by invoking make recursively,
as is necessary if the intermediate files are removed.
(The race condition occurs where you attempt to make foo.c
and bar.c in parallel, invoking two recursive makes;
if foo.c and bar.c both depend on baz.int, then you may
attempt to make baz.int twice simultaneously, which can
have unfortunate consequences.)

configure.in:
	Set DEFAULT_RM_C to `:', and put some comments there explaining why.

scripts/Mmake.vars.in:
	Initialize RM_C to the autoconf variable DEFAULT_RM_C.

doc/reference_manual.texi:
	Update the list of bugs and limitations in the nested modules chapter:
	using parallel makes is no longer a problem.  I also added some
	other entries to the list, corresponding to outstanding bug reports.

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.139
diff -u -r1.139 configure.in
--- configure.in	1998/10/29 14:10:29	1.139
+++ configure.in	1998/10/29 15:16:18
@@ -1752,9 +1752,24 @@
 		;;
 esac
 
+#
+# This sets the default value of RM_C, which should be either `rm' to
+# remove the intermediate C files, or `:' to keep them.
+#
+# If RM_C is set to `rm', then unfortunately Mmake needs to invoke
+# make recursively, and this causes several problems:
+#	(1) it causes performance problems, particularly on MS-Windows
+#	(2) it can break parallel makes, because there are race
+#           conditions involved when you invoke make recursively
+#	    in a parallel make
+#
+# Therefore by default we currently keep the intermediate C files.
+#
+DEFAULT_RM_C=:
+
 case $EXT_FOR_PIC_OBJECTS in
 	o)
-		LIBRARY_RM_C=rm
+		LIBRARY_RM_C=$DEFAULT_RM_C
 		;;
 	*)
 		# If we're going to be building both `.pic_o' files
@@ -1776,6 +1791,7 @@
 AC_SUBST(EXT_FOR_SHARED_LIB)
 AC_SUBST(USE_DLLS)
 AC_SUBST(SHARED_LIBS)
+AC_SUBST(DEFAULT_RM_C)
 AC_SUBST(LIBRARY_RM_C)
 if test $USE_DLLS = "yes"; then
 	AC_DEFINE(USE_DLLS)
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.107
diff -u -r1.107 reference_manual.texi
--- reference_manual.texi	1998/10/28 05:41:35	1.107
+++ reference_manual.texi	1998/10/29 15:42:23
@@ -2750,12 +2750,21 @@
 
 @itemize @bullet
 @item
-if you mix an @samp{import_module} declaration for a parent module
+If you mix an @samp{import_module} declaration for a parent module
 with a @samp{use_module} declaration for the child, or vice versa,
 then the compiler may report some spurious errors.
 @item
-Using @samp{mmake} to do parallel makes (e.g. @samp{mmake --jobs 2})
-doesn't always work correctly in the case of nested sub-modules.
+The compiler sometimes reports spurious errors if you
+defining an equivalence type in a nested module and export it
+as abstract type.
+ at item
+If you enable intermodule optimization, then the compiler
+often reports spurious errors about undeclared symbols in @samp{.opt} files.
+ at item
+The Mercury build tool Mmake sometimes tries to build things in the
+wrong order and hence reports spurious errors about @samp{.int*} files
+not being found.  In these cases, simply typing @samp{mmake} again will
+usually solve the problem.
 @end itemize
 
 @node Type classes
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.22
diff -u -r1.22 Mmake.vars.in
--- Mmake.vars.in	1998/08/25 04:32:01	1.22
+++ Mmake.vars.in	1998/10/29 15:26:19
@@ -155,8 +155,10 @@
 # shared libraries.
 EXT_FOR_SHARED_LIB	= @EXT_FOR_SHARED_LIB@
 
-# Set `RM_C' to `:' if you want to keep the intermediate `.c' files.
-RM_C		= rm
+# Set `RM_C' to `:' if you want to keep the intermediate `.c' files,
+# or to `rm' if you want Mmake to remove them.  Beware that RM_C=rm
+# causes some potential race conditions if you use parallel make.
+RM_C		= @DEFAULT_RM_C@
 
 # lists of targets that depend on $(MLOBJS) and $(MLPICOBJS)
 MLOBJS_DEPS = 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list