[Vm-dev] SmallInetger as methods was not ready yet....now maybe?

Mariano Martinez Peck marianopeck at gmail.com
Fri Dec 3 14:41:42 UTC 2010

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.
In the mark phase of the GC, it tries to mark all interpreter oops in the
method:  markAndTraceInterpreterOops

If you see that method....it does this (a part of it):

        ifTrue: [self markAndTrace: receiver.
            self markAndTrace: method]
        ifFalse: [self markAndTrace: activeContext].
    self markAndTrace: messageSelector.
    self markAndTrace: newMethod.

If you are using SmallInteger as methods.....newMethod can be a
SmallIneteger, and not a method....so if we then see the method

the first lines are:

    | header lastFieldOffset action statMarkCountLocal |
    header := self longAt: oop.

And of course, it crash in that #longAt:


So, solutions:

1) Put an if in each place where it uses newMethod or method or
newNativeMethod or suspendedMethods  or whatever
2) Put an if in #markAndSweep.

I think 2) is easier and it is just adding one line of code at the

    | header lastFieldOffset action statMarkCountLocal |
    (self isIntegerObject: oop) ifTrue: [ ^ 0 ].
    header := self longAt: oop.

what do you think ?

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.
So maybe there still pending future possible crashes?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101203/ec2a81cf/attachment.htm

More information about the Vm-dev mailing list