[m-rev.] for review: fix broken source distribution

Ian MacLarty maclarty at csse.unimelb.edu.au
Mon Oct 2 16:36:57 AEST 2006


I have committed the following change to fix the source distribution in
the mean time.  I will try to find out what procedure(s) in the library
and/or mdbcomp are causing stack overflow in mtc_union in debugging
grades, and copy the appropriate modules to the slice directory.
I'll then compile the slice directory with --force-disable-tracing.
(This solution was agreed to by myself, Zoltan and Julien).

Estimated hours taken: 0.5
Branches: main

Do not use the installed mmc to compile the slice directory, because
this means you cannot install the source distribution on a machine that
doesn't already have Mercury installed.

The reason the slice directory was compiled with the installed mmc was so that
the mtc_union tool wouldn't be compiled with debugging enabled even if the
compiler was compiled with debugging.  mtc_union is used to summarise 
trace counts when coverage testing the compiler.  If mtc_union is compiled
in a debug grade then tail recursion is lost and it runs out of stack space.

If we're going to coverage test the compiler then we should use the
MERCURY_OPTIONS option that lets us customise the summary command, to choose
a version of mtc_union not compiled with debugging.

Mmakefile:
	Remove PLAIN_SUBDIR_MMAKE and instead use SUBDIR_MMAKE to compile
	the slice directory.

configure.in:
	Build SLICE_FLAGS.

slice/Mercury.options:
	Don't warn about too lax determinism declarations in mtc_diff
	(some of the option handling predicates have a multi determinism
	declaration when they're actually det, since the option handling 
	predicates require a multi predicate).

slice/Mmakefile:
	Revert 1.5 changes and add rules for mtc_diff and mcov.

slice/SLICE_FLAGS.in:
	Put back flags for slice directory.

Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.113
diff -u -r1.113 Mmakefile
--- Mmakefile	22 Sep 2006 03:50:39 -0000	1.113
+++ Mmakefile	1 Oct 2006 10:15:25 -0000
@@ -52,17 +52,6 @@
 		MMAKE_DIR=../../scripts \
 		../../scripts/mmake $(MMAKEFLAGS)
 
-# Note that we compile the slice directory using the version of mmc,
-# mmake etc that we find in $PATH. We don't want to override this mmc
-# with the one in scripts, since that one will probably refer to a
-# nonexistent executable in /usr/local/mercury-DEV. This is why actions
-# referring to the slice directory should use $(PLAIN_SUBDIR_MMAKE)
-# instead of $(SUBDIR_MMAKE).
-
-PLAIN_SUBDIR_MMAKE = unset MMAKE; unset MMAKE_VPATH; unset MMAKE_DIR; \
-		unset MERCURY_CONFIG_DIR; unset MERCURY_STDLIB_DIR; \
-		mmake $(MMAKEFLAGS)
-
 GENERATED_DOCS = README INSTALL WORK_IN_PROGRESS TODO
 
 # If you change these, you will also need to change the files indicated
@@ -139,7 +128,7 @@
 slice/$(deps_subdir)mdice.dep \
 slice/$(deps_subdir)mtc_union.dep \
 slice/$(deps_subdir)mtc_diff.dep:
-	+cd slice && $(PLAIN_SUBDIR_MMAKE) depend
+	+cd slice && $(SUBDIR_MMAKE) depend
 
 .PHONY: dep_profiler
 dep_profiler: profiler/$(deps_subdir)mercury_profile.dep
@@ -198,7 +187,7 @@
 
 .PHONY: depend_slice
 depend_slice:
-	+cd slice && $(PLAIN_SUBDIR_MMAKE) depend
+	+cd slice && $(SUBDIR_MMAKE) depend
 
 .PHONY: depend_profiler
 depend_profiler:
@@ -271,7 +260,7 @@
 
 .PHONY: slice
 slice: dep_slice
-	+cd slice && $(PLAIN_SUBDIR_MMAKE)
+	+cd slice && $(SUBDIR_MMAKE)
 
 .PHONY: profiler
 profiler: dep_profiler scripts util boehm_gc runtime library \
@@ -311,7 +300,7 @@
 
 .PHONY: tags_slice
 tags_slice:
-	+cd slice && $(PLAIN_SUBDIR_MMAKE) tags
+	+cd slice && $(SUBDIR_MMAKE) tags
 
 .PHONY: tags_profiler
 tags_profiler:
