[Newcompiler] Implementing bytecode for closur

bryce at kampjes.demon.co.uk bryce at kampjes.demon.co.uk
Fri Apr 27 22:51:24 UTC 2007


Mathieu Suen writes:
 > 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.

You may want to add a storeClosureEnvironment bytecode too.

That way you can avoid accessing the context by the bytecode which
reduces context recycling.

With a storeClosureEnvironment methods like:

   ifFalse
	1 to 100000 do: [self doSomethingIfFalse: [^ self]].

May become faster than their equivalents in the current system.

A simple bytecode that just implements:
    pushThisContext: 
    pushConstant: 5
    send: privStoreIn:instVar:

Would be enough to allow for benchmarking. 

The aim is just to remove pushThisContext: which stops context
recycling. The current system has to use pushThisContext to create
the BlockContext. So the current system creates a BlockContext and
stops any existing contexts being recycled. The closure compiler
would then just create an environment.

Do you have the tools to profile the VM?

If you've got access to Linux (with root access, it may need a kernel
module compiled) then I could explain how to use oprofile for
profiling. If not, I can run a few benchmarks here.

Bryce


More information about the Newcompiler mailing list