Hi Igor. Does the same test work correctlly in a interpreter VM?  because I can see:<br><br>ObjectMemory &gt;&gt; newObjectHash<br>    &quot;Answer a new 16-bit pseudo-random number for use as an identity hash.&quot;<br><br>
    lastHash := 13849 + (27181 * lastHash) bitAnd: 65535.<br>    ^ lastHash<br><br><br>In which case, it seems that every new hash will be different than the previous one.<br><br>But NewObjectMemory &gt;&gt; newObjectHash<br>
    &quot;Derive the new object hash from the allocation pointer.  This is less costly than<br>     using lastHash because it avoids the read-modify-write cycle to update lastHash.<br>     Since the size of eden is a power of two and larger than the hash range this provides<br>
     a well-distributed and fairly random set of values.&quot;<br>    &lt;inline: true&gt;<br>    ^freeStart &gt;&gt; BytesPerWord<br><br>so...I have no idea, but maybe for two consequently allocated objects, the instVar freeStart can remain with the same value ?<br>
<br><br><br><div class="gmail_quote">On Mon, Aug 1, 2011 at 8:43 AM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I found that #testBecomeIdentityHash sometimes failing, sometimes not.<br>
<br>
It seems like VM &#39;forgets&#39; to produce different identityHash bits for<br>
two consequently allocated objects,<br>
while test assumes that they are always different.<br>
<br>
If i insert a statement (see the code), test no longer fails.<br>
<br>
testBecomeIdentityHash<br>
        &quot;Note. The identity hash of both objects seems to change after the become:&quot;<br>
<br>
        | a b c d |<br>
<br>
        a := &#39;ab&#39; copy.<br>
        b := &#39;cd&#39; copy.<br>
<br>
&gt;&gt;&gt;     [ b identityHash = a identityHash ] whileTrue: [ b := b copy ].<br>
<br>
        c := a.<br>
        d := b.<br>
<br>
        a become: b.<br>
<br>
        self<br>
                assert: a identityHash = c identityHash;<br>
                assert: b identityHash = d identityHash;<br>
                deny: a identityHash = b identityHash.<br>
<br>
A simple piece of code reveals the problem:<br>
<br>
(1 to: 20) collect: [:i |<br>
        &#39;ab&#39; copy basicIdentityHash ] #(954 954 955 955 956 956 957 957 958<br>
958 959 959 960 960 961 961 962 962 963 963)<br>
<font color="#888888"><br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>