The Trunk: Kernel-nice.962.mcz

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

The Trunk: Kernel-nice.962.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.962.mcz

==================== Summary ====================

Name: Kernel-nice.962
Author: nice
Time: 31 October 2015, 7:24:30.118 pm
UUID: 7437325d-9085-4d61-9960-368cd42f46fe
Ancestors: Kernel-ul.961

Fix DataStream-serialization of SmallInteger in a 64bits spur VM.

DataStream assumes each and every SmallInteger fits in 32bits which is no more true.
If the SmallInteger is out of 32bits VM SmallInteger range, then use a fake LargeInteger.
Also care to re-normalize LageIntegers at materialization time.

=============== Diff against Kernel-ul.961 ===============

Item was added:
+ ----- Method: LargePositiveInteger>>readDataFrom:size: (in category 'objects from disk') -----
+ readDataFrom: aDataStream size: varsOnDisk
+ ^(super readDataFrom: aDataStream size: varsOnDisk) normalize
+ !

Item was added:
+ ----- Method: SmallInteger>>objectForDataStream: (in category 'objects from disk') -----
+ objectForDataStream: refStrm
+ "In a 64bits sput VM, we may have to fake 32bits SmallInteger for compatibility"
+
+ | large |
+ self > 16r37777777 ifTrue: [
+ large := LargePositiveInteger new: self digitLength neg: false.
+ 1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+ ^large].
+ self < -16r40000000 ifTrue: [
+ large := LargeNegativeInteger new: self digitLength neg: true.
+ 1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+ ^large].
+ ^ self
+ !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-nice.962.mcz

Nicolas Cellier


2015-10-31 19:25 GMT+01:00 <[hidden email]>:
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.962.mcz

==================== Summary ====================

Name: Kernel-nice.962
Author: nice
Time: 31 October 2015, 7:24:30.118 pm
UUID: 7437325d-9085-4d61-9960-368cd42f46fe
Ancestors: Kernel-ul.961

Fix DataStream-serialization of SmallInteger in a 64bits spur VM.

DataStream assumes each and every SmallInteger fits in 32bits which is no more true.
If the SmallInteger is out of 32bits VM SmallInteger range, then use a fake LargeInteger.
Also care to re-normalize LageIntegers at materialization time.

=============== Diff against Kernel-ul.961 ===============

Item was added:
+ ----- Method: LargePositiveInteger>>readDataFrom:size: (in category 'objects from disk') -----
+ readDataFrom: aDataStream size: varsOnDisk
+       ^(super readDataFrom: aDataStream size: varsOnDisk) normalize
+       !

Item was added:
+ ----- Method: SmallInteger>>objectForDataStream: (in category 'objects from disk') -----
+ objectForDataStream: refStrm
+       "In a 64bits sput VM, we may have to fake 32bits SmallInteger for compatibility"
+
+       | large |
+       self > 16r37777777 ifTrue: [

Ahem, err...
what's this 7777777 ???
Probably I was thinking of typing seven F so loud that I fooled myself !!!
Let me retry...
 
+               large := LargePositiveInteger new: self digitLength neg: false.
+               1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+               ^large].
+       self < -16r40000000 ifTrue: [
+               large := LargeNegativeInteger new: self digitLength neg: true.
+               1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+               ^large].
+       ^ self
+ !