[m-rev.] for review: goal_path representation

Paul Bone pbone at csse.unimelb.edu.au
Mon Sep 26 16:38:09 AEST 2011


On Wed, Sep 21, 2011 at 07:47:46PM +1000, Zoltan Somogyi wrote:
> For review by anyone.
> 
> Index: compiler/rbmm.condition_renaming.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/rbmm.condition_renaming.m,v
> retrieving revision 1.19
> diff -u -b -r1.19 rbmm.condition_renaming.m
> --- compiler/rbmm.condition_renaming.m	23 May 2011 05:08:10 -0000	1.19
> +++ compiler/rbmm.condition_renaming.m	19 Sep 2011 09:34:50 -0000
> @@ -1095,13 +1091,13 @@
>  
>  collect_ite_annotation_exec_path_2(_, _, _, _, _, [], !IteRenamingProc,
>          !IteAnnotationProc).
> -collect_ite_annotation_exec_path_2(Graph, PathToThen,
> +collect_ite_annotation_exec_path_2(Graph, RevPathToThen,
>          RenamedRegions, HowMany, PrevPoint, [ProgPoint - _ | ProgPointGoals],
>          !IteRenamingProc, !IteAnnotationProc) :-
>      ProgPoint = pp(_, RevGoalPath),
> -    RevGoalPath = rgp(RevGoalPathSteps),
> +    reverse_goal_path_to_steps(RevGoalPath, RevGoalPathSteps),
>      list.reverse(RevGoalPathSteps, GoalPathSteps),
> -    PathToThen = rgp(RevPathToThenSteps),
> +    reverse_goal_path_to_steps(RevPathToThen, RevPathToThenSteps),
>      list.reverse(RevPathToThenSteps, PathToThenSteps),
>      ( list.append(PathToThenSteps, FromThenSteps, GoalPathSteps) ->
>          ( list.member(step_ite_cond, FromThenSteps) ->
> @@ -1126,11 +1122,19 @@
>                  RenamedRegions, !IteAnnotationProc)
>          )
>      ;
> -        collect_ite_annotation_exec_path_2(Graph, PathToThen,
> +        collect_ite_annotation_exec_path_2(Graph, RevPathToThen,
>              RenamedRegions, HowMany, ProgPoint, ProgPointGoals,
>              !IteRenamingProc, !IteAnnotationProc)
>      ).
>  
> +:- pred reverse_goal_path_to_steps(reverse_goal_path::in,
> +    list(goal_path_step)::out) is det.
> +
> +reverse_goal_path_to_steps(rgp_nil, []).
> +reverse_goal_path_to_steps(rgp_cons(EarlierPath, LaterStep),
> +        [LaterStep | EarlierSteps]) :-
> +    reverse_goal_path_to_steps(EarlierPath, EarlierSteps).
> +
>      % The reverse renaming annotation is in the form: R = R_ite_HowMany.
>      % The annotation is attached to the program point but actually means
>      % to be added before the program point.

Can the conversion between reverse and foward goal paths be moved into
mdbcomp/goal_path.m?

> Index: compiler/unneeded_code.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/unneeded_code.m,v
> retrieving revision 1.63
> diff -u -b -r1.63 unneeded_code.m
> --- compiler/unneeded_code.m	16 Aug 2011 03:26:34 -0000	1.63
> +++ compiler/unneeded_code.m	19 Sep 2011 10:37:55 -0000
> @@ -124,7 +124,7 @@
>              % If-then-elses always have two alternatives: the then branch
>              % (numbered 1) and the else branch (numbered 2).
>  
> -    ;       alt_switch(maybe(int)).
> +    ;       alt_switch(maybe_switch_num_functors).
>              % The number of alternatives in a switch is equal to the number of
>              % function symbols in the type of the switched-on variable. This
>              % number is given by the argument integer, if present; if the

This change is not described in the ChangeLog.

I know we don't describe everything (like little fixes to spelling for example
unless they're the only change) but this is a change to a datastructure.

The rest is fine.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20110926/04ae7a8c/attachment.sig>


More information about the reviews mailing list