From b3ef69ef87699504da53d4c7b4002f272b2e53ef Mon Sep 17 00:00:00 2001
From: pmai <pmai>
Date: Thu, 28 Nov 2002 00:51:35 +0000
Subject: [PATCH] Entomotomy Bug: sxhash-on-pcl-instances-returns-42

This commit is a slight rewrite of the previously committed fix, which
sxhash-instance work even when handed non-PCL instances and
funcallable-instances, while enabling the use of stored hash-codes for
all PCL funcallable-instances.
---
 code/hash-new.lisp |  3 ++-
 code/hash.lisp     |  3 ++-
 pcl/fin.lisp       | 13 +++++++++----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/code/hash-new.lisp b/code/hash-new.lisp
index 6c66b6c96..b4a0c463b 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.19 2002/11/21 21:24:13 pmai Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/hash-new.lisp,v 1.20 2002/11/28 00:51:34 pmai Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -914,6 +914,7 @@
 	 (internal-sxhash (class-name (layout-class (%instance-layout s-expr)))
 			  depth)
 	 (sxhash-instance s-expr)))
+    (funcallable-instance (sxhash-instance s-expr))
     ;; Other-pointer types.
     (simple-string (sxhash-simple-string s-expr))
     (symbol (sxhash-simple-string (symbol-name s-expr)))
diff --git a/code/hash.lisp b/code/hash.lisp
index 729f8c267..cfdd6d732 100644
--- a/code/hash.lisp
+++ b/code/hash.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.lisp,v 1.40 2002/11/21 21:24:14 pmai Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/hash.lisp,v 1.41 2002/11/28 00:51:34 pmai Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -875,6 +875,7 @@
 	 (internal-sxhash (class-name (layout-class (%instance-layout s-expr)))
 			  depth)
 	 (sxhash-instance s-expr)))
+    (funcallable-instance (sxhash-instance s-expr))
     ;; Other-pointer types.
     (simple-string (sxhash-simple-string s-expr))
     (symbol (sxhash-simple-string (symbol-name s-expr)))
diff --git a/pcl/fin.lisp b/pcl/fin.lisp
index b4b03d3f3..257338f48 100644
--- a/pcl/fin.lisp
+++ b/pcl/fin.lisp
@@ -26,7 +26,7 @@
 ;;;
 
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/fin.lisp,v 1.18 2002/11/22 15:20:18 pmai Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/fin.lisp,v 1.19 2002/11/28 00:51:35 pmai Exp $")
 ;;;
 
   ;;   
@@ -170,6 +170,11 @@ explicitly marked saying who wrote it.
 ;;; Implement proper sxhashing of standard instances.
 (defun common-lisp::sxhash-instance (instance)
   (cond
-    ((std-instance-p instance) (std-instance-hash-code instance))
-    ((fsc-instance-p instance) (fsc-instance-hash-code instance))
-    (t (error "What kind of instance is this?"))))
+    ((and (std-instance-p instance)
+          (typep (std-instance-wrapper instance) 'wrapper))
+     (std-instance-hash-code instance))
+    ((and (fsc-instance-p instance)
+          (typep (fsc-instance-wrapper instance) 'wrapper))
+     (fsc-instance-hash-code instance))
+    (t
+     42)))
-- 
GitLab