From 3a388b71f5b67fe04d97998dd7f46d880047307e Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Mon, 14 Aug 2006 14:37:30 +0000 Subject: [PATCH] o Print a warning when creating a weak hash table with a test other than 'EQ. o Make the hash-table printer indicate if the hash table is weak. --- code/hash-new.lisp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/hash-new.lisp b/code/hash-new.lisp index 8cc14424f..b233bc9dc 100644 --- a/code/hash-new.lisp +++ b/code/hash-new.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/hash-new.lisp,v 1.39 2006/08/11 18:20:18 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/hash-new.lisp,v 1.40 2006/08/14 14:37:30 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -107,7 +107,8 @@ (defun %print-hash-table (ht stream depth) (declare (ignore depth) (stream stream)) (print-unreadable-object (ht stream :identity t) - (format stream "~A hash table, ~D entr~@:P" + (format stream "~:[~;Weak ~]~A hash table, ~D entr~@:P" + (hash-table-weak-p ht) (symbol-name (hash-table-test ht)) (hash-table-number-entries ht)))) @@ -238,6 +239,15 @@ #-gencgc (when weak-p (format *debug-io* ";; Creating unsupported weak-p hash table~%")) + #+gencgc + (when (and weak-p (not (eq test 'eq))) + ;; I (rtoy) think the current GENCGC code really expects the + ;; test to be EQ, but doesn't enforce it in any way. Let's + ;; warn about it for now. + ;; + ;; XXX: Either fix GC to work with other tests, or change + ;; this warning into an error. + (warn "Creating weak key hashtable with unsupported test: ~S" test)) (let* ((index-vector (make-array length :element-type '(unsigned-byte 32) :initial-element 0)) -- GitLab