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

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Jun 15 14:53:04 AEST 2005


On Wed, 15 Jun 2005, Ian MacLarty wrote:

> 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.
>
Yep... and I also need an "a" above.  Fixed.

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

The other possible value of 'EvalMethod' is '(aditi_bottom_up)'.
The point that the comment is making is we only bother tracing
the values of normal closures, not those used by Aditi.  I'll
rewrite it to make that more clear.

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

I think the intention of the comment was was that
it's a good idea to run closure analysis because doing so
(will eventually) improve the precision of the termination and exception
analyses.  I've deleted since there isn't really much point in having
it there.

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