[squeak-dev] identityHash bits not incremented for new objects?
Igor Stasenko
siguctua at gmail.com
Mon Aug 1 06:43:53 UTC 2011
I found that #testBecomeIdentityHash sometimes failing, sometimes not.
It seems like VM 'forgets' to produce different identityHash bits for
two consequently allocated objects,
while test assumes that they are always different.
If i insert a statement (see the code), test no longer fails.
testBecomeIdentityHash
"Note. The identity hash of both objects seems to change after the become:"
| a b c d |
a := 'ab' copy.
b := 'cd' copy.
>>> [ b identityHash = a identityHash ] whileTrue: [ b := b copy ].
c := a.
d := b.
a become: b.
self
assert: a identityHash = c identityHash;
assert: b identityHash = d identityHash;
deny: a identityHash = b identityHash.
A simple piece of code reveals the problem:
(1 to: 20) collect: [:i |
'ab' copy basicIdentityHash ] #(954 954 955 955 956 956 957 957 958
958 959 959 960 960 961 961 962 962 963 963)
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|