Eliminating superclass lookup in the VM (and dynamic composition of behavior)

Jecel Assumpcao Jr jecel at merlintec.com
Wed Dec 11 21:23:11 UTC 2002


I am actually implementing a version of Self, which I call "Oliver 
Smalltalk", which works as you described.

On Wednesday 11 December 2002 14:26, Stephen Pair wrote:
> One issue with it would be super sends.  But, I think you could come
> up with a reasonable way of handling that.

I simply inline the code for the super method into the calling method.

> On the space efficiency side, you'd be sharing most of the compiled
> methods, but yeah, you would lose a little, though I suspect that in
> the grand scheme of things it wouldn't much matter.

Travis Griggs gave some numbers in another message: a worst case of 47 
times expansion, or 23 times if you take the care not to inherit 
everything from Object everywhere.

This is not a problem in my case - I have RAM to spare (how odd to be 
able to say that about 8MB ;-)

> However, in the even grander scheme of things...this means that a
> superclass must know about its subclasses...which is not so bad in
> the case of Smalltalk.  But, in the context of Self...would be quite
> horrible.  You could always brute force your way through the entire
> object memory, but that wouldn't perform very well and would limit
> the situations in which you would consider dynamically altering
> behavior.

Dynamic inheritance is never used in practice in Self (except in some 
examples to show that it does work). Oliver Smalltalk doesn't have it. 
The VM can go through the whole object memory in a fraction of a 
second, but high level Self code takes a lot longer.

Randal Schwartz said "I'd hate to have to update 15 entries every time I 
compiled something in OrderedCollection, though", but that is already 
the case if you add an instance variable to OrderedCollection. It 
shouldn't be an issue on today's machines.

> Sometimes I really wish Squeak was running on top of a VM
> that had the capabilities of Self.

It is on my "to do" list, but hardly likely to happen before 2004 unless 
I am able to hire (translation: get more money than I have now) someone 
to do it.

-- Jecel



More information about the Squeak-dev mailing list