[m-rev.] diff: don't generate table reset/stats preds by default

Peter Wang novalazy at gmail.com
Thu Aug 28 14:09:53 AEST 2008


Branches: main

compiler/add_pragma.m:
	Do *not* generate table reset/statistics predicates for tabling
	pragmas with no attributes.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/table_no_attr.m:
	Add test case.

diff --git a/compiler/add_pragma.m b/compiler/add_pragma.m
index 77ae0c1..ad6ecd4 100644
--- a/compiler/add_pragma.m
+++ b/compiler/add_pragma.m
@@ -2692,8 +2692,8 @@ set_eval_method_create_aux_preds(ProcId, ProcInfo0, Context, SimpleCallId,
             ;
                 MaybeAttributes = no,
                 Strictness = all_strict,
-                Statistics = table_gather_statistics,
-                AllowReset = table_allow_reset
+                Statistics = table_dont_gather_statistics,
+                AllowReset = table_dont_allow_reset
             ),
             (
                 Strictness = specified(MaybeArgMethods, _HiddenArgMethod),
diff --git a/tests/valid/Mercury.options b/tests/valid/Mercury.options
index 0e63e0d..81d676f 100644
--- a/tests/valid/Mercury.options
+++ b/tests/valid/Mercury.options
@@ -114,6 +114,7 @@ MCFLAGS-solver_type_bug		= --halt-at-warn
 MCFLAGS-solv			= --halt-at-warn
 MCFLAGS-spurious_purity_warning	= --halt-at-warn
 MCFLAGS-stack_opt_simplify	= --optimize-saved-vars
+MCFLAGS-table_no_attr           = --structure-sharing
 MCFLAGS-time_yaowl		= --allow-stubs
 MCFLAGS-tuple_eqv               = --smart-recompilation
 MCFLAGS-two_way_unif		= -O-1
diff --git a/tests/valid/Mmakefile b/tests/valid/Mmakefile
index a9d10c9..25cfccd 100644
--- a/tests/valid/Mmakefile
+++ b/tests/valid/Mmakefile
@@ -277,7 +277,8 @@ CTGC_PROGS = \
 	sharing_exist \
 	sharing_loop \
 	sharing_loop2 \
-	sharing_loop3
+	sharing_loop3 \
+	table_no_attr
 
 # The following programs require that num_tag_bits >= 1
 RESERVE_TAG_PROGS = \
diff --git a/tests/valid/table_no_attr.m b/tests/valid/table_no_attr.m
new file mode 100644
index 0000000..e7103cc
--- /dev/null
+++ b/tests/valid/table_no_attr.m
@@ -0,0 +1,16 @@
+% We were generating table reset/statistics predicates for `:- pragma memo's
+% with no attributes.  This happened to cause the compiler to abort when
+% structure sharing was enabled, but is otherwise unrelated to that analysis.
+
+:- module table_no_attr.
+:- interface.
+
+:- pred baboon(int::in, int::out) is det.
+
+:- implementation.
+
+:- pragma memo(baboon/2).
+
+baboon(X, X).
+
+% vim: ft=mercury ts=8 sts=4 sw=4 et



--------------------------------------------------------------------------
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