[m-rev.] for review: make deep profiling bootstrap again

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Feb 5 13:46:30 AEDT 2002


I'd like Fergus to look at the diff to det_analysis.m and Simon to look at the
diff to the recompilation tests.

We should also arrange for the .profdeep, .mm etc grades to be bootchecked
regularly, but that is a different change.

Zoltan.

Allow the deep profiling grade to bootstrap again.

compiler/deep_profiling.m:
	Fix an omission from a nonlocals set.

	Mark transformed some() goals that act as cuts as being non-removable.
	Without this, determinism analysis (reinvoked by simplify after the
	deep profiling transformation) could remove some()s from around
	nondet goals with no output arguments that have been made impure
	by the insertion of impure code into them by the deep profiling
	transformation.

compiler/det_analysis.m:
	Respect the non-removable markers placed by deep_profiling.m.

tests/general/Mmakefile:
	In deep profiling grades, disable a test case that requires catching
	exceptions, which we can't do (yet) in those grades.

tests/recompilation/Mmakefile:
tests/recompilation/runtests:
	In deep profiling grades, disable all test cases in this directory,
	since the compiler's handling of recompilation requires catching
	exceptions.

cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/deep_profiling.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deep_profiling.m,v
retrieving revision 1.5
diff -u -b -r1.5 deep_profiling.m
--- compiler/deep_profiling.m	18 Jul 2001 07:52:23 -0000	1.5
+++ compiler/deep_profiling.m	4 Feb 2002 22:59:11 -0000
@@ -696,7 +696,7 @@
 		generate_call(ModuleInfo, "semi_fail_port_code_sr", 3,
 			[TopCSD, MiddleCSD, ActivationPtr1], no, failure,
 			FailPortCode),
-		NewNonlocals = list_to_set([MiddleCSD, ActivationPtr1])
+		NewNonlocals = list_to_set([TopCSD, MiddleCSD, ActivationPtr1])
 	;
 		MaybeActivationPtr = no,
 		generate_call(ModuleInfo, "semi_call_port_code_ac", 3,
@@ -706,7 +706,7 @@
 			[TopCSD, MiddleCSD], [], ExitPortCode),
 		generate_call(ModuleInfo, "semi_fail_port_code_ac", 2,
 			[TopCSD, MiddleCSD], no, failure, FailPortCode),
