Why does every method get sent a #methodClass:

Andreas Raab andreas.raab at gmx.de
Wed Sep 27 06:05:16 UTC 2006


Equally important, the method class normalizes the format of 
CompiledMethod with respect to method properties. Before adding the 
method class for each method, methods with super-sends would store their 
properties in the next-to-last literal, those without in the last. Which 
is a pain to maintain. Plus, there are some situations where the ability 
to reason about the origin of a loose compiled method (e.g., one not 
stored in any method dictionary due to recompilation) is critical for 
being able to persist them correctly (like when you try to determine 
whether that compiled method will crash your system after loading it 
back in since it accesses iVars beyond the end of the object). All in 
all, I'm a big fan of these particular changes - they make many things 
trivial that would be somewhere between hard to near impossible 
otherwise. At the cost of four  (if you could method properties eight) 
bytes per compiled method which -to me- seems a reasonable tradeoff in 
this case.

Cheers,
   - Andreas

Lukas Renggli wrote:
>> I'm guessing this is related to Traits but I'd be very interested to
>> know why it is neccessary to add to the size of *every* method in the
>> system.
> 
> No, it has nothing to do with Traits. It is there to make the system
> much faster. All the senders of #who and related methods (the
> refactoring browser is one of the heavy users) used to be utterly
> slow.
> 
> Lukas
> 




More information about the Squeak-dev mailing list