<br><br><div class="gmail_quote">On Mon, Nov 17, 2008 at 4:11 PM, 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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="Wj3C7c"><br>
<br>
</div></div>The only cause of this can be compiler.<br>
Instead of generating an instruction for sending #class message, it<br>
generates a bytecode to fetch the class from receiver oop , instead of<br>
sending real message.<br>
</blockquote><div><br>Yes, the Compiler and Smalltalk bytecode set is doing this. I need this change too at some stage, so I&#39;ve spent some time on it.<br><br>See this: <a href="http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_chapter28.html">http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_chapter28.html</a><br>
</div></div><br>The send bytecode in question is decimal 199. This pushes the receiver&#39;s class on the stack, no questions asked.<br><br>I&#39;ve looked at modifying the compiler, but I&#39;m finding it to be a daunting piece of software.<br>
<br>The send bytecode is written to the compiled method stream in SelectorNode&gt;&gt;emit:args:on:super: at the top of the method as a &quot;short send&quot;. <br><br>The SelectorNode instance is initialised as a shared class variable called &quot;StdSelectors&quot; in VariableNode&gt;&gt;initialize. As you can see there, its values are retrieved from the SystemDictionary. Once initialised as a class variable, it is again copied in Encoder&gt;&gt;initScopeAndLiteralTables.<br>
<br>So the special selectors array lives in the SystemDictionary&#39;s special objects array in slot 24, meaning that the VM also refers to these selectors. I&#39;m not sure why the VM wants them.<br><br>As with fixing this, I guess that replacing the value in the special selectors array and then running VariableNode&gt;&gt;initialize might do the trick. Or it might crash the VM.<br>
<br>Gulik.<br clear="all"><br>-- <br><a href="http://people.squeakfoundation.org/person/mikevdg">http://people.squeakfoundation.org/person/mikevdg</a><br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a><br>