[m-dev.] for review: improvements/bug fixes for simplify.m

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 27 18:29:37 AEST 1999


On 27-Oct-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
>  
> > >  simplify__goal_2(some(Vars1, CanRemove0, Goal1), SomeInfo,
> > > +		GoalExpr, GoalInfo, Info0, Info) :-
> > > +	simplify_info_get_common_info(Info0, Common),
> > > +	simplify__goal(Goal1, Goal2, Info0, Info1),
> > > +	simplify__nested_somes(CanRemove0, Vars1, Goal2, SomeInfo, Goal),
> > > +	Goal = GoalExpr - GoalInfo,
> > > +	( Goal = some(_, _, _) - _ ->
> > > +		% Don't increase the set of non-locals of a goal within
> > > +		% a commit through common structure elimination because
> > > +		% that may change the determinism.
> > > +		simplify_info_set_common_info(Info1, Common, Info)
> > >  	;
> > > +		Info = Info1
> > >  	).
> > 
> > >From the comment, I understand roughly what the code is trying to do,
> > but it took me a long time to understand how the code (set_common_info)
> > relates to the comment (don't increase the set of non-locals).
> > I think it would help if you could explain in a little bit more detail
> > how leaving the common_info unchanged at that point could lead
> > later code to increase the set of non-locals of this goal.
>  
> 
> +		% Replacing calls, constructions or deconstructions
> +		% outside a commit with references to variables created
> +		% inside the commit would increase the set of output
> +		% variables of the goal inside the commit. This is not
> +		% allowed because it could change the determinism.

I suggest appending

		% Thus we need to reset the common_info to what it
		% was before processing the goal inside the commit,
		% to ensure that we make any such replacements when
		% processing the rest of the goal.

Apart from that, this change looks great now.  Thanks.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list