[m-dev.] introduce box/unbox float operators in HLDS
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Mar 15 04:39:41 AEDT 2001
On 14-Mar-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> > From: Peter Ross [mailto:peter.ross at miscrit.be]
> >
> > scale(S, P0) = P :-
> > PO => p(X, Y),
> > NewX := S * X,
> > P <= p(NewX, Y).
> >
> > I would argue that we should represent it as the following in the HLDS,
> > thus allowing structure reuse to see the box/unboxing, and reuse the
> > cells where possible. Of course when floats are unboxed then we revert
> > back to the original HLDS representation.
> >
> > scale(S, P0) = P :-
> > P0 => p(BoxedX, BoxedY),
> > BoxedX => box(X),
> > BoxedY => box(Y),
> > NewX := S * X,
> > NewBoxedX <= box(NewX), % Reuse the BoxedX cell>
> > NewBoxedY <= box(Y), % Reuse the BoxedY cell.
> > P <= p(NewBoxedX, NewBoxedY). % Reuse the P0 cell.
> >
> > What are the problems with this suggestion?
>
> (Forgive me if I'm revealing my ignorance here...)
>
> I thought that the idea behind the HLDS was that every lvar occupied
> exactly one machine word/register,
(Did you mean "every var"?
The HLDS doesn't have "lvar"s, it only has "var"s.)
The LLDS back-end assumes that every HLDS variable occupies exactly one
machine word/register. It makes use of that assumption for parameter
passing and when saving variables in stack slots. Thanks for pointing
that out; in my previous mail I'd forgotten about the issue of saving
variables in stack slots for the LLDS back-end. Probably the LLDS
back-end could be modified to deal with saving unboxed floats on the
stack, but I expect that would probaby be quite a bit of work.
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.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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