<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div><br><br>BUT, it doesn&#39;t mean that Association is always used for globals. CompiledMethod equality is failing because of the last literal, the one that maps class name (symbol) and point to the real class. So...when I materialize, both CMs have non-identical associations for the last literal, but equal. <br>

</div></div></blockquote><div><br></div></div></div><div>As Henrik says the last literals are ideally #== to each other.  However, no Squeak dialect makes any attempt to keep the class0side associations equal. Look at a class-side method and you&#39;ll see it&#39;s last literal is nil-&gt;SomeClass class.  Now since this association doesn&#39;t exist in Smalltalk (unlike last literals on the instance side) the compiler merely creates distinct ones for each class-side method.</div>
</div></blockquote><div><br><br>Thanks Eliot for that point. In fact, I have just checked and you are right. The tests that are failing for me is those where class side methods are involded. In this case, the last literal of the original CM and the materialized, gives false in #literalEqual:   hence,  originalCM = materializedCM is false :(<br>
<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote">
<div><br></div><div>Personally I don&#39;t think one can defend the position where method equality is different for instance-side or class-side methods so there must be some solutions:</div><div><br></div><div>1. special case comparison of the last literal (the methodClass literal), comparing keys and insisting that the keys be #== and the values be #== (can&#39;t just define it as keys #== since all similar class-side methods will be equal irrespective of their actual class).</div>

<div><br></div></div></blockquote><div><br>This one seems the easier and fixes my problem :)<br><br>sameLiteralsAs: method<br>    &quot;Compare my literals to those of method. This is needed to compare compiled methods.&quot;<br>
<br>    | numLits literal1 literal2 |<br>    (numLits := self numLiterals) ~= method numLiterals<br>        ifTrue: [ ^ false ].<br>    &quot;The last literal requires special checking instead of using #literalEqual:&quot;<br>
    1 to: numLits - 1 do: [ :index | <br>        literal1 := self literalAt: index.<br>        literal2 := method literalAt: index.<br>        (literal1 == literal2 or: [ literal1 literalEqual: literal2 ])<br>            ifFalse: [ <br>
                (index = 1 and: [ #(117 120) includes: self primitive ])<br>                    ifTrue: [ <br>                        literal1 isArray<br>                            ifTrue: [ <br>                                (literal2 isArray and: [ literal1 allButLast = literal2 allButLast ])<br>
                                    ifFalse: [ self halt. ^ false ] ]<br>                            ifFalse: [ <br>                                &quot;ExternalLibraryFunction&quot;<br>                                (literal1 analogousCodeTo: literal2)<br>
                                    ifFalse: [ self halt. ^ false ] ] ]<br>                    ifFalse: [ <br>                        index = (numLits - 1)<br>                            ifTrue: [ <br>                                &quot;properties&quot;<br>
                                (self properties analogousCodeTo: method properties)<br>                                    ifFalse: [ self halt. ^ false ] ]<br>                            ifFalse: [ self halt. ^ false ] ] ] ].<br>
    literal1 := self literalAt: numLits.<br>    literal2 := method literalAt: numLits.<br>    ^ ((literal1 key == literal2 key) and: [literal1 value == literal2 value]).<br><br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div></div><div>2. special case comparison of the last literal (the methodClass literal), insisting only that the class of the literal be the same if it isVariableBinding.</div><div><br></div><div>
3. make the compile unique class-side methodClass literals.  i.e. if a class already has a class-side method then the compiler or method dictionary insertion code must find that existing association and reuse it</div>
<div><br></div><div>Other ideas?</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div>
&gt;From my point of view, that literal, the last one does not need to be identical to assume 2 CMs are equal. They just need to be equal. <br></div></div><div><div></div><div><br clear="all"><br>-- <br>Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>
<br>
</div></div></blockquote></div></div><font color="#888888"><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>
</font><br><br>
<br></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>