[squeak-dev] The Trunk: Collections-ul.463.mcz

Chris Muller asqueaker at gmail.com
Fri Oct 7 03:39:50 UTC 2011


It can be worthwhile to evaluate whether it would be important to
transfer the identityHash or not.  It looks fine here since I think
#become: behaves the same in terms of identityHash.  But it's always
worth remembering that it's available when employing #becomeForward:.

   Object new becomeForward: #size     "Save the image before doing this!"

   Object new becomeForward: #size copyHash: false     "This one is fine."

The default is to copy the identityHash, which means existing
IdentityDictionary's or Dictionary's whose keys do not override #hash
would potentially have their hash keys change, which would require a
rehash of that Dictionary.  But even that isn't always possible.

The copyHash: argument was introduced for Magma, because when a Proxy
to a Symbol is reifiied, if the Symbol was a method selector (as it
often is) that is important to the system, then it could easily lock
up.




On Wed, Oct 5, 2011 at 3:43 AM,  <commits at source.squeak.org> wrote:
> Levente Uzonyi uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-ul.463.mcz
>
> ==================== Summary ====================
>
> Name: Collections-ul.463
> Author: ul
> Time: 4 October 2011, 8:25:51.321 pm
> UUID: 2dda520b-035d-8a40-b62b-c285552d07ee
> Ancestors: Collections-eem.462
>
> - use #becomeForward: instead of #become:
>
> =============== Diff against Collections-eem.462 ===============
>
> Item was changed:
>  ----- Method: CharacterSet>>add: (in category 'collection ops') -----
>  add: aCharacter
>        "I automatically become a WideCharacterSet if you add a wide character to myself"
>
>        aCharacter asciiValue >= 256
>                ifTrue: [| wide |
>                        wide := WideCharacterSet new.
>                        wide addAll: self.
>                        wide add: aCharacter.
> +                       self becomeForward: wide.
> -                       self become: wide.
>                        ^aCharacter].
>        map at: aCharacter asciiValue + 1 put: 1.
>        ^aCharacter!
>
> Item was changed:
>  ----- Method: CharacterSetComplement>>removeAll (in category 'collection ops') -----
>  removeAll
> +
> +       self becomeForward: CharacterSet new!
> -       | newSet |
> -       newSet := CharacterSet new.
> -       self become: newSet!
>
> Item was changed:
>  ----- Method: LookupKey>>beBindingOfType:announcing: (in category 'bindings') -----
>  beBindingOfType: aClass announcing: aBool
>        "Make the receiver a global binding of the given type"
> +
> -       | old new |
>        (Smalltalk globals associationAt: self key) == self
>                ifFalse:[^self error:'Not a global variable binding'].
>        self class == aClass ifTrue:[^self].
> +       self becomeForward: (aClass key: self key value: self value).
> -       old := self.
> -       new := aClass key: self key value: self value.
> -       old become: new.
>        "NOTE: Now self == read-only (e.g., the new binding)"
>        ^self recompileBindingsAnnouncing: aBool!
>
>
>



More information about the Squeak-dev mailing list