[Vm-dev] ImageSegment, objects header and addresses

Mariano Martinez Peck marianopeck at gmail.com
Tue Jul 27 14:32:29 UTC 2010


Hi guys. There is something I still don't understand about ImageSegment
hahaha. But each time there is less :)

There is a place in ImageSegment >> copyObj: oop toSegment: segmentWordArray
addr: lastSeg stopAt: stopAddr saveOopAt: oopPtr headerAt: hdrPtr
where it does this:

    self forward: oop to: (lastSeg+BytesPerWord + extraSize -
segmentWordArray)
        savingOopAt: oopPtr andHeaderAt: hdrPtr.


Basically, it forwards oop to another address which is actually the offset
inside the segment. And it backups the original oop and the hader, as you
can see here:

Interpreter >> forward: oop to: newOop savingOopAt: oopPtr andHeaderAt:
hdrPtr

    "Make a new entry in the table of saved oops."
    self longAt: oopPtr put: oop.                    "Save the oop"
    self longAt: hdrPtr put: (self longAt: oop).    "Save the old header
word"

    "Put a forwarding pointer in the old object, flagged with forbidden
header type"
    self longAt: oop put: newOop + HeaderTypeFree.


Now....the line I don't understand is this:

    self longAt: oop put: newOop + HeaderTypeFree.

Because 'self longAt: oop'
will answer the object header of oop. And there, it stores a number (the
offset). Is this possible?

In addition, it not only stores the offset, by it plus the flag
HeaderTypeFree.

I really don't understand how you can plus an offset and the flag. What is
the result? how should I interpret that?

Thanks for any hint you can give me.

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


More information about the Vm-dev mailing list