[Vm-dev] A BlockClosure optimization

Igor Stasenko siguctua at gmail.com
Sun May 16 10:51:05 UTC 2010


Heck..
i implemented it,
but can't bencth it for real :(

My image contains a mix of underscore assignments and
underscore selectors.. and recompiling everything automatically will fail.

I tried to it in Pharo image, since its having a consistent policy
with underscores,
but there's another thing: it missing an optimizedMessageNode in
BlockNode class,
which i used to test if block sits inside a loop :(
Strange, i thought that both Pharo and Squeak using same compiler.

I attached changeset, maybe you having an image where full recompile
can be run? :)

You can simply do:
Preferences enable: #optimizeClosuresInLoops.
And then recompile the system.

Or use:
ClosureLoopPushTest new bench "print it"

I found that in my image, there's only 269 closures (in various
methods), affected by this optimization.
This number can be increased by using more advanced heuristics, which
you suggested,
but i'm a bit busy to continue on it now.


On 16 May 2010 08:41, Igor Stasenko <siguctua at gmail.com> wrote:
> And here's a plan, what i wanna try to do, when analysing the block node:
>
> - if block node is inlined,
> - check if it having loops (whileTrue/whileFalse)
> - check if inside a loop it having a closure
> - for any of such closures, define a temp in a block node's scope
> (which has to be the scope of outer block, since our block is inlined)
> - replace a closure blockNode in AST tree with nodes equivalent to a
> following: (temp ifNil: [ temp := <closure blockNode> ])
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



-- 
Best regards,
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: closure-in-loop.2.cs
Type: application/octet-stream
Size: 12126 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100516/f8a06d2c/closure-in-loop.2.obj


More information about the Vm-dev mailing list