<br><br><div class="gmail_quote">On Fri, Dec 3, 2010 at 6:42 PM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@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;">
<div><div></div><div class="h5"><br>
On 3 December 2010 16:58, Mariano Martinez Peck <<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Fri, Dec 3, 2010 at 3:41 PM, Mariano Martinez Peck <<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>> wrote:<br>
>><br>
>> 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>
>> self markAndTrace: method]<br>
>> ifFalse: [self markAndTrace: activeContext].<br>
>> self markAndTrace: messageSelector.<br>
>> self markAndTrace: newMethod.<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>
>> (self isIntegerObject: oop) ifTrue: [ ^ 0 ].<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>
><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>
</div></div>no, but these methods usually should be fired only after you already<br>
determined that given oop is a compiled method,<br>
not a smallinteger or something else.<br>
<div class="im"><br></div></blockquote><div><br>But they do not. Let's take an example: literal: offset ofMethod: methodPointer<br>sender: methodClassOf: methodPointer<br>sender: superclassSend<br>sender: doubleExtendedDoAnythingBytecode and singleExtendedSuperBytecode<br>
<br>did I miss something?<br><br><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;"><div class="im">
> maybe supporting SmallInteger as methods was not a good idea :(<br>
><br>
</div>it should work.<br>
<br>
> cheers<br>
><br>
> mariano<br>
><br>
><br>
>><br>
>> Thanks<br>
>><br>
>> Mariano<br>
><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
</font></blockquote></div><br>