[mercury-users] 64-bit ints on 32-bit platforms

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Oct 16 17:49:15 AEDT 2009

On 16-Oct-2009, Michael Day <mikeday at yeslogic.com> wrote:
> and it will 
> transparently use two 32-bit registers for the return value:

Yes. But the Mercury implementation does not do any such thing, for a very
simple reason: it would take a lot of work to implement such a capability,
and the benefit is simply too low. And the benefit is shrinking every day
as the proportion of 64 bit machines in the world is increasing.

> foo:
>         movl    4(%esp), %eax
>         movl    8(%esp), %edx
>         addl    $1, %eax
>         adcl    $0, %edx
>         ret
> Presumably the equivalent function in Mercury would need to allocate 8 
> bytes to store the result value and return the pointer to it, which seems 
> like it could be costly if lots of arithmetic was being done.

By "cost", you mean performance, so that is correct. However, the cost
in programming work of doing what you want would be very high, since the
implication "if a value is unboxed, then its gets stored in a single virtual
machine register which is the same size as an actual machine register" is
embedded very deeply in the compiler and the runtime.

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