Enable #+salted-symbol-hash for 64-bit riscv

This commit is contained in:
Douglas Katzman 2024-03-04 10:35:50 -05:00
parent 755ff1e550
commit 74c3889094
4 changed files with 16 additions and 14 deletions

View file

@ -3,4 +3,3 @@
:64-bit :untagged-fdefns :sb-thread :soft-card-marks
:gencgc
:compare-and-swap-vops :alien-callbacks
:salted-symbol-hash

View file

@ -15,4 +15,3 @@
:executable-funinstances
:unbind-in-unwind
:no-continue-unwind
:salted-symbol-hash

View file

@ -319,6 +319,12 @@
(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))

View file

@ -198,23 +198,21 @@
(:translate symbol-global-value))
#+64-bit
(progn
(define-vop (symbol-hash)
(:policy :fast-safe)
(:translate symbol-hash)
(:args (symbol :scs (descriptor-reg)))
(:temporary (:scs (non-descriptor-reg)) temp)
(:results (res :scs (any-reg)))
(:results (res :scs (unsigned-reg)))
(:result-types positive-fixnum)
(:generator 2
;; The symbol-hash slot of NIL holds NIL because it is also the
;; cdr slot, so we have to strip off the two low bits to make
;; sure it is a fixnum. The lowtag selection magic that is
;; required to ensure this is explained in the comment in
;; objdef.lisp
(loadw temp symbol symbol-hash-slot other-pointer-lowtag)
(inst andi res temp (lognot fixnum-tag-mask))))
#+64-bit
(loadw res symbol symbol-hash-slot other-pointer-lowtag)
(inst srli res res 24))) ; shift out 3 bytes
(define-vop (symbol-name-hash symbol-hash)
(:translate symbol-name-hash)
(:generator 1
(inst lwu res symbol ; little-endian
(- (+ 4 (ash symbol-hash-slot word-shift)) other-pointer-lowtag))))
(define-vop ()
(:args (symbol :scs (descriptor-reg)))
(:results (result :scs (unsigned-reg)))
@ -225,7 +223,6 @@
(inst lhu result symbol (+ (ash symbol-name-slot word-shift)
(- other-pointer-lowtag)
6)))) ; little-endian
#+64-bit
(define-vop ()
(:policy :fast-safe)
(:translate symbol-name)
@ -237,6 +234,7 @@
(loadw result symbol symbol-name-slot other-pointer-lowtag)
(inst slli result result sb-impl::package-id-bits)
(inst srli result result sb-impl::package-id-bits))))
) ; end PROGN
;;;; Fdefinition (fdefn) objects.