]> gitweb.factorcode.org Git - factor.git/commitdiff
Revert "hash-sets,hashtables: make it so the array backing the hash is non-empty"
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Oct 2016 18:18:41 +0000 (11:18 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Oct 2016 18:18:41 +0000 (11:18 -0700)
This reverts commit 6f10f06c2776c8dfa7e727f2a000dc48bd296bf0.

core/hash-sets/hash-sets.factor
core/hashtables/hashtables-tests.factor
core/hashtables/hashtables.factor

index bfafe4ee3980889be905f5769503322161dd571e..9e99dc6a1a99c041624d6fe27d57719acfa54dac 100644 (file)
@@ -10,10 +10,7 @@ IN: hash-sets
 TUPLE: hash-set
     { count array-capacity }
     { deleted array-capacity }
-    { array array initial: {
-          T{ tombstone } T{ tombstone } T{ tombstone } T{ tombstone }
-      }
-    } ;
+    { array array } ;
 
 <PRIVATE
 
index 1ae6ad353ce689df3b742362f27dc61826ce88a5..a238eef90dbd1192701f929c256da38b9f51fa06 100644 (file)
@@ -1,11 +1,5 @@
-USING: accessors arrays assocs continuations fry hashtables
-hashtables.private kernel make math memory namespaces sequences
-tools.test ;
-
-! hash@
-{ 18 } [
-    77 20 f <array> hash@
-] unit-test
+USING: accessors assocs continuations fry hashtables kernel make
+math namespaces sequences tools.test ;
 
 { H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
 
@@ -188,14 +182,5 @@ H{ } "x" set
 
 { 1 } [ 2 "h" get at ] unit-test
 
-! Previously this could break as hashtable new created a backing an
-! empty backing array and the code assumed its length was > 0.
-{ f f } [
-    compact-gc 77 hashtable new [ clone ] change-array at*
-] unit-test
-
 ! Random test case
-{ "A" } [
-    100 iota [ dup ] H{ } map>assoc 32 over
-    delete-at "A" 32 pick set-at 32 of
-] unit-test
+{ "A" } [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test
index 33d0c3ace93c37964e5d6666d55da1092b3edf1b..d7763428d7c8db2a9eb8bdd31e56879e0dc79680 100644 (file)
@@ -4,16 +4,10 @@ USING: accessors arrays assocs kernel kernel.private math
 math.private sequences sequences.private slots.private vectors ;
 IN: hashtables
 
-! Required because the hashtable definition references tombstone.
-<PRIVATE PRIVATE>
-
 TUPLE: hashtable
     { count array-capacity }
     { deleted array-capacity }
-    { array array initial: {
-          T{ tombstone } T{ tombstone } T{ tombstone } T{ tombstone }
-      }
-    } ;
+    { array array } ;
 
 <PRIVATE