- ;; Search for key in the hash table.
- (multiple-value-bind (hashing eq-based)
- (funcall (hash-table-hash-fun hash-table) key)
- (declare (type hash hashing))
- (let* ((index-vector (hash-table-index-vector hash-table))
- (length (length index-vector))
+ ;; Search for key in the hash table.
+ (multiple-value-bind (hashing eq-based)
+ (funcall (hash-table-hash-fun hash-table) key)
+ (declare (type hash hashing))
+ (let* ((index-vector (hash-table-index-vector hash-table))
+ (length (length index-vector))
- (next (aref index-vector index))
- (next-vector (hash-table-next-vector hash-table))
- (hash-vector (hash-table-hash-vector hash-table))
- (test-fun (hash-table-test-fun hash-table)))
- (declare (type index index))
- ;; Search next-vector chain for a matching key.
- (if (or eq-based (not hash-vector))
+ (next (aref index-vector index))
+ (next-vector (hash-table-next-vector hash-table))
+ (hash-vector (hash-table-hash-vector hash-table))
+ (test-fun (hash-table-test-fun hash-table)))
+ (declare (type index index))
+ ;; Search next-vector chain for a matching key.
+ (if (or eq-based (not hash-vector))
- ;; Search for key in the hash table.
- (multiple-value-bind (hashing eq-based)
- (funcall (hash-table-hash-fun hash-table) key)
- (declare (type hash hashing))
- (let* ((index-vector (hash-table-index-vector hash-table))
- (length (length index-vector))
+ ;; Search for key in the hash table.
+ (multiple-value-bind (hashing eq-based)
+ (funcall (hash-table-hash-fun hash-table) key)
+ (declare (type hash hashing))
+ (let* ((index-vector (hash-table-index-vector hash-table))
+ (length (length index-vector))
- (next (aref index-vector index))
- (kv-vector (hash-table-table hash-table))
- (next-vector (hash-table-next-vector hash-table))
- (hash-vector (hash-table-hash-vector hash-table))
- (test-fun (hash-table-test-fun hash-table)))
- (declare (type index index next))
- (when (hash-table-weakness hash-table)
- (set-header-data kv-vector sb!vm:vector-valid-hashing-subtype))
- (cond ((or eq-based (not hash-vector))
- (when eq-based
- (set-header-data kv-vector
- sb!vm:vector-valid-hashing-subtype))
- ;; Search next-vector chain for a matching key.
+ (next (aref index-vector index))
+ (kv-vector (hash-table-table hash-table))
+ (next-vector (hash-table-next-vector hash-table))
+ (hash-vector (hash-table-hash-vector hash-table))
+ (test-fun (hash-table-test-fun hash-table)))
+ (declare (type index index next))
+ (when (hash-table-weakness hash-table)
+ (set-header-data kv-vector sb!vm:vector-valid-hashing-subtype))
+ (cond ((or eq-based (not hash-vector))
+ (when eq-based
+ (set-header-data kv-vector
+ sb!vm:vector-valid-hashing-subtype))
+ ;; Search next-vector chain for a matching key.
- ;; Pop a KV slot off the free list
- (let ((free-kv-slot (hash-table-next-free-kv hash-table)))
- (declare (type index/2 free-kv-slot))
- ;; Double-check for overflow.
- (aver (not (zerop free-kv-slot)))
- (setf (hash-table-next-free-kv hash-table)
- (aref next-vector free-kv-slot))
- (incf (hash-table-number-entries hash-table))
+ ;; Pop a KV slot off the free list
+ (let ((free-kv-slot (hash-table-next-free-kv hash-table)))
+ (declare (type index/2 free-kv-slot))
+ ;; Double-check for overflow.
+ (aver (not (zerop free-kv-slot)))
+ (setf (hash-table-next-free-kv hash-table)
+ (aref next-vector free-kv-slot))
+ (incf (hash-table-number-entries hash-table))
- (setf (aref kv-vector (* 2 free-kv-slot)) key)
- (setf (aref kv-vector (1+ (* 2 free-kv-slot))) value)
- ;; Setup the hash-vector if necessary.
- (when hash-vector
- (if (not eq-based)
- (setf (aref hash-vector free-kv-slot) hashing)
- (aver (= (aref hash-vector free-kv-slot)
- +magic-hash-vector-value+))))
- ;; Push this slot into the next chain.
- (setf (aref next-vector free-kv-slot) next)
+ (setf (aref kv-vector (* 2 free-kv-slot)) key)
+ (setf (aref kv-vector (1+ (* 2 free-kv-slot))) value)
+ ;; Setup the hash-vector if necessary.
+ (when hash-vector
+ (if (not eq-based)
+ (setf (aref hash-vector free-kv-slot) hashing)
+ (aver (= (aref hash-vector free-kv-slot)
+ +magic-hash-vector-value+))))
+ ;; Push this slot into the next chain.
+ (setf (aref next-vector free-kv-slot) next)
- ;; Search for key in the hash table.
- (multiple-value-bind (hashing eq-based)
- (funcall (hash-table-hash-fun hash-table) key)
- (declare (type hash hashing))
- (let* ((index-vector (hash-table-index-vector hash-table))
- (length (length index-vector))
+ ;; Search for key in the hash table.
+ (multiple-value-bind (hashing eq-based)
+ (funcall (hash-table-hash-fun hash-table) key)
+ (declare (type hash hashing))
+ (let* ((index-vector (hash-table-index-vector hash-table))
+ (length (length index-vector))
- (next (aref index-vector index))
- (table (hash-table-table hash-table))
- (next-vector (hash-table-next-vector hash-table))
- (hash-vector (hash-table-hash-vector hash-table))
- (test-fun (hash-table-test-fun hash-table)))
- (declare (type index index)
- (type index/2 next))
- (flet ((clear-slot (chain-vector prior-slot-location slot-location)
- (declare (type index/2 slot-location))
- ;; Mark slot as empty.
- (setf (aref table (* 2 slot-location)) +empty-ht-slot+
- (aref table (1+ (* 2 slot-location))) +empty-ht-slot+)
- ;; Update the prior pointer in the chain to skip this.
- (setf (aref chain-vector prior-slot-location)
- (aref next-vector slot-location))
- ;; Push KV slot onto free chain.
- (setf (aref next-vector slot-location)
- (hash-table-next-free-kv hash-table))
- (setf (hash-table-next-free-kv hash-table) slot-location)
- (when hash-vector
- (setf (aref hash-vector slot-location)
- +magic-hash-vector-value+))
- (decf (hash-table-number-entries hash-table))
- t))
- (cond ((zerop next)
- nil)
- ((if (or eq-based (not hash-vector))
- (eq key (aref table (* 2 next)))
- (and (= hashing (aref hash-vector next))
- (funcall test-fun key (aref table (* 2 next)))))
- (clear-slot index-vector index next))
- ;; Search next-vector chain for a matching key.
- ((or eq-based (not hash-vector))
- ;; EQ based
- (do ((prior next next)
+ (next (aref index-vector index))
+ (table (hash-table-table hash-table))
+ (next-vector (hash-table-next-vector hash-table))
+ (hash-vector (hash-table-hash-vector hash-table))
+ (test-fun (hash-table-test-fun hash-table)))
+ (declare (type index index)
+ (type index/2 next))
+ (flet ((clear-slot (chain-vector prior-slot-location slot-location)
+ (declare (type index/2 slot-location))
+ ;; Mark slot as empty.
+ (setf (aref table (* 2 slot-location)) +empty-ht-slot+
+ (aref table (1+ (* 2 slot-location))) +empty-ht-slot+)
+ ;; Update the prior pointer in the chain to skip this.
+ (setf (aref chain-vector prior-slot-location)
+ (aref next-vector slot-location))
+ ;; Push KV slot onto free chain.
+ (setf (aref next-vector slot-location)
+ (hash-table-next-free-kv hash-table))
+ (setf (hash-table-next-free-kv hash-table) slot-location)
+ (when hash-vector
+ (setf (aref hash-vector slot-location)
+ +magic-hash-vector-value+))
+ (decf (hash-table-number-entries hash-table))
+ t))
+ (cond ((zerop next)
+ nil)
+ ((if (or eq-based (not hash-vector))
+ (eq key (aref table (* 2 next)))
+ (and (= hashing (aref hash-vector next))
+ (funcall test-fun key (aref table (* 2 next)))))
+ (clear-slot index-vector index next))
+ ;; Search next-vector chain for a matching key.
+ ((or eq-based (not hash-vector))
+ ;; EQ based
+ (do ((prior next next)