On Sat, Nov 24, 2018 at 3:14 PM Levente Uzonyi <leves@caesar.elte.hu> wrote:
On Sat, 24 Nov 2018, commits@source.squeak.org wrote:

> Eliot Miranda uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-eem.1198.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-eem.1198
> Author: eem
> Time: 24 November 2018, 1:44:47.526422 pm
> UUID: 100137c4-2514-4b7f-9064-3dcdfe7d8cc9
> Ancestors: Kernel-eem.1197
>
> Redefine LargePositiveInteger hash for compatibility between 32-bit and 64-bit systems.
>
> =============== Diff against Kernel-eem.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 32-bit and 64-bit 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 64-bits 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 Kernel-eem.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]]]'!

Is there a reason for that #halt to be there?

Damn. I was debugging the script to make sure it would work (there are no such dictionaries or sets in a normal image), and I forgot to remove the halt.  I shall submit a new version...
 

Levente

> - ((ByteArray subclasses includes: CompiledMethod)
> -  and: [CompiledMethod superclass ~= ByteArray]) ifTrue:
> -     [ByteArray removeSubclass: CompiledMethod].
> - (Smalltalk classNamed: #FullBlockClosure) ifNotNil:
> -     [:fbc|
> -     (fbc identityHash ~= 38) ifTrue:
> -             [fbc tryPrimitive: 161 withArgs: #(38 true)]]'!



--
_,,,^..^,,,_
best, Eliot