From a2c50e6eee85241aff85f48c784ff653fcf3ddd5 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Tue, 6 Aug 2024 22:03:08 +0000 Subject: [PATCH] Remove :salted-symbol-hash as a choice --- crossbuild-runner/backends/arm/features | 1 - crossbuild-runner/backends/mips/features | 1 - crossbuild-runner/backends/ppc/features | 1 - crossbuild-runner/backends/sparc/features | 1 - crossbuild-runner/backends/x86/features | 1 - src/code/cross-sxhash.lisp | 5 ++--- src/code/symbol.lisp | 2 -- src/cold/shared.lisp | 6 ------ src/compiler/generic/genesis.lisp | 3 --- src/compiler/generic/objdef.lisp | 3 +-- src/compiler/sxhash.lisp | 3 --- tests/symbol.pure.lisp | 2 +- 12 files changed, 4 insertions(+), 25 deletions(-) diff --git a/crossbuild-runner/backends/arm/features b/crossbuild-runner/backends/arm/features index 8ba31a8d7..b3f2c5397 100644 --- a/crossbuild-runner/backends/arm/features +++ b/crossbuild-runner/backends/arm/features @@ -4,4 +4,3 @@ ; hooks in for someone to add the support later. :arm-vfp :arm-vfpv2 :fp-and-pc-standard-save -:salted-symbol-hash diff --git a/crossbuild-runner/backends/mips/features b/crossbuild-runner/backends/mips/features index 706bab1ef..d2360749c 100644 --- a/crossbuild-runner/backends/mips/features +++ b/crossbuild-runner/backends/mips/features @@ -1,3 +1,2 @@ :gencgc :use-cons-region :soft-card-marks :alien-callbacks -:salted-symbol-hash diff --git a/crossbuild-runner/backends/ppc/features b/crossbuild-runner/backends/ppc/features index 1add32c6a..d183b010f 100644 --- a/crossbuild-runner/backends/ppc/features +++ b/crossbuild-runner/backends/ppc/features @@ -1,3 +1,2 @@ :gencgc :compare-and-swap-vops :alien-callbacks -:salted-symbol-hash diff --git a/crossbuild-runner/backends/sparc/features b/crossbuild-runner/backends/sparc/features index 5edafc9f2..0e82d7542 100644 --- a/crossbuild-runner/backends/sparc/features +++ b/crossbuild-runner/backends/sparc/features @@ -1,2 +1 @@ :gencgc -:salted-symbol-hash diff --git a/crossbuild-runner/backends/x86/features b/crossbuild-runner/backends/x86/features index 0507390d1..019bfbdd9 100644 --- a/crossbuild-runner/backends/x86/features +++ b/crossbuild-runner/backends/x86/features @@ -6,4 +6,3 @@ :alien-callbacks :cycle-counter :fp-and-pc-standard-save -:salted-symbol-hash diff --git a/src/code/cross-sxhash.lisp b/src/code/cross-sxhash.lisp index 2509ebae0..72cbff59d 100644 --- a/src/code/cross-sxhash.lisp +++ b/src/code/cross-sxhash.lisp @@ -58,9 +58,8 @@ most-positive-fixnum))) (defun sxhash-symbol-xform (s) - #-salted-symbol-hash `(symbol-hash ,s) - #+(and salted-symbol-hash 64-bit) `(let ((h (symbol-name-hash ,s))) (sb-int:mix h h)) - #+(and salted-symbol-hash (not 64-bit)) `(symbol-name-hash ,s)) + #+64-bit `(let ((h (symbol-name-hash ,s))) (sb-int:mix h h)) ; get 60ish bits from 32 + #-64-bit `(symbol-name-hash ,s)) ) ; end EVAL-WHEN (defun calc-symbol-name-hash (string length) diff --git a/src/code/symbol.lisp b/src/code/symbol.lisp index 0ff6e7a41..2f3e7d3e2 100644 --- a/src/code/symbol.lisp +++ b/src/code/symbol.lisp @@ -392,8 +392,6 @@ distinct from the global value. Can also be SETF." (name-hash (calc-symbol-name-hash name (length name))) (symbol #+x86-64 (symbol-allocator-macro kind name) #-x86-64 (sb-vm::%alloc-symbol name))) - #-salted-symbol-hash (%set-symbol-hash symbol name-hash) - #+salted-symbol-hash (let ((salt (murmur-hash-word/fixnum (word-mix name-hash (get-lisp-obj-address symbol))))) #+64-bit diff --git a/src/cold/shared.lisp b/src/cold/shared.lisp index 91f54fa9f..2357ffb1d 100644 --- a/src/cold/shared.lisp +++ b/src/cold/shared.lisp @@ -319,12 +319,6 @@ (pushnew :immobile-code sb-xc:*features*)) (when (target-featurep :64-bit) (push :compact-symbol sb-xc:*features*)) - (when (target-featurep :64-bit) - ;; Considering that a single config file governs rv32 and rv64, I don't - ;; know how to make this properly configurable. In theory, 32-bit builds could - ;; have a salted hash (gaining 3 bits by making the hash slot raw), but - ;; they don't, so in light of things, this is a valid criterion. - (push :salted-symbol-hash sb-xc:*features*)) (when (target-featurep '(:and :sb-thread (:or (:and :darwin (:not (:or :ppc :x86))) :openbsd))) (push :os-thread-stack sb-xc:*features*)) (when (target-featurep '(:and :x86 :int4-breakpoints)) diff --git a/src/compiler/generic/genesis.lisp b/src/compiler/generic/genesis.lisp index 02d3997f8..9e818a1a5 100644 --- a/src/compiler/generic/genesis.lisp +++ b/src/compiler/generic/genesis.lisp @@ -1154,9 +1154,6 @@ core and return a descriptor to it." (defun assign-symbol-hash (descriptor wordindex name) ;; "why not just call sb-c::symbol-name-hash?" you ask? because: no symbol. (let ((name-hash (sb-c::calc-symbol-name-hash name (length name)))) - #-salted-symbol-hash - (write-wordindexed descriptor wordindex (make-fixnum-descriptor name-hash)) - #+salted-symbol-hash (let* ((salt (sb-impl::murmur3-fmix-word (descriptor-bits descriptor))) (prng-byte sb-impl::symbol-hash-prng-byte) ;; 64-bit: Low 4 bytes to high 4 bytes of slot diff --git a/src/compiler/generic/objdef.lisp b/src/compiler/generic/objdef.lisp index 78c0961d0..cf92ee7d3 100644 --- a/src/compiler/generic/objdef.lisp +++ b/src/compiler/generic/objdef.lisp @@ -433,8 +433,7 @@ during backtrace. :init :null) (name :init :arg :ref-trans symbol-name) ;; The remaining slots can be ignored by GC - #+salted-symbol-hash (hash) - #-salted-symbol-hash (hash :set-trans %set-symbol-hash :ref-trans symbol-hash) + (hash) (package-id :type index ; actually 16 bits. (Could go in the header) :ref-trans symbol-package-id :set-trans sb-impl::set-symbol-package-id :set-known ()) diff --git a/src/compiler/sxhash.lisp b/src/compiler/sxhash.lisp index 9ddfd88fe..94ca7825b 100644 --- a/src/compiler/sxhash.lisp +++ b/src/compiler/sxhash.lisp @@ -167,9 +167,6 @@ (deftransform hash-as-if-symbol-name ((object) (symbol) * :important nil) `(symbol-name-hash object)) -#-salted-symbol-hash -(define-source-transform symbol-name-hash (s) `(ldb (byte 32 0) (symbol-hash ,s))) - (intern "SCRAMBLE" "SB-C") (intern "TAB" "SB-C") diff --git a/tests/symbol.pure.lisp b/tests/symbol.pure.lisp index 919f4ccfe..b6c03af46 100644 --- a/tests/symbol.pure.lisp +++ b/tests/symbol.pure.lisp @@ -126,7 +126,7 @@ (values (/ n-well-hashed-sets n-homograph-sets) result))) -(with-test (:name :hashing-improvements :skipped-on (not :salted-symbol-hash)) +(with-test (:name :hashing-improvements) ;; Roughly: For each set of symbols colliding on SXHASH at all, what fraction ;; of those sets do NOT have any collisions on SYMBOL-HASH. (let ((expectation