[squeak-dev] The Inbox: Collections-ul.362.mcz

Levente Uzonyi leves at elte.hu
Tue Jun 15 10:41:59 UTC 2010


On Mon, 14 Jun 2010, Chris Muller wrote:

> Wow, this looks like a deep fix, thanks Levente.  Combined with Igor's
new finalization fix, we should finally have fast, reliable weak
collections!

Well, the kudos goes to Joachim, since he found both bugs. I'm a bit sad
because both were introduced in 4.1.


Levente

On Sat, Jun 12, 2010 at 2:30 PM,  <commits at source.squeak.org> wrote:
> A new version of Collections was added to project The Inbox:
> http://source.squeak.org/inbox/Collections-ul.362.mcz
>
> ==================== Summary ====================
>
> Name: Collections-ul.362
> Author: ul
> Time: 12 June 2010, 9:23:26.86 pm
> UUID: dabb4c65-e01e-8247-b3a4-6c5db80a2307
> Ancestors: Collections-nice.361
>
> - a fix for the bug reported at http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-June/151226.html
>
> =============== Diff against Collections-nice.361 ===============
>
> Item was changed:
>  ----- Method: WeakKeyDictionary>>finalizeValues (in category 'finalization') -----
>  finalizeValues
>        "Remove and finalize all elements which have nil key"
>
>        |  cleanUpAfterRemove |
>        tally = 0 ifTrue: [ ^self ].
>        cleanUpAfterRemove := false.
>        1 to: array size do: [ :index |
>                (array at: index)
>                        ifNil: [ cleanUpAfterRemove := false ]
>                        ifNotNil: [ :element |
>                                element key
>                                        ifNil: [
>                                                finalizer ifNotNil: [ finalizer value: element value ].
>                                                array at: index put: nil.
>                                                tally := tally - 1.
>                                                cleanUpAfterRemove := true ]
>                                        ifNotNil: [ :key |
>                                                cleanUpAfterRemove ifTrue: [
>                                                        | newIndex |
>                                                        (newIndex := self scanFor: key) = index ifFalse: [
>                                                                array
>                                                                        at: newIndex put: element;
> +                                                                       at: index put: nil ] ] ] ] ].
> +       cleanUpAfterRemove ifTrue: [ "Continue rehashing at the front of array"
> +               self fixCollisionsFrom: array size ]
> +                                       !
> -                                                                       at: index put: nil ] ] ] ] ]!
>
>
>


More information about the Squeak-dev mailing list