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 >> #at:put:<br>
But before this change, this crashes because of the send to #primitiveIndexOf:<br>But since now #primitiveIndexOf: is working, #primitiveFlushCacheByMethod doesn'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"><<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>></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 "fix/patch" it by chaging primitiveIndexOf: to this:<br><br>primitiveIndexOf: methodPointer<br> "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."<br> <api><br> | primBits |<br> <br> (objectMemory isOopCompiledMethod: methodPointer)<br> ifTrue:<br> [primBits := ((self headerOf: methodPointer) >> 1) bitAnd: 16r100001FF.<br>
^(primBits bitAnd: 16r1FF) + (primBits >> 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"><<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>></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 "Development". However, if I compile with "Deployment", it doesn't crash....<br>
<br>The code is this:<br><br>SmallInteger compile: 'flushCache "emtpy"'.<br>SmallInteger compile: 'run: aSelector with: arguments in: aReceiver<br> Transcript show: ''something''.'.<br>
TestCase compile: 'foo ^ ''foo'' '.<br><br>TestCase methodDict at: #foo put: 5.<br>TestCase new foo. <br><br><br>I really don't understand how this can work in "Deployment" but not in "Development" 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>