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>Thanks<br><br>Mariano<br>