[Newcompiler] Implementing bytecode for closur
Marcus Denker
denker at iam.unibe.ch
Thu Apr 26 12:47:40 UTC 2007
On 26.04.2007, at 14:04, Mathieu Suen wrote:
> Hi,
>
> I have implement a bytecode to push the closure environment.
> So instead of this peace of bytecode:
>
> pushThisContext
> pushConstant: 5
> send: privGetInstVar:
>
> You get:
>
> pushClosureEnvironment
>
> I have run benchmark and it result that the system was running 16%
> faster.
>
Very cool :-)
> I think we should use other bytecode like pushTemp/storeTamp which
> would store/pop variable directly from the closure environment.
> At the end we should be close to the performance to the NewCompiler
> without closure performance.
The other thing that makes the code slower is "closure activiation",
that is, just doing a "aBlockClosure value".
Closures in the ClosureCompiler are objects that reference code (a
compiledMethod) and the environment. Value is this:
value
"Evaluate the block with no args. Fail if the block expects other
than 0 arguments."
^ environment executeMethod: method
#executeMethod: itself is now a primitive, but even then, executing
the #value needs a complete activiation of the #value
method, and then the method that has the code of the block itself is
a method activation.
So right now, we have two complete method activiations for one #value
on a block.
We can easily cut that down to one by making the #value on block a
primitive. Then block activiation would be as fast
as calling a method.
In Squeak right now, it is faster, as there is a scheme to be able to
execute block-contexts which do not require a full activation.
So, we should first make the #value methods primitives and after
that think about what to for not needing full activation for all blocks,
or maybe see if activation in general could be speed up.
Marcus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3947 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/newcompiler/attachments/20070426/2adf5ce4/smime.bin
More information about the Newcompiler
mailing list