[m-rev.] for post-commit review: make table reset preds do nothing in non-tabling grades

Peter Wang novalazy at gmail.com
Thu Aug 7 11:59:30 AEST 2008


Branches: main

compiler/add_pragma.m:
	Make compiler-generated table reset predicates do nothing in grades
	that don't support tabling.  Previously they contained code to reset a
	table, which doesn't exist.

diff --git a/compiler/add_pragma.m b/compiler/add_pragma.m
index c610c9e..0281c34 100644
--- a/compiler/add_pragma.m
+++ b/compiler/add_pragma.m
@@ -2861,9 +2861,17 @@ create_tabling_reset_pred(ProcId, Context, SimpleCallId, SingleProc,
         Arg1 = pragma_var(IO0, "_IO0", di_mode, always_boxed),
         Arg2 = pragma_var(IO, "_IO", uo_mode, always_boxed),
 
-        Global = table_info_c_global_var_name(!.ModuleInfo, SimpleCallId,
-            ProcId),
-        ResetCode = Global ++ ".MR_pt_tablenode.MR_integer = 0;",
+        module_info_get_globals(!.ModuleInfo, Globals),
+        current_grade_supports_tabling(Globals, IsTablingSupported),
+        (
+            IsTablingSupported = yes,
+            Global = table_info_c_global_var_name(!.ModuleInfo, SimpleCallId,
+                ProcId),
+            ResetCode = Global ++ ".MR_pt_tablenode.MR_integer = 0;"
+        ;
+            IsTablingSupported = no,
+            ResetCode = ""
+        ),
         ResetImpl = fc_impl_ordinary(ResetCode, yes(Context)),
         ResetPragma = pragma_foreign_proc(!.Attrs, ResetPredSymName,
             pf_predicate, [Arg1, Arg2], !.VarSet, InstVarSet, ResetImpl),


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