@@ -406,8 +395,8 @@
 	+cd analysis && $(SUBDIR_MMAKE) all-ints cs tags
 	+cd compiler && $(SUBDIR_MMAKE) depend
 	+cd compiler && $(SUBDIR_MMAKE) cs tags
-	+cd slice && $(PLAIN_SUBDIR_MMAKE) depend
-	+cd slice && $(PLAIN_SUBDIR_MMAKE) cs tags
+	+cd slice && $(SUBDIR_MMAKE) depend
+	+cd slice && $(SUBDIR_MMAKE) cs tags
 	+cd profiler && $(SUBDIR_MMAKE) depend
 	+cd profiler && $(SUBDIR_MMAKE) cs tags
 	+cd deep_profiler && $(SUBDIR_MMAKE) depend
@@ -555,19 +544,9 @@
 install_doc: doc
 	+cd doc && $(SUBDIR_MMAKE) install
 
-# We can't leave the install actions for the slice directory to be executed
-# directly from slice/Mmakefile, since slice/Mmakefile doesn't have access
-# to the value of $(INSTALL_MERC_BIN_DIR).
-
 .PHONY: install_slice
 install_slice: slice
-	-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
-	+cd slice &&							\
-	mmake PROGS &&							\
-	for prog in `cat PROGS` ; do					\
-		cp `vpath_find $$prog$(EXT_FOR_EXE)` 			\
-			$(INSTALL_MERC_BIN_DIR)/$$prog$(EXT_FOR_EXE);	\
-	done
+	+cd slice && $(SUBDIR_MMAKE) install
 
 .PHONY: install_profiler
 install_profiler: profiler
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.475
diff -u -r1.475 configure.in
--- configure.in	30 Sep 2006 04:04:32 -0000	1.475
+++ configure.in	2 Oct 2006 05:00:45 -0000
@@ -4364,6 +4364,7 @@
 mdbcomp/MDBCOMP_FLAGS
 browser/MDB_FLAGS
 analysis/ANALYSIS_FLAGS
+slice/SLICE_FLAGS
 profiler/PROF_FLAGS
 deep_profiler/DEEP_FLAGS
 "$test_flags"
Index: slice/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/mercury/slice/Mercury.options,v
retrieving revision 1.1
diff -u -r1.1 Mercury.options
--- slice/Mercury.options	29 Apr 2005 01:03:21 -0000	1.1
+++ slice/Mercury.options	2 Oct 2006 02:01:35 -0000
@@ -0,0 +1 @@
+MCFLAGS-mtc_diff+=--no-warn-det-decls-too-lax
Index: slice/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/slice/Mmakefile,v
retrieving revision 1.5
diff -u -r1.5 Mmakefile
--- slice/Mmakefile	22 Sep 2006 03:50:47 -0000	1.5
+++ slice/Mmakefile	2 Oct 2006 06:22:13 -0000
@@ -1,13 +1,14 @@
 #-----------------------------------------------------------------------------#
-# Copyright (C) 2005-2006 The University of Melbourne.
+# Copyright (C) 2005 The University of Melbourne. 
 # This file may only be copied under the terms of the GNU General
 # Public Licence - see the file COPYING in the Mercury distribution.
 #-----------------------------------------------------------------------------#
 
 # Mmakefile for building the Mercury slice and dice tools.
 
-GRADE = $(DEFAULT_GRADE)
-MC = mmc
+MERCURY_DIR=..
+LINK_STATIC=yes
+include $(MERCURY_DIR)/Mmake.common
 
 -include Mmake.slice.params
 
@@ -21,104 +22,128 @@
 
 MAIN_TARGET		= all
 
-# If you add more modules, you'll also have to modify ../Mmakefile.
-MERCURY_MAIN_MODULES	= mcov mslice mdice mtc_union mtc_diff
-MERCURY_MAIN_MODULES_MS	= $(mcov.ms) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) \
-				$(mtc_diff.ms)
+-# If you add more modules, you'll also have to modify ../Mmakefile.
+MERCURY_MAIN_MODULES	= mslice mdice mtc_union mcov mtc_diff
 
 DEPENDS	= $(patsubst %,%.depend,$(MERCURY_MAIN_MODULES))
 INTS	= $(patsubst %,%.ints,$(MERCURY_MAIN_MODULES))
 INT3S	= $(patsubst %,%.int3s,$(MERCURY_MAIN_MODULES))
 CHECKS	= $(patsubst %,%.check,$(MERCURY_MAIN_MODULES))
 
