[Newcompiler] Adding the create closure environment bytecode

Mathieu Suen mathk.sue at gmail.com
Sun Aug 19 00:45:08 UTC 2007


Hi,

This last week I spend my time to implement the create closure  
environment bytecode.
This bytecode replace the creation and registration of the closure  
environment:

push: ClosureEnvironment
push: 1
send: #new:

by a single bytecode.

I have spend  a lote of time trying to fix a bug when the VM do a gc.  
Finally I found out that was because the frame size of the method  
change with my bytecode(i.e I don't use the stack to create the  
colsure). Then the size of the method context is not correct. So  
instead of fixing the frame size I have fixed the bytecode which it  
not the best optimization


I have made a little benchmark to see the performance:

a := 0.
#(1 2 3 4 5 6 7 8 9 10)  do: [:each | a := each + a]] bench.

Without the bytecode (with closure)
'207 655.4689062188 per second.'.
'207 615.876824635 per second.'.
'206 797.6404719056 per second.'.

With the bytecode
'225 009.398120376 per second.'.
'224 685.4629074185 per second.'.
'225 539.6920615877 per second.'

So with the bytecode we are about 8% faster

	Mth





More information about the Newcompiler mailing list