WeakIdentitySet.st
changeset 1780 1b3a4ddc5b94
parent 1290 15ba3221b89b
child 1790 4187e9fc7357
--- a/WeakIdentitySet.st	Fri Oct 18 14:30:09 1996 +0200
+++ b/WeakIdentitySet.st	Fri Oct 18 14:34:28 1996 +0200
@@ -116,9 +116,7 @@
 informDispose
     "an element died - must rehash"
 
-    |wasBlocked cnt deleted|
-
-    deleted := DeletedEntry.
+    |wasBlocked|
 
     "
      must block interrupts here - finalization
@@ -127,15 +125,7 @@
      while rehashing
     "
     wasBlocked := OperatingSystem blockInterrupts.
-
-    "/
-    "/ recompute my tally
-    "/
-    cnt := 0.
-    keyArray nonNilElementsDo:[:el | el ~~ deleted ifTrue:[cnt := cnt + 1]].
-    tally := cnt.
-
-    self rehash.
+    keyArray forAllDeadIndicesDo:[:idx | ] replacingCorpsesWith:DeletedEntry.
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
 ! !
 
@@ -154,8 +144,12 @@
     index := 1.
     [index <= keyArray size] whileTrue:[
 	element := keyArray at:index.
-	(element notNil and:[element ~~ DeletedEntry]) ifTrue:[
-	    aBlock value:element
+	element == 0 ifTrue:[
+	    keyArray at:index put:DeletedEntry.
+	] ifFalse:[
+	    (element notNil and:[element ~~ DeletedEntry]) ifTrue:[
+	        aBlock value:element
+	    ]
 	].
 	index := index + 1
     ]
@@ -177,5 +171,5 @@
 !WeakIdentitySet class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.17 1996-04-25 16:18:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.18 1996-10-18 12:34:28 cg Exp $'
 ! !