Accessing variables through sending messages

Bryce Kampjes bryce at kampjes.demon.co.uk
Wed Jun 22 19:40:38 UTC 2005


Colin Putney writes:
 > Agreed, which is why I like Tweak's approach. The key to optimizing 
 > Smalltalk is making sends fast, and if inst var access is just another 
 > send, that gets optimized as well. Exupery seems to be moving along 
 > nicely in this area - PICs are already done, and adaptive inlining is 
 > just the ultimate optimization of a send: remove it entirely.

The question is how to optimise sends. Dynamic inlining is probably
the best way to avoid the cost of creating a new context and shuffling
arguments. It also exposes more code for classical optimisations.

It wouldn't be hard to make self and super sends completely free by
inlining them without a type check. The trick is to compile a method
once for each receiver class which allows all self sends to be easily
resolved at compile time. Exupery already compiles a different version
of a method for each receiver, this is to specialise code for #at:. I
think that Self used this trick.

Exupery currently treats #at:s as normal sends then inlines the
primitive, this gets '820,512,820 bytecodes/sec; 14,907,050
sends/sec'. Using the at cache and special bytecodes only got 700
million bytecodes/second. Exupery is using a normal send and type
checks, I'd rather optimise the general case first.

Bryce



More information about the Squeak-dev mailing list