[Vm-dev] frameless instance initialization

Clément Bera bera.clement at gmail.com
Fri Apr 24 08:19:32 UTC 2015


I think what you want Eliot is not necessarily related to frameless methods.

I think what you want is that if there are several storeChecks in the same
object in-between two interrupt points, which could be several inst var
store or several inlined at: put: on the same object, you want to merge the
storeCheck logic so it's done in one place instead of multiple.

In the case of frameless methods, there are no interrupt points, so it
works for the whole method. However, I don't see why the technique would
not apply if you write code such as:

foo: arg1
    "any code here that may include sends or anything"
    instVar1 := 1.
    instVar2 := arg1.
    instVar3 := #bar.
    "any code here that may include sends or anything"

In this case you can merge the store check for the 3 inst var as it's done
in between two interrupt points.

Currently, for each instVar store, the process is:
- is the value stored a immediate ?
- is the object holding the instVar young ?
- is the value stored old ?
- is the object holding the instVar already remembered ?
If all 4 are false, the object holding the instVar needs to be added in the
remembered table.

And I guess the 2 tests on the object holding the inst var, 2 out of 4,
could be done only once.

In the future I guess that the write barrier will be more important because
of the tricolor marking GC. As far as I understood, we'll have to check in
addition if the object and the value are not black & white or white &
black, in which case we need to color one of the operands to gray. So I
guess an improvement there may be valuable.



2015-04-24 8:05 GMT+02:00 stephane ducasse <stephane.ducasse at gmail.com>:

>
> Hi eliot
>
>
> > Hi All,
> >
> >     here's a challenge.  Currently the JIT is naive about a sequence of
> inst var assignments.  It treats assignment separately, each getting its
> own copy of the store check.  For example when initializing an Interval via:
> >
> > setFrom: startInteger to: stopInteger by: stepInteger
> >
> >       start := startInteger.
> >       stop := stopInteger.
> >       step := stepInteger
>
>
> Is this pattern frequent?
> Because it was proposed by K. Beck but do people use it?
> Especially now with automatic invocation of initialize, we often have
>
>         start := startInteger.
> >      stop := stopInteger.
> >      step := stepInteger
>         self do.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150424/08d54b88/attachment.htm


More information about the Vm-dev mailing list