[m-rev.] for review: procedure-local closure analysis

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Jun 15 14:05:23 AEST 2005


On Thu, 9 Jun 2005, Julien Fischer wrote:

>
> For review by anyone.
>
> Estimated hours taken: 30
> Branches: main
>
> Implement a procedure-local closure analysis that tracks the possible
> values of higher-order valued variables within a procedure.  We will
> eventually replace this with more sophisticated analysis that tracks
> these values across procedure and module boundaries but we something of
You need a "need" here I think.

...
> +process_goal(VarTypes, _, Goal, Goal, !ClosureInfo) :-
> +    Goal = unify(_, _, _, Unification, _) - _,
> +    (
> +        Unification = construct(LHS, RHS, _, _, _, _, _),
> +        (
> +            % NOTE: we don't bother worrying about features
> +            % that relate to Aditi.

I could be missing something, but I don't see how this comment relates to the
code below.

> +            RHS = pred_const(ShroudedPPId, EvalMethod),
> +            EvalMethod = normal
> +        ->
> +            PPId = unshroud_pred_proc_id(ShroudedPPId),
> +            HO_Value = set.make_singleton_set(PPId),
> +            svmap.det_insert(LHS, exclusive(HO_Value), !ClosureInfo)
> +        ;
> +            true
> +        )
> +    ;
> +        Unification = deconstruct(_, _, Args, _, _, _),
> +        %
> +        % XXX We don't currently support tracking the values of
> +        % closures that are stored in data structures.
> +        %
...
> @@ -2082,6 +2085,17 @@
>              mercury_compile__frontend_pass_by_phases(!HLDS, FoundModeError,
>                  !IO),
>              ( FoundModeError = no ->
> +                %
> +                % NOTE: We should run closure analysis
> +                % if we are performing termination or exception
> +                % analysis.
> +                %

Do we perform closure analysis if we are performing termination or
exception analysis?  If not then shouldn't this be an XXX instead of a NOTE.
This comment doesn't seem to apply to the goal directly after.

> +                ( ClosureAnalysis = yes ->
> +                    mercury_compile.maybe_closure_analysis(
> +                        Verbose, Stats, !HLDS, !IO)
> +                ;
> +                    true
> +                ),
>                  (
>                      ExceptionAnalysis = yes,
>                      mercury_compile__maybe_exception_analysis(Verbose, Stats,
> @@ -2248,6 +2262,9 @@

Ian.

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