bootstrap: make sure to rehash hash-sets also.

db4
John Benediktsson 2013-03-07 22:04:52 -08:00
parent 23078f7bd7
commit 895c6ca7c5
2 changed files with 11 additions and 5 deletions

View File

@ -1,10 +1,12 @@
! Copyright (C) 2004, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs continuations debugger generic hashtables
init io io.files kernel kernel.private make math memory
namespaces parser parser.notes prettyprint sequences splitting
system vectors vocabs vocabs.loader words destructors ;
USING: arrays assocs continuations debugger destructors generic
hash-sets hashtables init io io.files kernel kernel.private
make math memory namespaces parser parser.notes prettyprint
sequences splitting system vectors vocabs vocabs.loader words ;
QUALIFIED: bootstrap.image.private
QUALIFIED: hashtables
QUALIFIED: hash-sets
IN: bootstrap.stage1
"Bootstrap stage 1..." print flush
@ -20,7 +22,8 @@ load-help? off
[
! Rehash hashtables first, since bootstrap.image creates
! them using the host image's hashing algorithms.
[ hashtable? ] instances [ rehash ] each
[ hashtable? ] instances [ hashtables:rehash ] each
[ hash-set? ] instances [ hash-sets:rehash ] each
boot
] %

View File

@ -103,6 +103,9 @@ M: hash-set delete ( key hash -- )
M: hash-set cardinality ( hash -- n )
[ count>> ] [ deleted>> ] bi - ; inline
: rehash ( hash -- )
[ members ] [ clear-set ] [ (rehash) ] tri ;
M: hash-set adjoin ( key hash -- )
dup ?grow-hash (adjoin) ;