[Newcompiler] Implementing bytecode for closur

Stéphane Ducasse stephane.ducasse at univ-savoie.fr
Thu Apr 26 13:28:50 UTC 2007


Indeed!
I'm curious to see that.

Stef

>> pushThisContext
>> pushConstant: 5
>> send: privGetInstVar:
>>
>> You get:
>>
>> pushClosureEnvironment
>>
>> I have run benchmark and it result that the system was running 16%  
>> faster.
>
>
> 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



More information about the Newcompiler mailing list