From 30053acb9149bccc62c1b301f975fdde9a628121 Mon Sep 17 00:00:00 2001 From: cshapiro <cshapiro> Date: Tue, 1 Apr 2008 07:09:28 +0000 Subject: [PATCH] Remove the old string hash function. Also, remove the cld instruction from the current string hash function. The use of this instruction was a holdover from the old string hash function and does not have an effect on the current implementation. --- assembly/x86/array.lisp | 71 +---------------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-) diff --git a/assembly/x86/array.lisp b/assembly/x86/array.lisp index a6eae7bc4..4b7de9302 100644 --- a/assembly/x86/array.lisp +++ b/assembly/x86/array.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/x86/array.lisp,v 1.9 2004/04/07 01:27:53 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/x86/array.lisp,v 1.10 2008/04/01 07:09:28 cshapiro Exp $") ;;; ;;; ********************************************************************** ;;; @@ -63,73 +63,6 @@ (loadw length string vector-length-slot other-pointer-type) (inst jmp (make-fixup 'sxhash-simple-substring :assembly-routine))) -#+nil -(define-assembly-routine (sxhash-simple-substring - (:translate %sxhash-simple-substring) - (:policy :fast-safe) - (:arg-types * positive-fixnum) - (:result-types positive-fixnum)) - ((:arg string descriptor-reg ebx-offset) - (:arg length any-reg edi-offset) - (:res result any-reg edx-offset) - - (:temp esi unsigned-reg esi-offset) - (:temp ecx unsigned-reg ecx-offset) - (:temp eax unsigned-reg eax-offset)) - ;; Compute a pointer to where we are going to be extracting the bits. - (inst lea esi (make-ea :byte :base string - :disp (- (* vector-data-offset word-bytes) - other-pointer-type))) - ;; Initialize the result. - (inst xor result result) - ;; Get the count. If it's zero, blow out. - (inst mov ecx length) - (inst jecxz done) - ;; Convert it into count of the number of full words. If zero, then skip - ;; to the part that handles the tail. - (inst shr ecx 4) - (inst jecxz do-extra) - ;; Clear the direction flag, so we advance through memory. - (inst cld) - - LOOP - ;; Merge each successive word with the result. - (inst lods eax) ; load 32-bits into eax and (+4 esi) - - (inst rol result 5) - (inst xor result eax) - (inst loop loop) - - DO-EXTRA - ;; Now we have to take care of any bytes that don't make up a full word. - ;; First, check to see how many of them there are. If zero, blow out of - ;; here. Otherwise, multiply by 8. - (inst mov ecx length) - (inst and ecx (fixnumize 3)) - (inst jecxz done) - (inst shl ecx 1) - - ;; Grab the last word. - (inst lods eax) - - ;; Convert the count into a mask. The count is multiplied by 8, so we just - ;; shift -1 left, which shifts count*8 zeros into the low order end. We - ;; then invert that, ending up with a mask of count*8 ones. - (inst mov esi -1) - (inst shl esi :cl) - (inst not esi) - ;; Use the mask to strip off the bits we arn't interested in, and merge - ;; the remaining bits with the result. - (inst and eax esi) - (inst rol result 5) - (inst xor result eax) - - DONE - - ;; Force result to be a positive fixnum. - (inst and result #x7ffffffc) - (inst ret)) - (define-assembly-routine (sxhash-simple-substring (:translate %sxhash-simple-substring) (:policy :fast-safe) @@ -152,8 +85,6 @@ (inst mov ecx length) (inst jecxz done) (inst shr ecx 2) ; Convert fixnum to byte count - ;; Clear the direction flag, so we advance through memory. - (inst cld) LOOP ;; Merge each successive word with the result. -- GitLab