And this change in  #primitiveIndexOf:<br>also fixes the #flushCache in SmallInteger.<br><br>Because if you use SmallInteger as methods, you need to implement #flushCache because it is used in MethodDIctionary &gt;&gt; #at:put:<br>
But before this change, this crashes because of the send to #primitiveIndexOf:<br>But since now #primitiveIndexOf: is working, #primitiveFlushCacheByMethod  doesn&#39;t fail anymore with SmallInteger  :)<br><br><br>Cheers<br>
<br>Mariano<br><br><div class="gmail_quote">On Fri, Dec 17, 2010 at 11:01 AM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Eliot. I &quot;fix/patch&quot; it by chaging primitiveIndexOf:   to this:<br><br>primitiveIndexOf: methodPointer<br>    &quot;Note: We now have 10 bits of primitive index, but they are in two places<br>    for temporary backward compatibility.  The time to unpack is negligible,<br>

     since the derived primitive function pointer is stored in the method cache.&quot;<br>    &lt;api&gt;<br>    | primBits |<br>    <br>    (objectMemory isOopCompiledMethod: methodPointer)<br>        ifTrue:<br>            [primBits := ((self headerOf: methodPointer) &gt;&gt; 1) bitAnd: 16r100001FF.<br>

            ^(primBits bitAnd: 16r1FF) + (primBits &gt;&gt; 19)]<br>        ifFalse:<br>            [^ 0 ].<br><br><br>at least for my case, it patches the problem. Still, I have no idea:<br><br>- the implicance/side effect of this change<br>

- why in development was crashing but not in deployment.<br><br>thanks<br><font color="#888888"><br>mariano</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Thu, Dec 16, 2010 at 5:27 PM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Eliot. Today I can reproduce a do-it that crash Cog, when using SmallIntegers as compiled methods. The problem is actually that IT ONLY crashes when compiling in XCode with &quot;Development&quot;. However, if I compile with &quot;Deployment&quot;, it doesn&#39;t crash....<br>


<br>The code is this:<br><br>SmallInteger compile: &#39;flushCache &quot;emtpy&quot;&#39;.<br>SmallInteger compile: &#39;run: aSelector with: arguments in: aReceiver<br>    Transcript show: &#39;&#39;something&#39;&#39;.&#39;.<br>


TestCase compile: &#39;foo  ^ &#39;&#39;foo&#39;&#39; &#39;.<br><br>TestCase methodDict at: #foo put: 5.<br>TestCase new foo.  <br><br><br>I really don&#39;t understand how this can work in &quot;Deployment&quot; but not in &quot;Development&quot; since the code is the same as I know. Maybe when debugging certain functions/methods are called that crash? <br>


<br>Thanks for any tip.<br><font color="#888888"><br>Mariano<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br>