[mercury-users] Exceptions and unique modes

Peter Schachte schachte at cs.mu.OZ.AU
Thu Feb 22 22:56:50 AEDT 2001


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.

-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  You can tell the ideals of a nation
http://www.cs.mu.oz.au/~schachte/      by its advertisements.
Phone:  +61 3 8344 9166                    -- Norman Douglas 
Fax:    +61 3 9348 1184                
--------------------------------------------------------------------------
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