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

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Aug 7 12:02:31 AEST 2008


On Thu, 7 Aug 2008, Peter Wang wrote:

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

That's fine.

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