[mercury-users] mmc --optimize-constructor-last-call

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jan 5 23:52:36 AEDT 2009



On Sun, 4 Jan 2009, Michael Day wrote:

> However, I don't understand how the last call optimisation is works, in 
> particular these three lines of filter_neg:
>
>        Word * AddrYs0;
>
>        field(tag(1), *Ys, 1) = AddrYs0;
>
>        filter_neg_LCMC(Xs0, AddrYs0);
>
> That would seem to be assigning an unset variable to the tail of the Ys cons 
> cell, then passing in that random value to the loop procedure.
>
> Shouldn't it be doing the assignment the other way around, passing in the 
> address of the second field of Ys0, something like this:
>
>        AddrYs0 = &(field(tag(1), *Ys, 1);
>
> I really can't see how the current code could work, but since it's not being 
> called in practice perhaps it doesn't matter (?) Oh hang on, this dodgy code 
> is only generated for the ctgc versions of the procedure, the non-ctgc 
> versions have the assignment the right way around.
>
> So that's a bug report, these two optimisations do not appear to play nicely 
> with each other in rotd-2008-01-30. I'll copy to mercury-bugs.

Things appear to the right way around with recent rotds.

Cheers,
Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list