<br><br><div class="gmail_quote">On Sun, Sep 26, 2010 at 1:15 PM, 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>
should I conclude that before your change even the default old vm would crash when we put a SmallInteger in a methodDict?<br></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Because if I would have know I would not ask my question. I thought it was for something else you had in mind.<br>
<br>
Stef<br>
<div><div></div><div class="h5"><br>
><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>
><br>
> Looking at the code for the standard Interpreter, if anyone tried<br>
><br>
> self class addSelector: #foo withMethod: 0.<br>
> self foo.<br>
><br>
> 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:<br>
><br>
> isOopCompiledMethod: oop<br>
> ^(self isNonIntegerObject: oop) and: [self isCompiledMethod: oop]<br>
><br>
> isCompiledMethod: obj<br>
> ^(self formatOf: obj) >= 12<br>
><br>
> 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).<br>
><br>
><br>
<br>
</div></div></blockquote></div><br>