From eed9a35799d0fefb3c4054ec025769c7d22f8f50 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 10 Apr 2007 18:10:31 +0000 Subject: [PATCH] 1.0.4.57: Make the compiler's bit-vector functions use standard CL idioms * We can do this and still get inline loops because of the REPLACE/UB*-BASH-COPY/SUBSEQ/COPY-SEQ work committed early; * ...and, as a nice bonus, make them slightly faster by doing so. --- src/compiler/bit-util.lisp | 26 ++++---------------------- version.lisp-expr | 2 +- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/compiler/bit-util.lisp b/src/compiler/bit-util.lisp index 0bc7498..ca564bb 100644 --- a/src/compiler/bit-util.lisp +++ b/src/compiler/bit-util.lisp @@ -19,37 +19,19 @@ ;;; Clear a SIMPLE-BIT-VECTOR to zeros. (defun clear-bit-vector (vec) (declare (type simple-bit-vector vec)) - (bit-xor vec vec t)) - -;;; The old (pre-1999) code had a more-efficient-looking, but also -;;; less-portable implementation of CLEAR-BIT-VECTOR: -;;; (do ((i sb!vm:vector-data-offset (1+ i)) -;;; (end (+ sb!vm:vector-data-offset -;;; (ash (+ (length vec) (1- sb!vm:n-word-bits)) -;;; (- (1- (integer-length sb!vm:n-word-bits))))))) -;;; ((= i end) vec) -;;; (setf (sb!kernel:%raw-bits vec i) 0))) -;;; We could use this in the target SBCL if the new version turns out to be a -;;; bottleneck. I (WHN 19990321) will stick to the portable version for now. -;;; And by the way, if we do revisit this file with efficiency on our mind, it -;;; might be good to check whether it's really that helpful to implement -;;; all these functions as INLINE. (How expensive can it be to call a -;;; 1-argument function? How expensive is it to fill up our cache with -;;; a bunch of redundant loop expansions?) -;;; -;;; FIXME: Perhaps do simple benchmarks against CMU CL to check this. + (fill vec 0)) ;;; Fill a bit vector with ones. (defun set-bit-vector (vec) (declare (type simple-bit-vector vec)) - (bit-orc2 vec vec t)) + (fill vec 1)) ;;; Replace the bits in To with the bits in From. (defun bit-vector-replace (to from) (declare (type simple-bit-vector to from)) - (bit-ior from from to)) + (replace to from)) ;;; Copy a bit-vector. (defun bit-vector-copy (vec) (declare (type simple-bit-vector vec)) - (bit-ior vec vec (make-array (length vec) :element-type 'bit))) + (copy-seq vec)) diff --git a/version.lisp-expr b/version.lisp-expr index aebc90c..50e8753 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.4.56" +"1.0.4.57" -- 1.7.10.4