Large and small integers on 64 bit Squeak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Large and small integers on 64 bit Squeak

David T. Lewis
For 32 bit Squeak on 32 bit Intel hardware:
        SmallInteger maxVal hex ==> '16r3FFFFFFF'
        16r3FFFFFFF class ==> SmallInteger
        16r40000000 class ==> LargePositiveInteger
        16r3FFFFFFF + 1 = 16r40000000 ==> true

For 64 bit Squeak on 32 bit Intel hardware:
        SmallInteger maxVal hex ==> '16r3FFFFFFF'
        16r4FFFFFF03FFFFFFF class ==> SmallInteger
        16r4FFFFFF040000000 class ==> LargePositiveInteger
        (16r4FFFFFF03FFFFFFF + 1) = 16r4FFFFFF040000000 ==> true

For 64 bit Squeak on 64 bit AMD hardware (note high order bit):
        SmallInteger maxVal hex ==> '16r3FFFFFFF'
        16rFFFFFFF03FFFFFFF class ==> SmallInteger
        16rFFFFFFF040000000 class ==> LargePositiveInteger
        (16rFFFFFFF03FFFFFFF + 1) = 16rFFFFFFF040000000 ==> true

SmallIntegers are still 31 bits in 64 bit Squeak, so this does not
look right. Or am I just misunderstanding something?

I was looking at this because of
        DateAndTime now ==> -4391-03-28T17:46:11+00:00
on 64 bit Squeak, which definitely does not look right.

Dave

Reply | Threaded
Open this post in threaded view
|

VMM fix for 64 bit Squeak (was: Large and small integers on 64 bit Squeak)

David T. Lewis
The attached change set is required for 64 bit Squeak to function
correctly.

This is Ian's implementation of ObjectMemory>>isIntegerValue:.
It is required for 64 bit Squeak. The current shift and XOR approach
does not work for 64 bit images, because it answers true for small
integers outside the range of 31 bit values. Presumably, future
versions of the 64 bit image will extend the range of small integers
but for now the explicit range check in Ian's method is required.

After loading this change and rebuilding the 64 bit VM, integer
arithmetic will work again for both 32 bit and 64 bit images.

Dave

On Sat, Jan 14, 2006 at 09:27:25AM -0500, David T. Lewis wrote:

> For 32 bit Squeak on 32 bit Intel hardware:
> SmallInteger maxVal hex ==> '16r3FFFFFFF'
> 16r3FFFFFFF class ==> SmallInteger
> 16r40000000 class ==> LargePositiveInteger
> 16r3FFFFFFF + 1 = 16r40000000 ==> true
>
> For 64 bit Squeak on 32 bit Intel hardware:
> SmallInteger maxVal hex ==> '16r3FFFFFFF'
> 16r4FFFFFF03FFFFFFF class ==> SmallInteger
> 16r4FFFFFF040000000 class ==> LargePositiveInteger
> (16r4FFFFFF03FFFFFFF + 1) = 16r4FFFFFF040000000 ==> true
>
> For 64 bit Squeak on 64 bit AMD hardware (note high order bit):
> SmallInteger maxVal hex ==> '16r3FFFFFFF'
> 16rFFFFFFF03FFFFFFF class ==> SmallInteger
> 16rFFFFFFF040000000 class ==> LargePositiveInteger
> (16rFFFFFFF03FFFFFFF + 1) = 16rFFFFFFF040000000 ==> true
>
> SmallIntegers are still 31 bits in 64 bit Squeak, so this does not
> look right. Or am I just misunderstanding something?
>
> I was looking at this because of
> DateAndTime now ==> -4391-03-28T17:46:11+00:00
> on 64 bit Squeak, which definitely does not look right.

ObjectMemory-isIntegerValue.cs.gz (766 bytes) Download Attachment