method dictionary lookups and walking up the inheritance tree

Klaus D. Witzel klaus.witzel at cobss.com
Tue May 16 17:04:33 UTC 2006


Hi Michael,

on Tue, 16 May 2006 18:06:32 +0200, you <mhaupt at gmail.com> wrote:

> Hi,
>
> once more, apologies for cross-posting.
>
> From ClassBuilder, I could see that, when a new class is created, the
> superclass's method dictionary contents are copied to the method
> dictionary of the new class.

I have not checked the code of ClassBuilder but in such a case the result  
is as follows (I do the same every now and then):

a) the VM cannot crash because the method dict field being initially nil
b) every subclass which has the same methods as its superclass has, is  
invariant

So if the VM doesn't find a method in such a subclass, it will not find  
said method in the superclass, too.

What are you looking for?

/Klaus

> Still, the interpreter climbs, in
> Interpreter>>lookupMethodInClass:, up the inheritance tree to resolve
> a method.
>
> Why is that? Have I missed a spot where subclass creation does not
> entail method dictionary copying?
>
> Thanks,
>
> Michael





More information about the Vm-dev mailing list