[squeak-dev] The Trunk: Kernel-eem.1410.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Sep 13 05:24:22 UTC 2021
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1410.mcz
==================== Summary ====================
Name: Kernel-eem.1410
Author: eem
Time: 12 September 2021, 10:24:18.099359 pm
UUID: 80f1546b-b2a1-4ffb-a174-d21d2eb2eb67
Ancestors: Kernel-ul.1409
Since Compiledmethod>>= is true if method classes differ, a COmpiledMethod's hash must not tae methodClass into account.
=============== Diff against Kernel-ul.1409 ===============
Item was changed:
----- Method: CompiledCode>>hash (in category 'comparing') -----
hash
"CompiledMethod>>#= compares code, i.e. same literals and same bytecode.
So we look at the header, methodClass and some bytes between initialPC and endPC,
but /not/ the selector because the equal method does not compare selectors.
Note that we must override ByteArray>hash which looks at all bytes of the receiver.
+ Using bytes from the pointer part of a CompiledMethod can lead to a variable hash
- Using bytes from the pointer part of a COmpiledmethod can lead to a variable hash
if and when when the GC moves literals in the receiver."
| initialPC endPC hash |
initialPC := self initialPC.
endPC := self endPC.
+ hash := self species hash + self header + initialPC + endPC bitAnd: 16rFFFFFFF.
- hash := self species hash + self header + initialPC + endPC + self methodClass hash bitAnd: 16rFFFFFFF.
"sample approximately 20 bytes"
initialPC to: endPC by: (endPC - initialPC // 20 max: 1) do:
[:i| hash := hash + (self at: i)].
^hash
"(CompiledMethod>>#hash) hash"!
More information about the Squeak-dev
mailing list
|