[squeak-dev] Re: 0006721: Identity dictionarys sometimes can't find their keys

Levente Uzonyi leves at elte.hu
Sun Feb 28 13:19:40 UTC 2010


On Sat, 27 Feb 2010, Jerome Peace wrote:

> Hi all,
>
> I could use some help getting some crucial tests into trunk.
>
> The patches are in the mantis report of the title.
> http://bugs.squeak.org/view.php?id=6721
>

nil is a valid key in Dictionary and IdentityKeyDictionary. A better test 
would be something like this:

{ Dictionary. IdentityDictionary } do: [ :dictionaryClass |
 	dictionaryClass allInstancesDo: [ :dictionary |
 		dictionary keysAndValuesDo: [ :key :value |
 			self assert: (dictionary at: key) == value ] ] ].

Or, if you want to use lower level (private) methods:

{ Dictionary. IdentityDictionary } do: [ :dictionaryClass |
 	dictionaryClass allInstancesDo: [ :dictionary |
 		dictionary array doWithIndex: [ :association :index |
 			association ifNotNil: [
 				self assert: (dictionary scanFor: association key) = index ] ] ] ]

> The ill hashed dictionaries have been detected in Fun Squeak.
>

The tests above can be used to track down dictionaries which have an 
invalid state.


Levente

> I am worried that there is something in the main image that causes conditions to occur so that dictionaries are not rehashed when needed.
>
> The problem is that a mis-hashed dictionary will show up only as other symptoms. Code that seemingly doesn't work as expected. Without a ready test to run tracking it back to the true problem is difficult.
>
> I have no MC skills so I am asking for someone to take over harvesting from the report.
>
> Thank you in advance.
>
> Yours in curiosity and service, --Jerome Peace
>
>
>
>
>
>
>
>



More information about the Squeak-dev mailing list