[m-dev.] introduce box/unbox float operators in HLDS

Peter Ross peter.ross at miscrit.be
Thu Mar 15 21:55:18 AEDT 2001


On Thu, Mar 15, 2001 at 04:39:41AM +1100, Fergus Henderson wrote:
> On 14-Mar-2001, Ralph Becket <rbeck at microsoft.com> wrote:
>
> The MLDS back-end does not assume that every HLDS variable occupies
> exactly one machine word/register.  Instead, uses unboxed floats for
> parameters and local variables, and inserts boxing/unboxing when
> needed, e.g. when converting to/from a polymorphic type.
> 
> > If that's the case, wouldn't it be simpler to just add SR versions
> > of the float operations?
> 
> That sounds to me like a much easier way of solving the problem
> that Pete is trying to solve.
> 
It doesn't help for the following code

swap(p(X, Y), p(Y, X)).

There is no floating point operation, yet we will still unbox and then
box the X and Y cells on the MLDS backend, while the LLDS backend
doesn't do the box and unbox and hence introduces aliases between the
two headvars.

This is problematic for the analysis because we need to know which
backend we are compiling for to determine what aliasing has been
introduced.  There are three solutions to this problem: annotate the
aliasing pragmas and reuse pragmas with an annotation for which backed
they are to be used for, or assume the worst case behaviour of the two
backend, or make the unboxing/boxing explicit to ensure that we have
the same behaviour for both backends.

Of course this is only useful for very floating point intensive
programs, like for example the ICFP raytracer, which is what we have been
using for all our structure reuse investigative work.

Pete
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list