X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-sxhash.lisp;h=953160b33049dc57da29ea689aa229c18f79e35c;hb=7b8eb24427562ae9e3ffe77e0a98899b9786e2b1;hp=a3e09b49b496de50fa7b2f46bd7203247d0e587c;hpb=3e377a9a6da8d55835dd695c63defad84701ba40;p=sbcl.git diff --git a/src/code/target-sxhash.lisp b/src/code/target-sxhash.lisp index a3e09b4..953160b 100644 --- a/src/code/target-sxhash.lisp +++ b/src/code/target-sxhash.lisp @@ -183,12 +183,27 @@ (sxhash-recurse (cdr x) (1- depthoid))) 261835505))) (instance - (if (or (typep x 'structure-object) (typep x 'condition)) - (logxor 422371266 - (sxhash ; through DEFTRANSFORM - (classoid-name - (layout-classoid (%instance-layout x))))) - (sxhash-instance x))) + (if (pathnamep x) + ;; Pathnames are EQUAL if all the components are EQUAL, so + ;; we hash all of the components of a pathname together. + (let ((hash (sxhash-recurse (pathname-host x) depthoid))) + (mixf hash (sxhash-recurse (pathname-device x) depthoid)) + (mixf hash (sxhash-recurse (pathname-directory x) depthoid)) + (mixf hash (sxhash-recurse (pathname-name x) depthoid)) + (mixf hash (sxhash-recurse (pathname-type x) depthoid)) + ;; Hash :NEWEST the same as NIL because EQUAL for + ;; pathnames assumes that :newest and nil are equal. + (let ((version (%pathname-version x))) + (mixf hash (sxhash-recurse (if (eq version :newest) + nil + version) + depthoid)))) + (if (or (typep x 'structure-object) (typep x 'condition)) + (logxor 422371266 + (sxhash ; through DEFTRANSFORM + (classoid-name + (layout-classoid (%instance-layout x))))) + (sxhash-instance x)))) (symbol (sxhash x)) ; through DEFTRANSFORM (array (typecase x @@ -200,7 +215,7 @@ ;; than this. The problem is that a non-SIMPLE ;; BIT-VECTOR could be displaced to another, with a ;; non-zero offset -- so that significantly more - ;; work needs to be done using the %RAW-BITS + ;; work needs to be done using the %VECTOR-RAW-BITS ;; approach. This will probably do for now. (sxhash-recurse (copy-seq x) depthoid)) (t (logxor 191020317 (sxhash (array-rank x))))))