[m-dev.] for review: last call modulo constructors [1/3]

Andrew Bromage bromage at cs.mu.OZ.AU
Tue Jun 23 09:45:39 AEST 1998


G'day all.

Fergus Henderson wrote:

> > compiler/modecheck_unify.m:
> > 	Add support for `free(alias)' insts.
> > 	Disallow scheduling of constructions of partially instantiated
> > 	data structures until we come up with a better algorithm for
> > 	when this should be done and when it shouldn't.  At the
> > 	moment, partially instantiated data structures are only
> > 	created by LCO, which is called after mode checking.
> 
> Could you explain the rationale for this change in a bit more detail?
> What would be wrong with say scheduling such constructions at the
> earliest point possible?

One important reason is bad register behaviour in one very common
case:

:- mode foo(in, out).

foo(X, foo(A,B,C,D,E,F,G,H)) :-
	some_call(X),
	some_other_call(X),
	produce(X,A,B,C,D,E,F,G,H).

By constructing foo/8 as early as possible, all those output variables
have to be saved across the calls to some_call and some_other_call.

Arguably, it should be the job of the optimiser to move the construction
as late as possible.  (Perhaps in saved_vars.m.)  But since we don't do
that yet, making this NYI seems like a good design choice to me.

Cheers,
Andrew Bromage



More information about the developers mailing list