-		NewNonlocals = list_to_set([MiddleCSD])
+		NewNonlocals = list_to_set([TopCSD, MiddleCSD])
 	),
 
 	ExitConjGoalInfo = goal_info_add_nonlocals_make_impure(GoalInfo0,
@@ -951,14 +951,21 @@
 	transform_goal([neg | Path], Goal0, Goal, AddedImpurity),
 	{ add_impurity_if_needed(AddedImpurity, Info0, Info) }.
 
-transform_goal(Path, some(QVars, CR, Goal0) - Info0,
-		some(QVars, CR, Goal) - Info, AddedImpurity) -->
+transform_goal(Path, some(QVars, CanRemove0, Goal0) - Info0,
+		some(QVars, CanRemove, Goal) - Info, AddedImpurity) -->
 	{ Goal0 = _ - InnerInfo },
 	{ goal_info_get_determinism(Info0, OuterDetism) },
 	{ goal_info_get_determinism(InnerInfo, InnerDetism) },
 	{ InnerDetism = OuterDetism ->
+		CanRemove = CanRemove0,
 		MaybeCut = no_cut
 	;
+		% Given a subgoal containing both nondet code and impure code, 
+		% determinism analysis will remove the `some' wrapped around
+		% that subgoal if it is allowed to. If we get here, then the
+		% subgoal inside the `some' contains nondet code, and the deep
+		% profiling transformation will make it impure as well.
+		CanRemove = cannot_remove,
 		MaybeCut = cut
 	},
 	transform_goal([exist(MaybeCut) | Path], Goal0, Goal, AddedImpurity),
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.151
diff -u -b -r1.151 det_analysis.m
--- compiler/det_analysis.m	22 Aug 2001 07:56:31 -0000	1.151
+++ compiler/det_analysis.m	4 Feb 2002 22:54:24 -0000
@@ -297,28 +297,42 @@
 	goal_info_get_instmap_delta(GoalInfo0, DeltaInstMap),
 
 	% If a pure or semipure goal has no output variables,
-	% then the goal is in single-solution context
+	% then the goal is in a single-solution context.
 
 	(
 		det_no_output_vars(NonLocalVars, InstMap0, DeltaInstMap,
 			DetInfo),
 		\+ goal_info_is_impure(GoalInfo0)
 	->
-		OutputVars = no,
+		AddPruning = yes,
 		SolnContext = first_soln
 	;
-		OutputVars = yes,
+		AddPruning = no,
 		SolnContext = SolnContext0
 	),
 
+	(
+		Goal0 = some(_, cannot_remove, _ - InsideGoalInfo),
+		goal_info_get_determinism(GoalInfo0, OutsideDetism),
+		goal_info_get_determinism(InsideGoalInfo, InsideDetism),
+		determinism_components(OutsideDetism, _, OutsideSolns),
+		determinism_components(InsideDetism, _, InsideSolns),
+		OutsideSolns = at_most_one,
+		InsideSolns = at_most_many
+	->
+		Prune = yes
+	;
+		Prune = AddPruning
+	),
+
 	det_infer_goal_2(Goal0, GoalInfo0, InstMap0, SolnContext, DetInfo,
 		NonLocalVars, DeltaInstMap, Goal1, InternalDetism0, Msgs1),
 
 	determinism_components(InternalDetism0, InternalCanFail,
 				InternalSolns0),
 	(
-		% if mode analysis notices that a goal cannot succeed,
-		% then determinism analysis should notice this too
+		% If mode analysis notices that a goal cannot succeed,
+		% then determinism analysis should notice this too.
 
 		instmap_delta_is_unreachable(DeltaInstMap)
 	->
@@ -328,20 +342,15 @@
 	),
 
 	(
-		% If a pure or semipure goal with multiple solutions
-		% has no output variables,
-		% then it really it has only one solution
-		% (we will need to do pruning)
-
 		( InternalSolns = at_most_many
 		; InternalSolns = at_most_many_cc
 		),
-		OutputVars = no
+		Prune = yes
 	->
 		Solns = at_most_one
 	;
-		% If a goal with multiple solutions occurs in a single-solution
-		% context, then we will need to do pruning
+		% If a goal with multiple solutions occurs in a
+		% single-solution context, then we will need to do pruning.
 
 		InternalSolns = at_most_many,
 		SolnContext = first_soln
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
Index: tests/general/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/Mmakefile,v
retrieving revision 1.36
diff -u -b -r1.36 Mmakefile
--- tests/general/Mmakefile	22 Jan 2002 14:21:52 -0000	1.36
+++ tests/general/Mmakefile	4 Feb 2002 23:59:59 -0000
@@ -16,7 +16,7 @@
 
 # Any program added here should also be added to the `.cvsignore' file.
 
-PROGS=		\
+ORDINARY_PROGS=	\
 		arithmetic \
 		array_test \
 		commit_bug \
@@ -41,7 +41,6 @@
 		io_regression \
 		liveness \
 		liveness2 \
-		map_corresponding \
 		mode_inf \
 		mode_inf_bug \
 		mode_inference_reorder \
@@ -70,6 +69,15 @@
 		univ \
 		unreachable \
 		unsafe_uniqueness
+
+EXCEPTION_PROGS = \
+		map_corresponding
+
+ifneq "$(findstring profdeep,$(GRADE))" ""
+	PROGS = $(ORDINARY_PROGS)
+else
+	PROGS = $(ORDINARY_PROGS) $(EXCEPTION_PROGS)
+endif
 
 # dnf.m does not work in non-gc grades, because it uses `pragma memo'
 # (i.e. tabling) and tabling is not yet implemented for non-gc grades.
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
Index: tests/recompilation/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/Mmakefile,v
retrieving revision 1.7
diff -u -b -r1.7 Mmakefile
--- tests/recompilation/Mmakefile	26 Oct 2001 02:24:05 -0000	1.7
+++ tests/recompilation/Mmakefile	5 Feb 2002 00:18:49 -0000
@@ -8,6 +8,19 @@
 #-----------------------------------------------------------------------------#
 #-----------------------------------------------------------------------------#
 
+# The part of the compiler that manages recompilation depends on throwing
+# and catching exceptions. We cannot (yet) catch exceptions in deep profiling
+# grades.
+
+ifneq "$(findstring profdeep,$(GRADE))" ""
+	INHIBIT = true
+else
+	INHIBIT = false
+endif
+
+echo_inhibit:
+	@echo $(INHIBIT)
+
 clean_local:
 
 realclean_local:
Index: tests/recompilation/runtests
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/runtests,v
retrieving revision 1.4
diff -u -b -r1.4 runtests
--- tests/recompilation/runtests	3 Aug 2001 16:22:45 -0000	1.4
+++ tests/recompilation/runtests	5 Feb 2002 02:24:40 -0000
@@ -15,6 +15,14 @@
 
 . ./TESTS
 
+if test `eval mmake $mmakeopts echo_inhibit` = "true"
+then
+	TESTS_SHOULD_SUCCEED=""
+	NO_PARALLEL_MAKE_TESTS=""
+	TESTS_SHOULD_FAIL=""
+	ALL_TESTS=""
+fi
+
 failing_tests=""
 cleanup=true
 
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list