<br><br><div class="gmail_quote">On Sun, Sep 26, 2010 at 4:45 AM, stephane ducasse <span dir="ltr">&lt;<a href="mailto:stephane.ducasse@gmail.com">stephane.ducasse@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;">
<br>
Eliot<br>
<br>
I wanted to understand what: &#39;  Have various places check for isOopCOmpiledMethod:<br>
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.&#39;<br>
means<br>
        in which circumstances do we want to have smalltalkIntegers used as methods?<br>
        when we put an object instead of a compiled method and that by accident this is an integer?<br></blockquote><div><br></div><div>Looking at the code for the standard Interpreter, if anyone tried</div><div><br></div>
<div>    self class addSelector: #foo withMethod: 0.</div><div>    self foo.</div><div><br></div><div>then the VM would crash trying to determine if 0 was a compiled method because the VM uses isCompiledMethod: and isCompiledMethod: does not (and should not, because it is used elsewhere) guard against a tagged object.  isOopCompiledMethod: does guard against a tagged object:</div>
<div><br></div><div>isOopCompiledMethod: oop</div><div>    ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]</div><div><br></div><div>isCompiledMethod: obj</div><div>    ^(self formatOf: obj) &gt;= 12</div>
<div><br></div><div>So in practice it&#39;s not an issue; presumably no-one is using SmallIntegers as methods (&quot;Doctor it hurts when I...&quot;).  But if the VM provides a facility it is nice for it to provide that facility robustly (if there is no significant impact on performance).</div>
<div><br></div><div>HTH</div><div>Eliot</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Stef<br>
<div><div></div><div class="h5"><br>
<br>
&gt;<br>
&gt;<br>
&gt; Name: VMMaker-oscog.33<br>
&gt; Author: eem<br>
&gt; Time: 25 September 2010, 7:13:51 am<br>
&gt; UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf<br>
&gt; Ancestors: VMMaker-oscog.32<br>
&gt;<br>
&gt; OSCogVM:<br>
&gt;  Support object-as-method:<br>
&gt;       Eagerly evaluate the interpreter version of a primitive<br>
&gt;       to ease the object-as-method implementation and to<br>
&gt;       improve interpreter performance.<br>
&gt;       Refuse to enter anything that isn&#39;t a CompiledMethod<br>
&gt;       into the method-lookup cache to avoid open PICs having<br>
&gt;       to check for valid compiled methods.<br>
&gt;       Have various places check for isOopCOmpiledMethod:<br>
&gt;       rather than isCompiledMethod: to allow SmallIntegers to<br>
&gt;       be used as methods.<br>
&gt; Interpreter:<br>
&gt;       Have various places check for isOopCOmpiledMethod:<br>
&gt;       rather than isCompiledMethod: to allow SmallIntegers to<br>
&gt;       be used as methods.<br>
&gt; Slang:<br>
&gt;       support super sends by expanding them at translation<br>
&gt;       time.  This allows CoInterpreter&gt;&gt;addMethodToCache<br>
&gt;       to avoid cacheing non-compiled methods via a super<br>
&gt;       send, avoiding duplicating SrackInterpreter&#39;s method.<br>
&gt;<br>
<br>
</div></div></blockquote></div><br>