identityHash patch discussion.

Henrik Gedenryd h.gedenryd at open.ac.uk
Tue Dec 11 10:16:10 UTC 2001


Scott A Crosby wrote:

> I am subscribing to the motto: fix it once, fix it in the right place.


In this case, I think it is "fix it at least twice, in all the right
places". Consider

Interpreter>>lookupMethodInDictionary: dictionary
    "This method lookup tolerates integers as Dictionary keys to support
    execution of images in which Symbols have been compacted out"
     | length index mask wrapAround nextSelector methodArray |
    self inline: true.
    length _ self fetchWordLengthOf: dictionary.
    mask _ length - SelectorStart - 1.
    (self isIntegerObject: messageSelector)
        ifTrue:
        [index _ (mask bitAnd: (self integerValueOf: messageSelector)) +
SelectorStart]
        ifFalse:
        [index _ (mask bitAnd: (self hashBitsOf: messageSelector)) +
SelectorStart].

<rest snipped>

One might think that 4096 is a helluva lotta methods for one class, but hey,
any day now Morph will be there. I it was at 1007 methods and counting when
I last checked, one of which is "makeAllTilesGreen". Now consider the
corresponding ones for the other 700 hues that someone posted
yesterday--surely they should be defined too. They would clearly be
generally useful.

Anyway, my point is that the algorithm to scan (Method)Dictionaries is built
into the vm code, which needs to be considered when making changes.

Henrik





More information about the Squeak-dev mailing list