[m-rev.] diff: fix --checked-nondet-tailcall

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Jan 15 13:50:26 AEDT 2007


compiler/jumpopt.m:
	Fix a very old bug with --checked-nondet-tailcall that caused a call
	instruction to not be preceded by a livevals instruction. This violated
	an invariant of the LLDS and caused livemap.m to throw an exception.

tests/hard_coded/checked_nondet_tailcall_noinline.{m,exp}:
	Add this copy of the checked_nondet_tailcall test case.

tests/hard_coded/Mercury.options:
	Compile checked_nondet_tailcall_noinline with --no-inlining, which
	used to expose the bug.

tests/hard_coded/Mmakefile:
	Enable the new test case.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
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/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.101
diff -u -b -r1.101 jumpopt.m
--- compiler/jumpopt.m	15 Jan 2007 02:23:47 -0000	1.101
+++ compiler/jumpopt.m	15 Jan 2007 02:33:22 -0000
@@ -372,6 +372,7 @@
                     llds_instr(livevals(Livevals), ""),
                     llds_instr(goto(Proc), redirect_comment(Comment0)),
                     llds_instr(label(NewLabel), "non tail call"),
+                    llds_instr(livevals(Livevals), ""),
                     Instr0
                 ],
                 NewRemain = specified(NewInstrs, Instrs0),
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
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/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
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/gears
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/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
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/net
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/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/stream/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
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 slice
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
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
Index: tests/hard_coded/Mercury.options
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mercury.options,v
retrieving revision 1.24
diff -u -b -r1.24 Mercury.options
--- tests/hard_coded/Mercury.options	20 Nov 2006 05:30:00 -0000	1.24
+++ tests/hard_coded/Mercury.options	14 Jan 2007 13:51:40 -0000
@@ -1,6 +1,7 @@
 MCFLAGS-allow_stubs	=	--allow-stubs --no-warn-stubs --infer-all
 MCFLAGS-any_call_hoist_bug = --loop-invariants
 MCFLAGS-checked_nondet_tailcall	=	--checked-nondet-tailcalls
+MCFLAGS-checked_nondet_tailcall_noinline = --checked-nondet-tailcalls --no-inlining
 MCFLAGS-bigtest		=	--intermodule-optimization -O3
 MCFLAGS-cc_and_non_cc_test = 	--no-inlining
 MCFLAGS-constraint	=	--constraint-propagation --enable-termination
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.304
diff -u -b -r1.304 Mmakefile
--- tests/hard_coded/Mmakefile	11 Dec 2006 04:10:45 -0000	1.304
+++ tests/hard_coded/Mmakefile	14 Jan 2007 15:59:06 -0000
@@ -20,6 +20,7 @@
 	cc_multi_bug \
 	cc_nondet_disj \
 	checked_nondet_tailcall \
+	checked_nondet_tailcall_noinline \
 	closure_extension \
 	common_type_cast \
 	compare_spec \
Index: tests/hard_coded/checked_nondet_tailcall_noinline.exp
===================================================================
RCS file: tests/hard_coded/checked_nondet_tailcall_noinline.exp
diff -N tests/hard_coded/checked_nondet_tailcall_noinline.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/checked_nondet_tailcall_noinline.exp	14 Jan 2007 15:58:41 -0000
@@ -0,0 +1,5 @@
+18 19 
+21 22 
+31 
+41 
+
Index: tests/hard_coded/checked_nondet_tailcall_noinline.m
===================================================================
RCS file: tests/hard_coded/checked_nondet_tailcall_noinline.m
diff -N tests/hard_coded/checked_nondet_tailcall_noinline.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/checked_nondet_tailcall_noinline.m	14 Jan 2007 13:51:11 -0000
@@ -0,0 +1,68 @@
+:- module checked_nondet_tailcall_noinline.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- import_module list, solutions.
+
+main --> 
+	{ join(1, Ones) },
+	write_ints(Ones),
+	{ join(2, Twos) },
+	write_ints(Twos),
+	{ join(3, Threes) },
+	write_ints(Threes),
+	{ join(4, Fours) },
+	write_ints(Fours),
+	{ join(5, Fives) },
+	write_ints(Fives).
+
+:- pred edge1(int::in, int::out) is nondet.
+
+edge1(1, 11).
+edge1(1, 12).
+
+:- pred edge2(int::in, int::out) is nondet.
+
+edge2(11, 18).
+edge2(12, 19).
+edge2(2, 21).
+edge2(2, 22).
+edge2(3, 31).
+edge2(4, 41).
+
+:- pred edge12(int::in, int::out) is nondet.
+
+edge12(A, B) :-
+	( edge1(A, C) ->
+		% When we come here after the last success of edge1,
+		% the call to edge2 will be a checked nondet tailcall.
+		% When we come here after a non-last success of edge1,
+		% the check will fail, and we will have to do a
+		% non-tail call.
+		D = C
+	;
+		% When this arm of the switch is taken, the call to edge2
+		% will be a checked nondet tailcall.
+		D = A
+	),
+	edge2(D, B).
+
+:- pred join(int::in, list(int)::out) is det.   
+
+join(A, Bs) :- 
+	solutions((pred(B::out) is nondet :- edge12(A, B)), Bs).
+
+:- pred write_ints(list(int)::in, io__state::di, io__state::uo) is det.
+
+write_ints([]) -->
+	io__write_string("\n").
+write_ints([X | Xs]) -->
+	io__write_int(X),
+	io__write_string(" "),
+	write_ints(Xs).
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/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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