From 22109387178467be88a41b90e8c099f18762c9f7 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Mon, 17 May 2004 17:28:35 +0000 Subject: [PATCH] Add some comments on what we're trying to do here with sxhash on a symbol. --- compiler/generic/vm-tran.lisp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/generic/vm-tran.lisp b/compiler/generic/vm-tran.lisp index a2aab9cd9..3d0517706 100644 --- a/compiler/generic/vm-tran.lisp +++ b/compiler/generic/vm-tran.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/compiler/generic/vm-tran.lisp,v 1.51 2004/05/17 17:22:30 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/vm-tran.lisp,v 1.52 2004/05/17 17:28:35 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -428,17 +428,20 @@ (deftransform sxhash ((s-expr) (symbol)) '(%sxhash-simple-string (symbol-name s-expr))) -#+nil -(deftransform sxhash ((s-expr) (symbol)) - '(kernel:symbol-hash s-expr)) - #+sparc (deftransform sxhash ((s-expr) (symbol)) + ;; Pick off the constant case first. (Important!) (if (constant-continuation-p s-expr) (sxhash (continuation-value s-expr)) '(let ((result (symbol-hash s-expr))) + ;; A 0 in the symbol-hash slot means uninitialized. We should + ;; probably use -1 instead, once we make sure that NIL doesn't + ;; have a negative hash value. (if (<= result 0) (let ((sxhash (%sxhash-simple-string (symbol-name s-expr)))) + ;; If 0 is the unitialized indicator, should we make + ;; sure we never store 0 into this slot? It would be + ;; pretty bad if it that happens. (%set-symbol-hash s-expr sxhash) sxhash) result)))) -- GitLab