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

Peter Ross peter.ross at miscrit.be
Thu Mar 15 02:58:15 AEDT 2001


The following code

scale_x(S, p(X, Y)) = p(S*X, Y).

is represented in the HLDS by

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?

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