0.9.4.24:
[sbcl.git] / src / code / target-hash-table.lisp
index d3a9bdb..b98c33d 100644 (file)
 
 (defconstant +min-hash-table-size+ 16)
 (defconstant +min-hash-table-rehash-threshold+ (float 1/16 1.0))
-;; as explained by pmai on openprojects #lisp IRC 2002-07-30: #x80000000
-;; is bigger than any possible nonEQ hash value, and thus indicates an
-;; empty slot; and EQ hash tables don't use HASH-TABLE-HASH-VECTOR
-(defconstant +magic-hash-vector-value+ #x80000000)
 
 (defun make-hash-table (&key (test 'eql)
                              (size +min-hash-table-size+)
    ;; First check the cache.  Use EQ here for speed.
    (let ((cache (hash-table-cache hash-table))
          (table (hash-table-table hash-table)))
-          
+
      (if (and cache (< cache (length table)) (eq (aref table cache) key))
          (values (aref table (1+ cache)) t)
 
                 (hash-vector (hash-table-hash-vector hash-table))
                 (test-fun (hash-table-test-fun hash-table)))
            (declare (type index index))
-           
+
            (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.
                   (do ((next next (aref next-vector next)))
                       ((zerop next))
                       (setf (hash-table-cache hash-table) (* 2 next))
                       (setf (aref kv-vector (1+ (* 2 next))) value)
                       (return-from %puthash value)))))
-           
+
            ;; Pop a KV slot off the free list
            (let ((free-kv-slot (hash-table-next-free-kv hash-table)))
              ;; Double-check for overflow.
              (setf (hash-table-next-free-kv hash-table)
                    (aref next-vector free-kv-slot))
              (incf (hash-table-number-entries hash-table))
-             
+
              (setf (hash-table-cache hash-table) (* 2 free-kv-slot))
              (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 index-vector index) free-kv-slot)))))))
          ((not (zerop (hash-table-needing-rehash hash-table)))
           (flush-needing-rehash hash-table)))
 
-   ;; For now, just clear the cache   
+   ;; For now, just clear the cache
    (setf (hash-table-cache hash-table) nil)
 
    ;; Search for key in the hash table.
 
 (def!method print-object ((hash-table hash-table) stream)
   (declare (type stream stream))
-  (cond ((not *print-readably*)
+  (cond ((or (not *print-readably*) (not *read-eval*))
          (print-unreadable-object (hash-table stream :type t :identity t)
            (format stream
                    ":TEST ~S :COUNT ~S"
                    (hash-table-test hash-table)
                    (hash-table-count hash-table))))
-        ((not *read-eval*)
-         (error "can't print hash tables readably without *READ-EVAL*"))
         (t
          (with-standard-io-syntax
           (format stream