Remove POINTER-HASH

Replace its single use in TOKENIZE-CONTROL-STRING, which was using a
number of constant bits from the lowtag anyway.
This commit is contained in:
Gabor Melis 2023-10-14 14:50:04 +01:00
parent 4638d539e6
commit 1857b789d2
15 changed files with 5 additions and 99 deletions

View file

@ -24,7 +24,9 @@
(defun-cached (tokenize-control-string
:memoizer memoize
:hash-bits 7
:hash-function #'pointer-hash)
:hash-function (lambda (string)
(ash (get-lisp-obj-address string)
#.(- sb-vm:n-lowtag-bits))))
((string eq))
(declare (simple-string string))
(macrolet ((compute-it ()

View file

@ -311,8 +311,8 @@ used to specify the oldest generation guaranteed to be collected."
(setf sb-c::*phash-lambda-cache* nil)
;; Clear caches depending on the generation being collected.
(cond ((eql 0 gen)
;; Drop strings because the hash is pointer-hash
;; but there is no automatic cache rehashing after GC.
;; Drop strings because the hash is address-based, but there
;; is no automatic cache rehashing after GC.
(sb-format::tokenize-control-string-cache-clear))
((eql 1 gen)
(sb-format::tokenize-control-string-cache-clear))

View file

@ -82,7 +82,6 @@
(def set-header-data (x val))
(def widetag-of)
(def %other-pointer-widetag)
(def pointer-hash)
(def vector-sap)
(def binding-stack-pointer-sap ())
#+cheneygc (def dynamic-space-free-pointer ())

View file

@ -1926,7 +1926,6 @@ is a good idea, but see SB-SYS re. blurring of boundaries.")
"PARSE-UNKNOWN-TYPE"
"PARSE-UNKNOWN-TYPE-SPECIFIER"
"PATHNAME-DESIGNATOR" "PATHNAME-COMPONENT-CASE"
"POINTER-HASH"
"POINTERP"
#+(or x86 x86-64) "*PSEUDO-ATOMIC-BITS*"
"PUNT-PRINT-IF-TOO-LONG"

View file

@ -130,15 +130,6 @@
;; maybe it should be promoted to an instruction-macro?
(inst orr t1 t1 (ash (tn-value data) n-widetag-bits))))
(storew t1 x 0 other-pointer-lowtag)))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(inst bic res ptr fixnum-tag-mask)))
;;;; Allocation

View file

@ -149,14 +149,6 @@
byte 2))
(inst ldrb tmp-tn (@ array (- byte other-pointer-lowtag)))
(inst tst tmp-tn mask))))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(inst and res ptr (lognot fixnum-tag-mask))))
;;;; Allocation

View file

@ -93,8 +93,6 @@
;;;; miscellaneous "sub-primitives"
(defknown pointer-hash (t) fixnum (flushable))
(defknown %sp-string-compare
(simple-string simple-string index (or null index) index (or null index))
(values index fixnum)

View file

@ -128,16 +128,6 @@
(zero))
(storew t1 x 0 other-pointer-lowtag)))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:temporary (:scs (non-descriptor-reg)) temp)
(:policy :fast-safe)
(:generator 1
(inst li temp (lognot fixnum-tag-mask))
(inst and res ptr temp)))
;;;; Allocation

View file

@ -127,15 +127,6 @@
(zero))
(storew t1 x 0 other-pointer-lowtag)))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(inst clrrwi res ptr n-fixnum-tag-bits)))
;;;; Allocation

View file

@ -131,14 +131,6 @@
(inst or t1 t1 t2)
(storew t1 x 0 other-pointer-lowtag)))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(inst clrrdi res ptr n-fixnum-tag-bits)))
;;;; Allocation

View file

@ -139,14 +139,6 @@
(zero))
(storew t1 x 0 other-pointer-lowtag)))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(inst andi res ptr (lognot fixnum-tag-mask))))
;;;; Allocation

View file

@ -123,18 +123,6 @@
(zero))
(storew t1 x 0 other-pointer-lowtag)))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg)))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
;; FIXME: It would be better if this would mask the lowtag,
;; and shift the result into a positive fixnum like on x86.
(inst sll res ptr 3)
(inst srl res res 1)))
;;;; allocation

View file

@ -215,15 +215,6 @@
(multiple-value-bind (imm8 shift) (header-byte-imm8 mask)
(inst test :byte (ea (- (1+ shift) other-pointer-lowtag) array) imm8)))))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg) :target res))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(move res ptr)
(inst and res (lognot fixnum-tag-mask))))
;;;; allocation
(define-vop (binding-stack-pointer-sap)

View file

@ -138,15 +138,6 @@
(t
(bug "Unimplemented")))))
(define-vop (pointer-hash)
(:translate pointer-hash)
(:args (ptr :scs (any-reg descriptor-reg) :target res))
(:results (res :scs (any-reg descriptor-reg)))
(:policy :fast-safe)
(:generator 1
(move res ptr)
(inst and res (lognot fixnum-tag-mask))))
;;;; allocation
(define-vop (binding-stack-pointer-sap)

View file

@ -1316,16 +1316,6 @@ void smash_weak_pointers(void)
/* Hash tables */
#if N_WORD_BITS == 32
#define EQ_HASH_MASK 0x1fffffff
#elif N_WORD_BITS == 64
#define EQ_HASH_MASK 0x1fffffffffffffff
#endif
/* Compute the EQ-hash of KEY. This must match POINTER-HASH in
* target-hash-table.lisp. */
#define EQ_HASH(key) ((key) & EQ_HASH_MASK)
/* List of weak hash tables chained through their NEXT-WEAK-HASH-TABLE
* slot. Set to NULL at the end of a collection.
*