c***@source.squeak.org
00001126 03:36:00 UTC
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kerneleem.1198.mcz
==================== Summary ====================
Name: Kerneleem.1198
Author: eem
Time: 24 November 2018, 1:44:47.526422 pm
UUID: 100137c425144b7f90643dcdfe7d8cc9
Ancestors: Kerneleem.1197
Redefine LargePositiveInteger hash for compatibility between 32bit and 64bit systems.
=============== Diff against Kerneleem.1197 ===============
Item was changed:
 Method: LargePositiveInteger>>hash (in category 'comparing') 
hash
+ "Answer an integer value that is related to the value of the receiver.
+ Take care that the hash value is the same in both 32bit and 64bit versions.
+ Since the integers are by definition perfectly distributed a SmallInteger's hash is itself
+ (it is impossible to derive a hash function that is better distributed than the SmallIntegers
+ themselves). Therefore, for integers that could possibly fit in the SmallInteger range, answer
+ self. For values well outside of the SmallInteger range on 64bits answer a hash that avoids
+ large integer arithmetic."
+ ^self digitLength <= 8
+ ifTrue: [self]
+ ifFalse:
+ [ByteArray
+ hashBytes: self
+ startingWith: self species hash]!

 ^ByteArray
 hashBytes: self
 startingWith: self species hash!
Item was changed:
 Method: SmallInteger>>hash (in category 'comparing') 
hash
+ "Answer an integer value that is related to the value of the receiver.
+ Since the integers are by definition perfectly distributed answer self
+ (it is impossible to derive a hash function that is better distributed
+ than the SmallIntegers themselves). c.f. LargePositiveInteger hash."
^self!
Item was changed:
(PackageInfo named: 'Kernel') postscript: '"below, add code to be run after the loading of this package"
+ "Since Kerneleem.1198 redefines LargePositiveInteger hash,
+ rehash all hashed collections that contain hashed large integers."
+ HashedCollection allSubclassesDo:
+ [:c  f 
+ f := (c includesBehavior: Set)
+ ifTrue: [[:i i]]
+ ifFalse: [[:i i keys]].
+ c allInstancesDo:
+ [:h
+ ((f value: h) detect: [:e e isInteger and: [e class ~~ SmallInteger]] ifNone: nil) ifNotNil:
+ [h halt rehash]]]'!
 ((ByteArray subclasses includes: CompiledMethod)
 and: [CompiledMethod superclass ~= ByteArray]) ifTrue:
 [ByteArray removeSubclass: CompiledMethod].
 (Smalltalk classNamed: #FullBlockClosure) ifNotNil:
 [:fbc
 (fbc identityHash ~= 38) ifTrue:
http://source.squeak.org/trunk/Kerneleem.1198.mcz
==================== Summary ====================
Name: Kerneleem.1198
Author: eem
Time: 24 November 2018, 1:44:47.526422 pm
UUID: 100137c425144b7f90643dcdfe7d8cc9
Ancestors: Kerneleem.1197
Redefine LargePositiveInteger hash for compatibility between 32bit and 64bit systems.
=============== Diff against Kerneleem.1197 ===============
Item was changed:
 Method: LargePositiveInteger>>hash (in category 'comparing') 
hash
+ "Answer an integer value that is related to the value of the receiver.
+ Take care that the hash value is the same in both 32bit and 64bit versions.
+ Since the integers are by definition perfectly distributed a SmallInteger's hash is itself
+ (it is impossible to derive a hash function that is better distributed than the SmallIntegers
+ themselves). Therefore, for integers that could possibly fit in the SmallInteger range, answer
+ self. For values well outside of the SmallInteger range on 64bits answer a hash that avoids
+ large integer arithmetic."
+ ^self digitLength <= 8
+ ifTrue: [self]
+ ifFalse:
+ [ByteArray
+ hashBytes: self
+ startingWith: self species hash]!

 ^ByteArray
 hashBytes: self
 startingWith: self species hash!
Item was changed:
 Method: SmallInteger>>hash (in category 'comparing') 
hash
+ "Answer an integer value that is related to the value of the receiver.
+ Since the integers are by definition perfectly distributed answer self
+ (it is impossible to derive a hash function that is better distributed
+ than the SmallIntegers themselves). c.f. LargePositiveInteger hash."
^self!
Item was changed:
(PackageInfo named: 'Kernel') postscript: '"below, add code to be run after the loading of this package"
+ "Since Kerneleem.1198 redefines LargePositiveInteger hash,
+ rehash all hashed collections that contain hashed large integers."
+ HashedCollection allSubclassesDo:
+ [:c  f 
+ f := (c includesBehavior: Set)
+ ifTrue: [[:i i]]
+ ifFalse: [[:i i keys]].
+ c allInstancesDo:
+ [:h
+ ((f value: h) detect: [:e e isInteger and: [e class ~~ SmallInteger]] ifNone: nil) ifNotNil:
+ [h halt rehash]]]'!
 ((ByteArray subclasses includes: CompiledMethod)
 and: [CompiledMethod superclass ~= ByteArray]) ifTrue:
 [ByteArray removeSubclass: CompiledMethod].
 (Smalltalk classNamed: #FullBlockClosure) ifNotNil:
 [:fbc
 (fbc identityHash ~= 38) ifTrue: