[m-rev.] for review: lco and constant constructions

Zoltan Somogyi zs at unimelb.edu.au
Fri Jul 20 14:53:11 AEST 2012


On 20-Jul-2012, Peter Wang <novalazy at gmail.com> wrote:
> Allow the last-call-modulo-cons optimisation to move goals constructing
> constants before a recursive call, thus allowing the call to be in the
> tail position.

That code is not as general as it could be. Consider a recursive call
that generates X being followed by

	V1 = a,
	V2 = b,
	V3 = f(a, b),
	Headvar4 = g(V3, X)

You code would allow V1 and V2, but not V3.

I think the test you want is not ConstructArgs = [], but a more general test;
something that implements the notion "all ConstructArgs have either been built
by construction unifications after the recursive call, or were available
even before the recursive call".

However, I think you need to separate out unifications that construct
cells that have a field whose address is taken, and unifications that
do no such thing, and treat them differently. Including them in the same list,
as your diff does, can work only by accident.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list