-#-----------------------------------------------------------------------------#
-
-MDBCOMP_DIR = ../mdbcomp
+VPATH = $(MDBCOMP_DIR) $(LIBRARY_DIR)
 
-MDBCOMP_MODULES = \
-	mdbcomp.m \
-	prim_data.m \
-	program_representation.m \
-	rtti_access.m \
-	slice_and_dice.m \
-	trace_counts.m
+#-----------------------------------------------------------------------------#
 
-MDBCOMP_ORIG_MODULES = $(patsubst %,$(MDBCOMP_DIR)/%,$(MDBCOMP_MODULES))
+MLFLAGS += --shared
+MCFLAGS += --flags SLICE_FLAGS $(CONFIG_OVERRIDE)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
-depend:	$(MDBCOMP_MODULES) $(DEPENDS)
+depend:	$(DEPENDS)
+
+$(DEPENDS): SLICE_FLAGS
 
 .PHONY: all
-all:	$(MDBCOMP_MODULES) $(MERCURY_MAIN_MODULES) tags_file_exists
+all:	$(MERCURY_MAIN_MODULES) $(TAGS_FILE_EXISTS)
 
-# We need to start by turn write permission on for each copied file
-# in case some exist, but we need to ignore errors in case some don't exist.
-# The exit 0 is to prevent make itself from printing a message about the
-# (ignored) failure of an action.
-#
-# We could modify the action here to copy only the changed files.
-
-$(MDBCOMP_MODULES): $(MDBCOMP_ORIG_MODULES)
-	- at chmod a+w $(MDBCOMP_MODULES) > /dev/null 2>&1; exit 0
-	cp $(MDBCOMP_ORIG_MODULES) .
-	@chmod a-w $(MDBCOMP_MODULES)
+#-----------------------------------------------------------------------------#
+
+# Add some additional dependencies, so that Mmake knows to remake the
+# slicer and dicer if one of the libraries changes.
 
-PROGS:
-	echo $(MERCURY_MAIN_MODULES) > PROGS
+ifeq ("$(filter il% java%,$(GRADE))","")        
+mslice: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+mslice: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+mslice: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+mdice: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+mdice: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+mdice: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+# XXX Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
+# if in .gc(.prof) grade.
+mtc_union: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+mtc_union: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+mtc_union: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+mcov: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+mcov: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+mcov: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+mtc_diff: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
+mtc_diff: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
+mtc_diff: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+endif
+
+$(cs_subdir)mslice_init.c: $(UTIL_DIR)/mkinit
+$(cs_subdir)mdice_init.c: $(UTIL_DIR)/mkinit
+$(cs_subdir)mtc_union.c: $(UTIL_DIR)/mkinit
+$(cs_subdir)mcov.c: $(UTIL_DIR)/mkinit
+$(cs_subdir)mtc_diff.c: $(UTIL_DIR)/mkinit
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: check
 check:	$(CHECKS)
 
-.PHONY: ints
+.PHONY: ints 
 ints:	$(INTS)
 
 #-----------------------------------------------------------------------------#
 
