[mercury-users] Exceptions and unique modes
Peter Ross
peter.ross at miscrit.be
Fri Feb 23 00:18:58 AEDT 2001
On Thu, Feb 22, 2001 at 10:56:50PM +1100, Peter Schachte wrote:
> On Thu, Feb 22, 2001 at 12:26:46PM +0100, Peter Ross wrote:
> > You would think that the best canditate for reuse of that memory is the
> > next state. Unfortunately it is not quite that easy as the following
> > type indicates.
> >
> > :- type t
> > ---> f(int)
> > ; g(int, int).
>
> I think a more interesting case would be something like this:
>
> :- pred swap_stuff(type1::di, type1::uo, type2::di, type2::uo).
>
> swap_stuff(f(A,B,C), f(D,E,C), g(D,E,F), g(A,B,F)).
>
> It's natural to want the compiler to cleverly reuse the term passed as the
> first and third arguments, and pass them back as the second and fourth,
> respectively, just swapping the first two arguments of each term. But a
> good structure reuse optimization would instead pass the firstand third
> arguments back as the fourth and second respectively, swapping just the
> third arguments.
>
Yes that would be nice, and it is one of the things Nancy and I are
looking at for structure reuse. However I think that compared to the
massive gain you get from not having extra garbage the relative payoff
of this extra optimization will not be hugely significant, and I would
be willing to pay it for the ability to use one name to refer to unique
objects.
Pete
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list