Paul Brannan wrote:

> On Tue, Apr 23, 2002 at 05:33:50AM +0900, Ned Konz wrote:
>> Typical Smalltalk compilers inline a number of different methods. ifTrue:
>> et al are typically the first ones to get inlined.
>> 
>> Squeak, for instance, inlines all these:
> 
> Can they be redefined on-the-fly or are they hard-coded?

Pretty much everything in Squeak can be redefined on the fly.

Since the compiler is in Squeak code (rather than the VM) you can change it, 
or just subclass it for special purposes.

MessageNode, which is where the lookup table for inlined macros is, keeps 
these selectors and corresponding data in class variables. You could add a 
method to MessageNode class that would extend or replace the tables quite 
easily.

There are 5 tables. They are parallel arrays of selectors (method names):

selector transformer emitter sizer printer

where selector is the name you are looking for in the code to be compiled, 
and the others are used by the compiler.

So you'd define one method to add new entries to the tables, and then you'd 
add four methods on the instance side of MessageNode to actually do the 
work.