-tags:	$(MERCURY_MAIN_MODULES_MS) $(MDBCOMP_DIR)/*.m ../library/*.m
-	mtags $(MERCURY_MAIN_MODULES_MS) $(MDBCOMP_DIR)/*.m ../library/*.m
+tags:	$(MTAGS) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) $(LIBRARY_DIR)/*.m
+	$(MTAGS) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) $(mcov.ms) \
+	$(mtc_diff.ms) $($(LIBRARY_DIR)/*.m
 
 .PHONY: tags_file_exists
 tags_file_exists:
 	@if test ! -f tags; then echo making tags; \
-	mtags $(MERCURY_MAIN_MODULES_MS) $(MDBCOMP_DIR)/*.m ../library/*.m; \
+	$(MTAGS) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) \
+	$(mcov.ms) $(mtc_union.ms) $(LIBRARY_DIR)/*.m; \
 	fi
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
 dates:
-	touch $(mcov.dates) $(mslice.dates) $(mdice.dates) \
-		$(mtc_union.dates) $(mtc_diff.dates)
+	touch $(mslice.dates) $(mdice.dates) $(mtc_union.dates) \
+		$(mcov.dates) $(mtc_diff.ms)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: os cs ss ils
-os:	$(mcov.os) $(mslice.os) $(mdice.os) $(mtc_union.os) $(mtc_diff.os) \
-	$(os_subdir)mcov_init.o \
-	$(os_subdir)mslice_init.o \
-	$(os_subdir)mdice_init.o \
-	$(os_subdir)mtc_union_init.o \
-	$(os_subdir)mtc_diff_init.o
-cs:	$(mcov.cs) $(mslice.cs) $(mdice.cs) $(mtc_union.cs) $(mtc_diff.cs) \
-	$(cs_subdir)mcov_init.c \
-	$(cs_subdir)mslice_init.c \
-	$(cs_subdir)mdice_init.c \
-	$(cs_subdir)mtc_union_init.c \
-	$(cs_subdir)mtc_diff_init.c
-ss:	$(mcov.ss) $(mslice.ss) $(mdice.ss) $(mtc_union.ss) $(mtc_diff.ss)
-ils:	$(mcov.ils) $(mslice.ils) $(mdice.ils) $(mtc_union.ils) $(mtc_diff.ils)
+os:	$(mslice.os) $(mdice.os) $(mtc_union.os) \
+	$(os_subdir)mslice_init.o $(os_subdir)mdice_init.o \
+	$(os_subdir)mtc_union.o $(os_subdir)mcov.o \
+	$(os_subdir)mtc_diff.o
+cs:	$(mslice.cs) $(mdice.cs) $(mtc_union.cs) \
+	$(cs_subdir)mslice_init.c $(cs_subdir)mdice_init.c \
+	$(cs_subdir)mtc_union.c $(cs_subdir)mcov.c \
+	$(cs_subdir)mtc_diff.c
+ss:	$(mslice.ss) $(mdice.ss) $(mtc_union.ss) $(mcov.ss) $(mtc_diff.ss)
+ils:	$(mslice.ils) $(mdice.ils) $(mtc_union.ils) $(mcov.ils) $(mtc_diff.ils)
 
 #-----------------------------------------------------------------------------#
 
 realclean_local:
-	/bin/rm -fr $(MDBCOMP_MODULES) mdbcomp.*.err tags
+	rm -f tags SLICE_FLAGS SLICE_FLAGS.date
 
 #-----------------------------------------------------------------------------#
 
-# The installation targets are in the top-level Mmakefile.
+# Installation targets
+
+.PHONY: install
+install: install_slicer
+
+.PHONY: install_slicer
+install_slicer: mslice mdice mtc_union mcov mtc_diff
+	-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
+	cp `vpath_find mslice$(EXT_FOR_EXE)` \
+		$(INSTALL_MERC_BIN_DIR)/mslice$(EXT_FOR_EXE)
+	cp `vpath_find mdice$(EXT_FOR_EXE)` \
+		$(INSTALL_MERC_BIN_DIR)/mdice$(EXT_FOR_EXE)
+	cp `vpath_find mtc_union$(EXT_FOR_EXE)` \
+		$(INSTALL_MERC_BIN_DIR)/mtc_union$(EXT_FOR_EXE)
+	cp `vpath_find mcov$(EXT_FOR_EXE)` \
+		$(INSTALL_MERC_BIN_DIR)/mcov$(EXT_FOR_EXE)
+	cp `vpath_find mtc_diff$(EXT_FOR_EXE)` \
+		$(INSTALL_MERC_BIN_DIR)/mtc_diff$(EXT_FOR_EXE)
 
 #-----------------------------------------------------------------------------#
Index: slice/SLICE_FLAGS.in
===================================================================
RCS file: /home/mercury1/repository/mercury/slice/SLICE_FLAGS.in,v
retrieving revision 1.3
diff -u -r1.3 SLICE_FLAGS.in
--- slice/SLICE_FLAGS.in	22 Sep 2006 03:50:47 -0000	1.3
+++ slice/SLICE_FLAGS.in	2 Oct 2006 01:10:48 -0000
@@ -0,0 +1,19 @@
+ at BOOTSTRAP_MC_ARGS@
+--no-infer-all
+--halt-at-warn
+--no-warn-inferred-erroneous
+--no-mercury-stdlib-dir
+-I../library
+-I../browser
+-I../mdbcomp
+--c-include-directory ../boehm_gc
+--c-include-directory ../boehm_gc/include
+--c-include-directory ../runtime
+--c-include-directory ../library
+--c-include-directory ../library/Mercury/mihs
+--c-include-directory ../mdbcomp
+--c-include-directory ../mdbcomp/Mercury/mihs
+--c-include-directory ../browser
+--c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../trace
+--config-file ../scripts/Mercury.config.bootstrap
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list