[Vm-dev] [COG] primitiveIndexOf: aMethod crash in Cog when using SmallInteger

Mariano Martinez Peck marianopeck at gmail.com
Tue Dec 14 09:19:04 UTC 2010

Hi Eliot. I am not sure if you are interested in completly support
SmallInteger as methods. If not, please let me know and I don't bather

I was trying them in Cog, and I have a crash in
primitiveFlushCacheByMethod()  when it calls primitiveIndexOf:

primitiveIndexOf: methodPointer
    "Note: We now have 10 bits of primitive index, but they are in two
    for temporary backward compatibility.  The time to unpack is negligible,
     since the derived primitive function pointer is stored in the method
    | primBits |
    primBits := ((self headerOf: methodPointer) >> 1) bitAnd: 16r100001FF.
    ^(primBits bitAnd: 16r1FF) + (primBits >> 19)

But....."methodPointer" can be a Smallnteger...so headerOf: fails, because
rawHeaderOf: fails because it does a "objectMemory fetchPointer: HeaderIndex
ofObject: methodPointer"
which send ObjectMemory >> fetchPointer: fieldIndex ofObject: oop
which does the final  "self longAt: oop + BaseHeaderSize + (fieldIndex <<

ok, you got it ;)

Now....do you consider this a bug?  how could I fix it ?


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

More information about the Vm-dev mailing list