core: declare word's hashcode an integer. Make word not flushable since it's mutable. Add a test case for #1392.
Fixes #1392. @bjourne found this.db4
parent
ac0828718f
commit
bc0c02acdf
|
@ -1,6 +1,5 @@
|
||||||
USING: accessors assocs continuations fry hashtables io kernel
|
USING: accessors assocs continuations fry hashtables kernel make
|
||||||
make math namespaces prettyprint sequences sequences.private
|
math namespaces sequences slots.private tools.test ;
|
||||||
tools.test vectors ;
|
|
||||||
IN: hashtables.tests
|
IN: hashtables.tests
|
||||||
|
|
||||||
{ H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
|
{ H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
|
||||||
|
@ -186,3 +185,16 @@ H{ } "x" set
|
||||||
|
|
||||||
! Random test case
|
! 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
|
||||||
|
|
||||||
|
! Bug 1392, word's hashcode was declared a fixnum
|
||||||
|
! It fails depending on hash growth, so test in a loop
|
||||||
|
SYMBOL: +bignum-hashcode+
|
||||||
|
-405534154 +bignum-hashcode+ 1 set-slot
|
||||||
|
{ t } [
|
||||||
|
100 iota [
|
||||||
|
drop
|
||||||
|
H{ } clone
|
||||||
|
f +bignum-hashcode+ pick set-at
|
||||||
|
+bignum-hashcode+ +bignum-hashcode+ pick set-at assoc-size 1 =
|
||||||
|
] all?
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -263,7 +263,7 @@ M: word forget*
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: word hashcode*
|
M: word hashcode*
|
||||||
nip 1 slot { fixnum } declare ; inline foldable
|
nip 1 slot { integer } declare ; inline
|
||||||
|
|
||||||
M: word literalize <wrapper> ;
|
M: word literalize <wrapper> ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue