<br><br><div class="gmail_quote">On Sun, Sep 26, 2010 at 4:45 AM, stephane ducasse <span dir="ltr"><<a href="mailto:stephane.ducasse@gmail.com">stephane.ducasse@gmail.com</a>></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: ' Have various places check for isOopCOmpiledMethod:<br>
rather than isCompiledMethod: to allow SmallIntegers to be used as methods.'<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) >= 12</div>
<div><br></div><div>So in practice it's not an issue; presumably no-one is using SmallIntegers as methods ("Doctor it hurts when I..."). 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>
><br>
><br>
> Name: VMMaker-oscog.33<br>
> Author: eem<br>
> Time: 25 September 2010, 7:13:51 am<br>
> UUID: 733b7c50-b973-4ca0-9831-5c84d09032bf<br>
> Ancestors: VMMaker-oscog.32<br>
><br>
> OSCogVM:<br>
> Support object-as-method:<br>
> Eagerly evaluate the interpreter version of a primitive<br>
> to ease the object-as-method implementation and to<br>
> improve interpreter performance.<br>
> Refuse to enter anything that isn't a CompiledMethod<br>
> into the method-lookup cache to avoid open PICs having<br>
> to check for valid compiled methods.<br>
> Have various places check for isOopCOmpiledMethod:<br>
> rather than isCompiledMethod: to allow SmallIntegers to<br>
> be used as methods.<br>
> Interpreter:<br>
> Have various places check for isOopCOmpiledMethod:<br>
> rather than isCompiledMethod: to allow SmallIntegers to<br>
> be used as methods.<br>
> Slang:<br>
> support super sends by expanding them at translation<br>
> time. This allows CoInterpreter>>addMethodToCache<br>
> to avoid cacheing non-compiled methods via a super<br>
> send, avoiding duplicating SrackInterpreter's method.<br>
><br>
<br>
</div></div></blockquote></div><br>