[m-rev.] for review: term size profiling
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri May 30 17:39:23 AEST 2003
On 30-May-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > There is no test case, because the compiler does not yet generate
> > unsafe_casts with option settings that are compatible with declarative
> > debugging.
>
> How about a test case containing an explicit call to
> private_builtin.unsafe_type_cast?
I didn't know we exposed that functionality to users. Now that I know,
here is the test case and the updated log message.
Zoltan.
browser/declarative_tree.m:
browser/program_representation.m:
compiler/prog_rep.m:
Fix a bug: treat unsafe casts as we treat assignment unifications.
We used to treat them as calls, which was wrong, because unlike calls,
unsafe_casts do not generate trace events.
tests/debugging/declarative/unsafe_cast.{m,inp,exp}:
A new regression test.
tests/debugging/declarative/Mercury_options.m:
Set the parameters required for the new test.
tests/debugging/declarative/Mmakefile:
Enable the new test.
cvs diff: Diffing .
Index: Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mercury.options,v
retrieving revision 1.7
diff -u -b -r1.7 Mercury.options
--- Mercury.options 4 Feb 2003 04:59:10 -0000 1.7
+++ Mercury.options 30 May 2003 05:52:27 -0000
@@ -7,4 +7,5 @@
MCFLAGS-shallow_2=--trace shallow
MCFLAGS-special_term_dep=--trace rep
MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-all
+MCFLAGS-unsafe_cast=--trace rep
MCFLAGS-untraced_subgoal_sub=--trace minimum
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.57
diff -u -b -r1.57 Mmakefile
--- Mmakefile 18 Mar 2003 16:38:46 -0000 1.57
+++ Mmakefile 30 May 2003 05:50:37 -0000
@@ -46,7 +46,8 @@
solutions \
special_term_dep \
tabled_read_decl \
- throw
+ throw \
+ unsafe_cast
# The following should not be run in `debug' or `mm' grades.
#
@@ -262,6 +263,9 @@
$(MDB) ./throw < throw.inp 2>&1 | \
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' | \
sed -e '/EXCP/s/).*/)/' > throw.out 2>&1
+
+unsafe_cast.out: unsafe_cast unsafe_cast.inp
+ $(MDB) ./unsafe_cast < unsafe_cast.inp > unsafe_cast.out 2>&1
untraced_subgoal.out: untraced_subgoal untraced_subgoal.inp
$(MDB) ./untraced_subgoal < untraced_subgoal.inp \
Index: unsafe_cast.exp
===================================================================
RCS file: unsafe_cast.exp
diff -N unsafe_cast.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ unsafe_cast.exp 30 May 2003 07:33:22 -0000
@@ -0,0 +1,19 @@
+ 1: 1 1 CALL pred unsafe_cast.main/2-0 (det) unsafe_cast.m:11
+mdb> echo on
+Command echo enabled.
+mdb> context none
+Contexts will not be printed.
+mdb>
+ 2: 2 2 CALL pred unsafe_cast.p/1-0 (det)
+mdb> f
+ 3: 2 2 EXIT pred unsafe_cast.p/1-0 (det)
+mdb> dd
+p(42)
+Valid? b 1
+browser> mark
+Found incorrect contour:
+p(42)
+Is this a bug? yes
+ 3: 2 2 EXIT pred unsafe_cast.p/1-0 (det)
+mdb> c
+42
Index: unsafe_cast.inp
===================================================================
RCS file: unsafe_cast.inp
diff -N unsafe_cast.inp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ unsafe_cast.inp 30 May 2003 07:33:21 -0000
@@ -0,0 +1,9 @@
+echo on
+context none
+
+f
+dd
+b 1
+mark
+yes
+c
Index: unsafe_cast.m
===================================================================
RCS file: unsafe_cast.m
diff -N unsafe_cast.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ unsafe_cast.m 30 May 2003 05:46:41 -0000
@@ -0,0 +1,20 @@
+:- module unsafe_cast.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+main(!IO) :-
+ p(Y),
+ io__write_int(Y, !IO),
+ io__nl(!IO).
+
+:- pred p(int::out) is det.
+
+p(Y) :-
+ X = 42,
+ private_builtin__unsafe_type_cast(X, Y).
--------------------------------------------------------------------------
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