[Vm-dev] headerTypeBytes oddity

Eliot Miranda eliot.miranda at gmail.com
Thu Feb 19 02:10:16 UTC 2009


On Wed, Feb 18, 2009 at 5:09 AM, Igor Stasenko <siguctua at gmail.com> wrote:

>
> A headerTypeBytes ivar used in Interpreter, but initialized only once
> during its lifetime - in readImageFromFile: f HeapSize:
> desiredHeapSize StartingAt: imageOffset),
> and with same constants:
>
>        headerTypeBytes at: 0 put: BytesPerWord * 2.            "3-word
> header (type 0)"
>        headerTypeBytes at: 1 put: BytesPerWord.                "2-word
> header (type 1)"
>        headerTypeBytes at: 2 put: 0.
> "free chunk (type 2)"
>        headerTypeBytes at: 3 put: 0.
> "1-word header (type 3)"
>
> I think this initialization could be put into static var declaration,
> in #declareCVarsIn:
>        aCCodeGenerator
>                var: #headerTypeBytes
>                declareC: 'static sqInt headerTypeBytes[4] = { blablabla}'.


Make this  declareC: 'static const sqInt headerTypeBytes[4] = { blablabla}'
                                         ^^^^^

>
>
> then we don't have to pollute already complex #readImageFromFile:...
> method with odd stuff like this.
>
> It maybe not worth much attention for Squeak VM, but for Hydra, i
> found that this ivar placed into Interpreter struct (which means that
> each instance of interpreter will having separate  headerTypeBytes).
> There are tons of ivars in ObjectMemory and Interpreter and its hard
> to track all, which worth keeping on a per-interpreter basis :)
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20090218/b24bd00e/attachment-0001.htm


More information about the Vm-dev mailing list