<br><br><div class="gmail_quote">On Fri, Dec 3, 2010 at 3:41 PM, 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 folks. After fighting and fighting about crashes using SmallInteger as methods, I finally could debug the VM (thanks Esteban for the help in compiling and debugging!!) and I think I found a problem in theGC.<br>In the mark phase of the GC, it tries to mark all interpreter oops in the method:  markAndTraceInterpreterOops<br>

<br>If you see that method....it does this (a part of it):<br><br>compilerInitialized<br>        ifTrue: [self markAndTrace: receiver.<br>           <span style="background-color: rgb(255, 255, 51);"> self markAndTrace: method]</span><br>

        ifFalse: [self markAndTrace: activeContext].<br>    self markAndTrace: messageSelector.<br>   <span style="background-color: rgb(255, 255, 0);"> self markAndTrace: newMethod.</span><br><br>If you are using SmallInteger as methods.....newMethod can be a SmallIneteger, and not a method....so if we then see the method markAndTrace:<br>

<br>the first lines are:<br><br>    | header lastFieldOffset action statMarkCountLocal |<br>    header := self longAt: oop.<br><br><br>And of course, it crash in that #longAt:<br><br>:)<br><br>So, solutions:<br><br>1) Put an if in each place where it uses newMethod or method or newNativeMethod or suspendedMethods  or whatever<br>

2) Put an if in #markAndSweep.<br><br>I think 2) is easier and it is just adding one line of code at the beginning:<br><br>    | header lastFieldOffset action statMarkCountLocal |<br>  <span style="background-color: rgb(255, 255, 0);">  (self isIntegerObject: oop) ifTrue: [ ^ 0 ].</span><br>

    header := self longAt: oop.<br>....<br><br>what do you think ?<br><br><br>Finally, I am afraid that there are more places where Interpreter uses any of those instVar that represent methods, and treat them as real objects.<br>

So maybe there still pending future possible crashes?<br><br></blockquote><div><br><br>For example, take a look to the methods:<br><br>printUnbalancedStackFromNamedPrimitive<br>primitiveMethod<br>internalJustActivateNewMethod<br>
internalActivateNewMethod<br>activateNewMethod<br><br>And all the senders of <br><br>literal: offset ofMethod: methodPointer<br>literalCountOf: methodPointer<br>primitiveIndexOf:<br><br>maybe supporting SmallInteger as methods was not a good idea :(<br>
<br>cheers<br><br>mariano<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thanks<br><font color="#888888"><br>Mariano<br>
</font></blockquote></div><br>