[m-rev.] for review: new termination analyser (part 3 of 6)

Mark Brown mark at cs.mu.OZ.AU
Sun Apr 3 00:40:33 AEST 2005


On 24-Mar-2005, Julien Fischer <juliensf at cs.mu.OZ.AU> wrote:
> 
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
> retrieving revision 1.506
> diff -u -r1.506 make_hlds.m
> --- compiler/make_hlds.m	22 Mar 2005 06:40:06 -0000	1.506
> +++ compiler/make_hlds.m	22 Mar 2005 06:49:30 -0000
> @@ -999,6 +1005,7 @@
>      module_add_clause(VarSet, PredOrFunc, PredName, Args, Body, !.Status,
>          Context, GoalType, !ModuleInfo, !QualInfo, !IO).
> 
> +
>  add_item_clause(Item, !Status, Context, !ModuleInfo, !QualInfo, !IO) :-
>      Item = type_defn(_TVarSet, SymName, TypeParams, TypeDefn, _Cond),
>      % If this is a solver type then we need to also add clauses

Extra space added.

> Index: compiler/mercury_to_mercury.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
> retrieving revision 1.252
> diff -u -r1.252 mercury_to_mercury.m
> --- compiler/mercury_to_mercury.m	22 Mar 2005 06:40:08 -0000	1.252
> +++ compiler/mercury_to_mercury.m	22 Mar 2005 06:49:31 -0000

> +:- pred write_head_var_ids(list(int)::in, io::di, io::uo) is det.
> +
> +write_head_var_ids(VarIds, !IO) :-
> +	io.write_char('[', !IO),
> +	io.write_list(VarIds, ", ", io.write_int, !IO),
> +	io.write_char('[', !IO).

That should be a closing bracket.

> +
> +:- pred write_maybe_pragma_constr_arg_size_info(
> +	maybe(pragma_constr_arg_size_info)::in, io::di, io::uo) is det.
> +
> +write_maybe_pragma_constr_arg_size_info(no, !IO) :-
> +	io.write_string("not_set", !IO).
> +write_maybe_pragma_constr_arg_size_info(yes(ArgSizeInfo), !IO) :-
> +	io.write_string("constaints(", !IO),
> +	io.write_char('[', !IO),
> +	io.write_list(ArgSizeInfo, ", ", write_arg_size_constr, !IO),
> +	io.write_char('[', !IO).

That should be close bracket followed by close parenthesis.

> Index: compiler/options.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
> retrieving revision 1.453
> diff -u -r1.453 options.m
> --- compiler/options.m	23 Mar 2005 01:50:08 -0000	1.453
> +++ compiler/options.m	23 Mar 2005 07:05:01 -0000
> @@ -3050,8 +3099,46 @@
>  		"--term-path-limit <n>, --termination-path-limit <n>",
>  		"\tPerform termination analysis only on predicates",
>  		"\twith at most <n> paths (default: 256)."
> -	]).
> 
> +% The following options are used to control the new termination analyser.
> +% They are currently disabled because that is still a work-in-progress.
> +%
> +% 		"--enable-term2, --enable-termination2",
> +% 		"\tAnalyse each predicate to discover if it terminates. ",
> +% 		"\tThis uses an alternative termination analysis based",

s/based/based on/

> Index: compiler/polyhedron.m
> ===================================================================
> RCS file: compiler/polyhedron.m
> diff -N compiler/polyhedron.m
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ compiler/polyhedron.m	23 Mar 2005 22:47:06 -0000

> +	% Identity polyhedron with respect to intersection and convex union.
> +	%
> +	% e.g. P /\ identity = P
> +	%      P \/ identity = P (where \/ is the convex union)
> +	%
> +	% This is useful as an initial value when folding over a list of
> +	% polyhedra.
> +	%
> +:- func polyhedron.identity = polyhedron.

This function returns the universe (that is, the value at the top of the
lattice).  There doesn't exist an "identity" satisfying the above, except
in trivial lattices.

> Index: compiler/rat.m
> ===================================================================
> RCS file: compiler/rat.m
> diff -N compiler/rat.m
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ compiler/rat.m	23 Mar 2005 00:08:49 -0000

> +'=<'(X, Y) :-
> +	Cmp = cmp(X, Y),
> +	(Cmp = (<) ; Cmp = (=)).

That would be slightly more efficient as "cmp(X, Y) \= (>)".

> +
> +'>='(X, Y) :-
> +	Cmp = cmp(X, Y),
> +	(Cmp = (>) ; Cmp = (=)).

Likewise here.

> +rat.rat(Int) = rat_norm(Int, 1).

You don't need to normalize this, since it is already normalized for any
integer.

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