[mercury-users] Automatic Recognition of Uniqueness

Ralph Becket rwab1 at cam.sri.com
Thu Sep 10 19:42:35 AEST 1998


Maurice Bruynooghe wrote on 10 Sep:
> > 
> > 	:- pred append(list(T), list(T), list(T)).
> > 	:- mode append(di, di, uo) is det.
> 
> In Leuven, work is going on about the feasibility of an analysis which
> would infer the di/uo declarations, taking away from the programmer the burden
> of worrying about these low level details of memory management.

This is more along the lines I was considering.  It seems to me that
while the compiler will tell you if the determinism declaration for a
predicate is weaker than necessary, can it deduce that a predicate's
modes are as tight as possible?  My thought was that it should be
possible to spot when arguments with modes

	:- pred p(..., T::in, T::out, ...) is det.

could be replaced with

	:- pred p(..., T:di, T::uo, ...) is det.

I would have thought this was managable on an intra-module basis.

Just as a matter of interest, has anybody done any analysis to see
what proportion of code generated could benefit from destructive
update like this?

Cheers,

Ralph

-- 
Ralph Becket  |  rwab1 at cam.sri.com  |  http://www.cam.sri.com/people/becket.html



More information about the users mailing list